Signs run commands?

Discussion in 'Plugin Development' started by Aephout14, Nov 8, 2014.

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

    Aephout14

    Does anyone know how to make a command run right clicking a sign, I can't find a single tutorial about this anywhere...
     
  2. Offline

    jb42300

    Code:java
    1. @EventHandler
    2. public void onPlayerInteract(final PlayerInteractEvent e) {
    3. if (!(e.getAction() == Action.RIGHT_CLICK_BLOCK)) return;
    4. if (e.getClickedBlock().getState() instanceof Sign) {
    5. Sign s = (Sign) e.getClickedBlock().getState();
    6. if (s.getLine(0).equalsIgnoreCase("ยง9[Heal]")) {
    7. //Either
    8. p.performCommand("heal");
    9. //Or
    10. Bukkit.getServer().dispatchCommand("heal <player>");
    11. }
    12. }
    13. }
    14.  
     
Thread Status:
Not open for further replies.

Share This Page