PLAYER_COMMAND

Discussion in 'Plugin Development' started by leetgamer, Mar 24, 2011.

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

    leetgamer

    Ok so I'm fairly new to programming but I'm attempting something simple to get me started. I'm using the wiki guide found at http://wiki.bukkit.org/Programming_A_Plugin as well as some source code that relates to what I'm trying.

    However eclipse keeps telling me that the event PLAYER_COMMAND cannot be resolved, any reason why, or am I just using an old tutorial and that event has been removed.
    Code:
    pm.registerEvent(Event.Type.PLAYER_COMMAND, playerListener, Priority.Normal, this);
     
  2. Offline

    nekosune

    The PLAYER_COMMAND event has been replaced with onCommand in the JavaPlugin class
     
  3. Offline

    leetgamer

  4. Offline

    nekosune

    No problem, been learning myself, and the least I can do is help someone who has had the same problem as me, also bear in mind you now need to add commands to the plugin.yml file
     
  5. Offline

    Xgkkp

    I went through that yesterday - the "This tutorial is out of date" isn't far off - but found you can use PLAYER_COMMAND_PREPROCESS to do much the same job. I should really move to the OnCommand method, but haven't dug through anybodys code yet to work out how to do it.
     
  6. Offline

    madcap

    Hey guys. If you want to see an example my SimpleAlias plugin has examples of both onCommand and PLAYER_COMMAND_PREPROCESS.

    https://github.com/madcap/SimpleAlias

    onCommand is definitely the way to go in most cases since commands could technically come from sources besides just players.
     
Thread Status:
Not open for further replies.

Share This Page