Solved Event - sign change event - get line

Discussion in 'Plugin Development' started by TGamingStudio, Dec 4, 2017.

Thread Status:
Not open for further replies.
  1. Hello i want to get line in sign while sign change event :
    Code:
    @EventHandler
        public void Change(SignChangeEvent e)
        {
            Player p = e.getPlayer();
            Block block = e.getBlock();
            BlockState state = block.getState();
                Sign sign = (Sign) state;
                p.sendMessage("test"); // works
                if(sign.getLine(0).equalsIgnoreCase("[WorldTools]")) //doesnt works
                {
                    p.sendMessage("wt sign");
                    if(p.hasPermission("worldtools.sign.place"))
                    {
                        p.sendMessage(ChatColor.translateAlternateColorCodes('&',"&7[&6WorldTools&7] &aSign Placed"));
                    }
                    else
                    {
                        p.sendMessage(ChatColor.translateAlternateColorCodes('&',"&7[&6WorldTools&7] &4You dont have permissions to place signs"));
                        e.setCancelled(true);
                    }
                }
        }
    it works for me with break and rightclick but not when Change
    Code:
    if(sign.getLine(0).equalsIgnoreCase("[WorldTools]")) //doesnt works
    Please help , thanks
     
  2. Offline

    timtower Administrator Administrator Moderator

  3. @timtower
    when i only place sign it shows "test"
    but i cant test for other thigs...
    nothing to console..
     
  4. Offline

    timtower Administrator Administrator Moderator

    @TGamingStudio Why can't you test other things then? You can just use p.sendMessage(sign.getLine(0))
     
  5. @timtower i want test if player placed sign with first line WorldTools , than if have permissions place if not not ...
     
  6. Offline

    timtower Administrator Administrator Moderator

    @TGamingStudio I am trying to debug with you.
    You need to find out what is wrong before you can continue.
     
  7. I cant get Line of changed Sign .. :/
     
  8. Offline

    timtower Administrator Administrator Moderator

Thread Status:
Not open for further replies.

Share This Page