Question ServerSigns

Discussion in 'General Help' started by Daveepvp, May 29, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    Daveepvp

    I've a Problem with the type ChatColor.stripColor( ... )

    Problem:

    @EventHandler
    public void on(PlayerInteractEvent e) {
    if(e.getAction() == Action.RIGHT_CLICK_BLOCK) {
    if(e.getClickedBlock() instanceof Sign) {
    Sign sign = (Sign)e.getClickedBlock().getState();

    if(sign.getLine(0) != null && sign.getLine(0) != "") {
    if(ChatColor.stripColor(sign.getLine(0).equalsIgnoreCase("[Command]"))) {

    if(sign.getLine(1) != null && sign.getLine(1) != "") {
    if(sign.getLine(0).startsWith("┬ža/")) {
    String cmd = sign.getLine(1).replace("/", "");
    Bukkit.dispatchCommand(Bukkit.getConsoleSender(), cmd);

    And the Courrent Error is:
    The method stripColor(String) in the type ChatColor is not applicable for the arguments (boolean)
    ------------------

    What can I do ? Please help me :D
     
  2. Offline

    Googlelover1234

    @DaveepvpWhat you are trying to do is stripping the color of a boolean value, because you are essentially telling ChatColor to strip the color of "signText.equalsIgnoreCase()" which obviously will return a boolean. In order to fix this problem, you'll need to strip the color of a string, by stripping the color of the text of the sign first, than checking if it is equal.
     
Thread Status:
Not open for further replies.

Share This Page