Plugin Template [935] [OUTDATED]

Discussion in 'Resources' started by Tagette, May 25, 2011.

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


    Template Version <font color="rgb(0, 204, 255)">1.1.5 <font color="rgb(0, 0, 0)">[935](NOW SUPPORTS MYSQL)</font></font>

    <font color="rgb(255, 0, 0)">Looking for someone to make a video on how to use my template to make their plugin. If you would like to do this for me please let me know. I have decided not to put the effort into making my own video.</font>

    I have been creating a bukkit plugin template for the last couple weeks and I have decided I am going to release it to you guys. Let me know if this template is adequate enough. This is actually my first plugin for bukkit so it may need some fixing. I have been searching through source code and the forums to make it as practical as possible for everyone. Hope you enjoy.

    - Examples on how to use in the code,
    - Multiple plugin support, (Permissions, GroupManager, Help, iConomy 4&5, BOSEconomy, OddItem, Lockette, LWC... and more)
    - Auto Updater Support,
    - Auto generating Settings and Language files, (With auto-generating comments)
    - SQLite or MySQL data management,
    - And More...
    Show Spoiler
    1) Extract the zip to where you like.
    2) Create a new project with your favorite Java IDE and use the src folder from the as the project source.
    3) Rename the packages from "me.tagette.template" to "me.<Your Name>.<Your Plugin>".
    4) Replace any instances of Tagette in any of the classes under "src/me".
    5) Rename your classes to whatever you like. (Try to keep it standard! For example if your plugin's name was "Basic" then you would rename "" to "".)
    6) Add all the .jar files from the lib folder into the libraries of the project. (Netbeans Eclipse)
    7) Edit the plugin.yml and enter your information. (Note: In order for a command to work it must be in the plugin.yml)
    8) Build and test? YAY!

    Show Spoiler
    - Download latest support plugins.
    - Download latest template.
    - Download latest working CraftBukkit.
    - Extracts and renames files for you from template.
    - Simple use:
    I) Enter Name
    II) Enter Plugin Name
    III) Enter Plugin Initials
    IV) Click Create Button

    Info: If you would like this to be made, please request it. Otherwise I won't waste my time on it.

    Future Features:
    - Java Application that extracts and renames for you. (3/4 done) <font color="rgb(255, 0, 0)">*On Hold*</font>
    - Suggestions?
    Show Spoiler
    * July 4 - Enhanced debug system and more. (1.1.5)
    * June 29 - Tidied up code, enhanced the debug system and the command system. (1.1.4)
    * June 29 - Added Auto-Updater and Plugin Constants. (1.1.3)
    * June 18 - Updated Libraries and added LowDetailMode. (1.1.2)
    * June 2 - More minor code changes. (1.1.1)
    * June 2 - Updated example commands. (1.1.1) [Added support for console commands]
    * June 2 - Removed Simplified Database (1.1.1) [Didn't actually simplify]
    * May 28 - Added plugin debug mode command. (Currently only debugs SQL) (1.1.0)
    * May 28 - More minor code changes. (1.1.0)
    * May 28 - Fixed SQLite (1.1.0)
    * May 28 - Added MySQL Support (Alta189's SQL Lib) (1.1.0)
    * May 28 - Removed useless code & Tidied up code (1.0.9)
    * May 27 - Changed how to setup. (1.0.8)
    * May 27 - New Command System (1.0.7)
    * May 27 - Permissions Fix (1.0.6)
    * May 25 - Download changed. (1.0.5)
    * May 25 - Changed how to setup. (1.0.4)
    * May 25 - LWC error fixed. (1.0.3)
    * May 25 - GitHub enabled. (1.0.2)
    * May 25 - Released. (1.0.1)

    Show Spoiler
    Add your command to the command manager in
         * Sets up the core commands of the plugin.
        private void setupCommands() {
            // Add command labels here.
            // For example in "/template version" and "/template reload"
            //    the label for both is "template".
            // Make your commands in the me.tagette.template.commands package.
            //    Each command is a seperate class.
            addCommand("template", new TemplateCmd(this));
    Create your class in the me.<Your Name>.<Plugin Name>.commands package.
    Name it something meaningful, for instance in this example, "" since the command is template.

    There are a few methods you should know before starting your commands:
    is(String entered, String label) - This compares the entered value from the user to a subcommand's label.
    isPlayer() - This returns true if the thing that sent the command is a player. If it is not a player then it was the console that sent it.
    getPlayer() - This will get the player if it is actually a player. Otherwise is returns null.
    getName() - This gets the name of the player if it is actually a player. Otherwise it returns "Console".
    sendMessage(String message) - Sends a message to the player only if it is actually a player.
    sendLog(String message) - Sends a log to the console only if the caller of the command is not a player.

    Now in the class you just created it must be similar to the example given. It must implement CommandExcecutor and have a overidden method called onCommand. (Easiest way is to just copy TemplateCmd and rename it)
     * @description Handles a command.
     * @author Tagette
    public class TemplateCmd implements CommandExecutor {
        private final Template plugin;
        private CommandSender cSender;
        public TemplateCmd(Template instance) {
            plugin = instance;
        public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    Now in the onCommand method go to where it says "// Put your commands here". That is where you start coding your commands. There are some examples in the TemplateCmd class you can go by.
    else if (!defaultCommand(command, label, args)) {
                // Put your commands in here
                // This is the sub command name
                if (is(args[0], "getawesome")) {
                    // This means that the command has been handled
                    //    so bukkit won't send an error message.
                    handled = true;
                    // This is how you find a permission and check if actually a player
                    if ((isPlayer() && TPermissions.has(getPlayer(), "template.awesomeness", getPlayer().isOp()))){ 

    Download: (GitHub)
    <Edit by Moderator: Redacted mediafire url>

    Source Code / GitHub:
    Show Spoiler
    - None that I know of. If you have found one let me know.

    Please leave a comment about any suggestions or fixes you may have and let me know what you think. I am still deciding if it would be worth making the java application so let me know if you would like it.
    Show Spoiler
    - To Bukkit for making CraftBukkit possible.
    - To nijikokun for the register source.
    - To alta189 for the SQL lib source.
    - To TaylorKelly for the properties file source.
    - To Adamki11s for the AutoUpdater source.
    - To the awesome developers who developed:
    -> BOSEconomy
    -> Essentials
    -> GroupManager
    -> Help
    -> iConomy 4 & 5
    -> Lockette
    -> LWC
    -> OddItem
    -> Permissions
    - To anyone else that was missed.

    Please give credit for using this template.


    Last edited by a moderator: Nov 27, 2016
  2. Offline


    Thanks Tagette! :D You should post this on the github because the old example is... well old.

    Also, welcome to Bukkit! :D
    Tagette likes this.
  3. Offline


    I'll look into github

    and thank you :)

    GitHub is up!
    Also fixed some errors.

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


    New Command System and fixed a Permissions error.

    Updated downloads and GitHub.

    Updated Setup

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


    Thankyou! It's great :p
    Tagette likes this.
  6. Offline


    Well seeing as this is a template, if people want to fill it in but dont have ideas come check out my ideas that i put in plugin requests trust me there are loads of my ideas haha :p


  7. Offline


    Your welcome! :)
    Let me know if you think there should be any changes.
  8. Offline


    Alta189's sqllib has been updated and there is now a MySQL lib :D
  9. Offline


    It is? I don't see anything updated on his thread yet. He told me he would be releasing it soon though.

    Made some minor changes to code.

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


    Working on adding MySQL into database connections. Pretty sure its working although not sure about SQLite.. tests don't look promising.
  11. Offline


    Why does it not work?
  12. Offline


    Umm I use my own class that allows for simpified database setup. So I had to add it to that.

    EDIT: Turns out I had the wrong sql syntax all along anyways.. So the SQLite was fine.
  13. Offline


    Eh, I'm confused? I'm very new to this, so what Java IDE do you use? cos idk what to use, and do i open: src > me > tagette > template?
  14. Offline


    I use Netbeans.

    First Extract the somewhere.

    Then make a new java project in Netbeans by:
    1) File>New Project.
    2) Under Categories select 'Java' and under Projects select 'Java Project with Existing Source'. Click next.
    3) Set your name for the project. Click next.
    4) Click the 'Add folder...' for 'Source Package Folders'. Find the src folder that was extracted from the and add it.
    5) Click Finish.

    Then rename each package by right clicking.
    Currently the name of the package is "me.tagette.template".
    Rename this to "me.<Your Name>.<Plugin Name>".
    Do this for all 3 of the packages that start with "me.".
    Leave the packages that start with "com.". (They're not my source)

    Then rename each of the classes inside of the package "me.tagette.template" and "me.tagette.template.commands".
    Again leave the files in "me.tagette.template.extras" alone.
    For example if your plugin name was "Basic" then you would rename "" to "".
    Also rename the "" to "".

    EDIT: Forgot an important step!

    Then add the libraries to the project by:
    1) Right clicking on libraries in the left project panel and selecting "Add Jar/Folder".
    2) Go to where you extracted the template into the "libs" folder and select all the files in that folder and add them.

    I will be making a tutorial video as soon as I can.
    I am working to make this template as simple as possible for everyone.

    Another more common IDE is Eclipse. I just prefer Netbeans.

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


    Uhh i am confused on how to access the template :p I am a noob, i know.

    EDIT: Nevermind, i think i figured it out :p
  16. Offline


    Ok :)
  17. Offline


    hmm i got some errors in the

    BOSEconomy > cannot find symbol
    import cosine package does not exist
  18. Offline


    Can I see the console output?

    Or is it a IDE error?

    * June 2 - More minor code changes.
    * June 2 - Updated example commands. (1.1.1) [Added support for console commands]
    * June 2 - Removed Simplified Database (1.1.1) [Didn't actually simplify]

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


    You removed the SQL Lib?
  20. Offline


    No I removed my simplified database class. =P
    It was a class that used your lib. It basically had methods instead of sql querys.
    int amount = DBM.getIntByName("munchies", "Tagette");
    instead of:
    int munchies = 0;
    ResultSet results = DBM.query("SELECT munchies FROM players WHERE name = 'Tagette'");
        munchies = results.getInt("munchies");
    I may add it back in later when I simplify it a little more.

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


    Tagette likes this.
  22. Offline


    Tagette you bump your thread way to much... Just because you updated a link or something dont mean you have to post a second time, just add it to the thread. And im not trying to be a douscher or anything, Just stating my opinion.
  23. Offline


    If people are watching this thread will they get an alert just from me editing the original post? I do it because it lets people who are using the 'watch thread' tool get alerted.
  24. Offline


    Updated Libraries and added LowDetailMode
  25. Offline


    Deciding whether or not to add an updater to the template.
  26. well did you? :confused:
  27. Offline


    Havn't done it yet but I probably will.
  28. Offline


    Added Auto-Updater and Plugin Constants.

    Some minor bug fixes as well :p
  29. Offline


    Would it be possible to make this into a generator like this (outdated)?
  30. Offline


    Well in my original post I said I had plans for a template generator, but since no-one showed any interest until now I didn't put to much effort into completing it. I would have to look into making the actual projects for each IDE. I don't exactly know how to do that yet. I'm sure it wouldn't be too hard.

    I have worked on it a little at a time however so it is now 3/4 done.

    Tidied up code, enhanced the debug system, the command system and the help.

    I'm very new to java apps so it's taking me a while.

    I've also got life and a couple more projects on the way.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 16, 2016
Thread Status:
Not open for further replies.

Share This Page