Solved SignEvent Will not fire?

Discussion in 'Plugin Development' started by PolarCraft, Dec 12, 2013.

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

    PolarCraft

    The event will not fire. No stack-trace. But when i right click the sign it will not fire the command.

    Main.class:
    Code:java
    1. public class Main extends JavaPlugin
    2. {
    3. public void onEnable()
    4. {
    5. getServer().getPluginManager().registerEvents(new StandardEvent(), this);
    6. getCommand("standard").setExecutor(new StandardCommand());
    7. }
    8.  
    9. public void onDisable()
    10. {
    11. }
    12. }


    StandardEvent.class:
    Code:java
    1. @EventHandler
    2. public void onSignChange(SignChangeEvent e)
    3. {
    4. Player p = e.getPlayer();
    5. if ((e.getLine(0).equalsIgnoreCase("[KitPvp]")) &&
    6. (e.getLine(1).equalsIgnoreCase("s")) &&
    7. (p.hasPermission("kitpvp.admin.signmake"))) {
    8. e.setLine(0, ChatColor.BLACK + "[" + ChatColor.DARK_RED + "KitPvp" + ChatColor.BLACK + "]");
    9. e.setLine(1, ChatColor.GREEN + "Standard");
    10. }
    11. }
    12.  
    13. @EventHandler
    14. public void SignClick(PlayerInteractEvent e)
    15. {
    16. Player p = e.getPlayer();
    17. if (e.getAction() == Action.RIGHT_CLICK_BLOCK)
    18. {
    19. if ((e.getClickedBlock().getState() instanceof Sign)) {
    20. Sign sign = (Sign)e.getClickedBlock().getState();
    21. if ((sign.getLine(0).equalsIgnoreCase(ChatColor.BLACK + "[" + ChatColor.DARK_RED + "KitPvp" + ChatColor.BLACK + "]")) && (p.getGameMode() == GameMode.SURVIVAL) &&
    22. (sign.getLine(1).equalsIgnoreCase("Standard"))) {
    23. p.performCommand("standard");
    24. p.updateInventory();
    25. }
    26. }
    27. }
    28. }
    29. }
     
  2. Offline

    AoH_Ruthless

    PolarCraft
    Which event isn't firing (you posted 2)?
    I would recommend adding debug messages.
     
    Max_The_Link_Fan likes this.
  3. Offline

    HyrulesLegend

  4. Offline

    PolarCraft

    AoH_Ruthless "when i right click the sign it will not fire the command."
     
  5. Offline

    AoH_Ruthless

    PolarCraft
    Ooops :oops:, kind of read half the post and then looked at code.

    I can't see what's wrong at glancing at it, so yeah, try adding debugs.
     
  6. Offline

    PatrickH123

    PolarCraft, does the StandardEvent.class implement Listener?
     
  7. Offline

    PolarCraft

  8. Offline

    lordbobby104

    PolarCraft As everyone else in this thread has said... Add debug messages they will allow you to figure out where the code is screwing up..
     
Thread Status:
Not open for further replies.

Share This Page