Solved OnInventoryClick Event not working?

Discussion in 'Plugin Development' started by mcrazmouze, Sep 1, 2016.

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

    mcrazmouze

    Why won't it send a message when i'm clicking in my inventory?

    Code:
    package me.bukkit.melonos;
    
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.inventory.InventoryClickEvent;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class Main extends JavaPlugin implements Listener {
       
        public void OnEnable() {
        getServer().getPluginManager().registerEvents(this, this);
        }
       
    
        @EventHandler
        public void OnInventoryClick( InventoryClickEvent e ) {
            e.getWhoClicked().sendMessage("STOP CLICKING!");
            return;
        }
    
    }
    
    
     
  2. Offline

    AlvinB

    @mcrazmouze
    Your method is named "OnEnable" not "onEnable", causing your event to never get registered. As a tip for the future. use the @Override annotation. This way your IDE will throw errors if you are not overriding a method.
     
Thread Status:
Not open for further replies.

Share This Page