Bukkit Plugin Developing for Dummies

Discussion in 'Plugin Development' started by aPunch, Feb 24, 2011.

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

    aPunch

    To all Plugin Developers out there -

    I have just gotten into Java. For the past couple of days I have been watching tutorials on basic Java language, such as setting up methods, constructors, and whatnot. What I'm looking for is Bukkit and Minecraft-specific advice on creating a plugin. Here is what I plan on doing and some questions I have regarding it:

    -I am planning on starting off my plugin career with a simple Welcome Message that is displayed upon a user logging in. I would eventually like to implement colors and maybe in-game commands, but for now I'd like to start out small.

    Questions:
    HOOKS - What exactly are hooks? How do I implement them into my code? Which hooks would be best to use in my Welcome Message plugin?

    CODING - I know there is a basic template out there for a starter plugin. I am about to dive into that and try it out. Is there any advice you could give me that would help me start from scratch on this Welcome Message plugin?

    RELEASING MY PLUGIN - When I finally reach the stage where I feel comfortable releasing the plugin/using it on my server, how do I go about the whole process of release? Do I need to follow some specifications listed somewhere on this forum? I think I have seen a thread like that so I will double-check

    This doesn't have to be a long guide or anything. I'd appreciate anything you developers have to offer. If you find something that I asked for is "dumb" because I should have used the search button first, please feel free to let me know. I just find it kind of rude to say that, as sometimes the information one is looking for is not explicitly written anywhere here on the forums.

    Answers to my questions and/or feedback would greatly be appreciated. I hope to start developing my Welcome Message plugin sometime in the near future, after I have completed my online Java tutorials. Thank you in advance to anyone who gives me feedback!

    -aPunch
     
  2. Offline

    TnT Retired Staff

    Moved thread to plugin development forum - more suited in there.
     
  3. Offline

    aPunch

    Okay, my mistake. Thank you!
     
  4. Offline

    ceulemans

  5. Offline

    aPunch

    Yes I watched it, but it really didn't make things clear to me. I guess I should watch it again, because things may not get any easier than that.
     
  6. Offline

    ceulemans

    Yeah, pm me if you have a code question.
     
  7. Offline

    Edward Hand

    Ok. I shan't try explain as such, since there are plenty of tutorials about the place that do that. I'll just give you some points that you can go away and investigate for yourself.

    1) Usually your plugin wont constantly be doing stuff. It will only need to do things in response to something happening on the server (like somebody logging in). Hooks allow you to trigger bits of code when a particular event takes place. To respond to events your code needs to have:
    • A class that extends the relevant listener (PlayerListener, BlockListener etc)
    • A function within that class with the right name, which will be called when the event occurs. (Look at the documentation for individual listeners for a list of the functions)
    • A line of code in your onEnable() function that creates an instance of the listener and registers it to recieve a type of event.
    2) Don't start from scratch. Find examples. Look at them. See how they work and how they fit together. Then replicate that yourself. That's the best way to learn.

    3) You release it on the 'Plugin Submitions' board. Your post must conform to certain guidelines. These guidelines are outlined in a post sticked at the top of that board.
     
  8. Offline

    aPunch

    Wow, thanks for the information, Edward. For the my plugin, which class do I need? I am assuming the PlayerListener class since Welcome Message won't apply to blocks of any type.

    I'll be sure to thank any in my thread who give me significant advice when I do finally release it. Thanks again.

    Is there a MOTD/WelcomeMessage type plugin out there that has released its source code? I'm trying to find one so I can see how to go about starting off, but I am having trouble locating one.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 10, 2016
  9. Offline

    retsrif

    I don't know any MOTD plugin though I can tell you basically how to do it:
    Set up your main file and a PlayerListener.
    In the main file have a plugin manager detect a PLAYER_JOIN event.
    In PlayerListener, have a method which is probably public void onPlayerJoin, and inside it, have it send a message to the player.
     
Thread Status:
Not open for further replies.

Share This Page