Getting a signs text?

Discussion in 'Plugin Development' started by RandomGuyDom, Apr 16, 2014.

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

    RandomGuyDom

    I have tried to get a the text on a sign for a hub that I am working on however cannot managed to do it!

    I first tried to use the event: PlayerInteractEntityEvent however that turned out not to work and after some googling, I found to use PlayerInteractEvent. I then tried it and it didn't work. However I wasn't getting an internal error as of before, now nothing is happening! I then added some 'else' statements to see what the problem was and it turns out that it is not recognising the block type of a wall sign!
    Code:
    @EventHandler(priority = EventPriority.HIGHEST)
        public void onPlayerInteract(PlayerInteractEvent p){
            Player player = p.getPlayer();
            if(p.getAction().equals(Action.RIGHT_CLICK_BLOCK)){
                if(p.getClickedBlock().equals(Material.WALL_SIGN)){
                    Sign sign = (Sign) p.getClickedBlock().getState();
                    if(sign.getLine(1).equalsIgnoreCase("Skyblock Hub")){
                        player.performCommand("mw goto SkyblockHub");
                    }
                    }
                }
                }
    
    Note: If you are new to this thread, don't copy the code from above as it does not work! (For me anyway...) :)
     
  2. Offline

    Glumpz

    RandomGuyDom Check if the block is an instance of a sign.
     
  3. RandomGuyDom
    I was actually just watching this video. Timing eh?
     
Thread Status:
Not open for further replies.

Share This Page