1.14.4 Read text from a sign - HELP

Discussion in 'Spigot Plugin Development' started by brttdom, Jan 16, 2020.

  1. Well, I'm making a plugin that needs to verify the ChestShop store name. And I'm having trouble getting a line from the board. With the name "LanderShop"

    I am making the plugin in .jar version 1.14.4

    Here is the method used:

    Code (Java):
        @EventHandler
        public void onPlayerInteract(PlayerInteractEvent e) {
            Action a = e.getAction();
            Block block = e.getClickedBlock();
            Player plr = e.getPlayer();
            if(block.getType().equals(Material.OAK_SIGN)) {
                Sign sign = (Sign) block.getState();
                String[] lines = sign.getLines();
                String l1 = lines[0];
                String l2 = lines[1];
                String l3 = lines[2];
                String l4 = lines[3];
                if(l1.equalsIgnoreCase("Hi")){
                    plr.sendMessage("Hi");
                }
            }
        }
     
  2. This is literally a screenshot from the post you copied your code from with the explanation right below:

    XDD

    Screenshot_16.png
     
  3. Just double checking... Is the event registered? And are you sure that you're placing an oak sign down for your text?

    As is stated here ^ You need to check wall sign and sign. If you just get the name of the material and check if it contains SIGN, that should pretty much cover all different types of signs.
     
  4. I really like it when people just copy a bunch of code from the forums, and then post the code and ask why it doesn't work