Sign Events Help?

Discussion in 'Plugin Development' started by Epicballzy, Apr 18, 2014.

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

    Epicballzy

    I'm trying to make signs that if I put something like "[Kits]", it will set the lines 0, 1, 2 and 3 to something, and I will be able to click it an I will do something. The code I have right now only allows me to put [Kits] and when I right click, it opens an inventory. How do I set it up so it changes the lines to something and I'll be able to right click it also?

    Code:
    Code:java
    1. @EventHandler(priority = EventPriority.LOW)
    2. public void onPlayerInteract(PlayerInteractEvent event) {
    3. if (event.getClickedBlock() == null) return;
    4. Player player = event.getPlayer();
    5. Block block = event.getClickedBlock();
    6.  
    7. if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
    8. if (block.getType() == Material.SIGN_POST || block.getType() == Material.SIGN) {
    9. Sign sign = (Sign) block.getState();
    10. if (sign.getLine(0).equalsIgnoreCase("[Kits]")) {
    11. player.openInventory(KitPvp.shop);
    12. player.playSound(player.getLocation(), Sound.CHEST_OPEN, 1, 1);
    13. }
    14. }
    15. }
    16. }


    Anyone?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
Thread Status:
Not open for further replies.

Share This Page