Functions not registering?

Discussion in 'Plugin Development' started by feverdream, Jan 10, 2011.

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

    feverdream

    I'm attempting to make a few plugins of my own in the hope that I can be a valuable member of the plugin community instead of just being the guy who hates bloat in code, and I seem to be running into an issue where functions are not registering even if I call what I think are the correct API functions.

    My code looks exactly like the following, it is copy-pasta from my source:

    Code:
        public void onEnable() {
            getServer().getPluginManager().registerEvent(Event.Type.PLAYER_COMMAND, playerListener, Priority.Normal, this);
            playerListener.loadSettings();
            System.out.println(name + " " + version + " initialized!");
        }
    
    Yes, if the user types the command.. nothing happens. I get the normal "player tried to try unknown command" messages on the server side, etc.. and thats it. Strange thing is, I get the "initialized" message on the console as if everything is fine and loaded... but when I try to issue the command, nothing happens.

    My expected result is that public void onPlayerCommand(PlayerChatEvent event) will be called.. does anybody know where I messed up?
     
  2. Offline

    PrivateAlpha

    are you sure its not registering? put a system.out.println on the first line of your onPlayerCommand method and see if it prints out?
     
  3. Offline

    Derek Peterson

    You have to use event.setCancelled(true) in the method, or it sends the command to notch's stuff (/tp p1 p2 etc)
     
  4. Offline

    feverdream

    oh ok so if I am overriding a normal command from th standard server I should act, then cancel?
     
Thread Status:
Not open for further replies.

Share This Page