2 questions by a newbie

Discussion in 'Plugin Development' started by cyberbobjr, Mar 18, 2011.

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

    cyberbobjr

    Hi coders :)
    I wanted to start my own plugin in java, and i carved deeply into the wiki. I read some topics, and looking inside some code.
    But i have 2 questions :
    - For managing command :
    I've see in the Dinnerbone code (https://github.com/Bukkit/ScrapBukk.../com/dinnerbone/bukkit/scrap/ScrapBukkit.java) that "Commands" was handled by "Executor Class"
    But, in this tutorial (http://forums.bukkit.org/threads/beginner-tutorial-chat-messages-and-itemstacks.8594/), command was handled by the function "onCommand"
    Question : what is the best choice to use ?

    - Events :
    Events was handled with PluginManager, like that (code taken from http://forums.bukkit.org/threads/simple-login-message.8914/#post-137061) :
    Code:
    PluginManager pm = getServer().getPluginManager();
    pm.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Monitor, this);
    
    Question 1 : Does this code is still correct ?
    Question 2 : Where can i get all messages types (like PLAYER_JOIN) and explanation about them ?

    Thanks for your help.
    Best regards.
     
  2. Offline

    MadMonkeyCo

  3. Offline

    clash

    I'm confused. How are you designated as a "Plugin Developer" and you just now want to *start* a plugin? [​IMG]

    Anyway, you can use either onCommand() in your plugin directly, or the executors. Whichever you like.
    I think a simple plugin with very few commands could just override onCommand in Plugin and be done.
    If, however, your plugin support several commands, or you just like to keep code/logic well-separated, then the separate classes which implement CommandExecutor is better, IMO.
     
  4. Offline

    cyberbobjr

    Hi,
    I have made this :
    http://forums.bukkit.org/threads/web-admn-webukkit-v0-beta9.4141/

    Thank you for the precisio :)

    Thanks you.

    regards
     
Thread Status:
Not open for further replies.

Share This Page