Plugin Development - A HUGE tutorial!

Discussion in 'Plugin Development' started by Adamki11s, Apr 29, 2011.


Was this helpful to you?

  1. Yes!

  2. No, but it was a good tutorial :)

  3. No.

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


    in.close(); is underlined red for me, help plox lol
  2. Either your file input stream variable is not 'in' or hasn't been set or maybe your not using a try catch. Post your code and exactly where your getting errors and what your IDE says.
  3. Offline


    package com.servegame.n1p.Drawbridge;
    import java.util.Properties;
    import java.util.logging.Logger;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.event.Event;
    import org.bukkit.plugin.PluginManager;
    public class Drawbridge extends JavaPlugin {
        Logger log = Logger.getLogger("Minecraft");
        static String mainDirectory = "plugins/Drawbridge";
        static File DrawbridgeFile = new File(mainDirectory + File.separator + "Drawbridge.dat");
        static Properties prop = new Properties();
        boolean drawbCreation;
        private final DrawbridgePlayerListener playerListener = new DrawbridgePlayerListener(this);
        private final DrawbridgeBlockListener blockListener = new DrawbridgeBlockListener(this);
        public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
            if(commandLabel.equalsIgnoreCase("drawbrige create")){
                drawbCreation = true;
                return true;
        return false;
        public void onEnable(){
            new File(mainDirectory).mkdir();
                try {
                    FileOutputStream out = new FileOutputStream(DrawbridgeFile);
                    prop.put("Version", "1");
          , "Do NOT edit this config!");
                } catch (IOException ex) {
            } else {
            PluginManager pm = this.getServer().getPluginManager();
            pm.registerEvent(Event.Type.PLAYER_MOVE, playerListener, Event.Priority.Normal, this);
            pm.registerEvent(Event.Type.BLOCK_PLACE, blockListener, Event.Priority.Normal, this);
   + " Version " + this.getDescription().getVersion() + "has been enabled.");
        public void loadProcedure(){
            FileInputStream in = new FileInputStream(DrawbridgeFile);
     in.close(); //im getting the error here, its just one
        public void onDisable(){
   + " Version " + this.getDescription().getVersion() + "has been disabled.");
    thanks for the fast reply ;)

    Im getting the error at only the line that says, in.close();

    This is the error the ide says: Syntax error on token "close", VariableDeclarator expected after this token

    p.s: im using eclipse :)

    (the only commented line)

  4. Offline


    Thanks, I've spent the whole evening trying to get started and it's amazing how hard it was to find any up to date information on a starting template. There are so many threads with out of date information and plugin generator tools that are deprecated. This really should go toward replacing this wiki page: (probably would make more sense under a different URL though).

    One note, the line:
    should read:
  5. Offline


    You forgot to move the "}"

    You have
    public void loadProcedure(){
            FileInputStream in = new FileInputStream(DrawbridgeFile);
     in.close(); //im getting the error here, its just one
    when it should be
    public void loadProcedure(){
            FileInputStream in = new FileInputStream(DrawbridgeFile);
  6. Offline


    Oh you missunderstood me :p
    I wanted to sort them, because i want to have an easy way to modify the variables by hand in the file.
    And for that it would be nice to have them sorted ;)
  7. Offline


    THANKYOU :) I also needed the try/catch thing to :3 lol
  8. Offline


    Can you make a tutorial on how to place blocks or interact with them?
  9. Maybe consider creating a yml config file instead.

    I'm working on lots of thing at the moment, I'll add that to the list :p

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


    If i knew how i would try it.
    I have to find a tutorial for that first.
  11. I'll try to make one soon, in between everything else :p
  12. Offline


    Plague, the Bukkit wiki is completely outdated and this is perfect material for it.
    Could you add this to the Bukkit wiki with Adamki11s permission?
  13. Offline


    Bukkit wiki is independent from this forum in terms of users, I don't have an account there.
  14. Offline


    Pff I tought I was alone. :3
    Okay, but the wiki is really, really, really outdated and I can't even look at it.
    Sorry :p
  15. Offline


    What's stopping you from registering and making contribution?
  16. I've registered an account on the wiki and am moving the tutorial over there but the formatting takes a while :p

    Anyway, I finished my plugin :D

    Plugin is now COMPLETE
    Get Regions!
  17. Offline


    Congrats :)
  18. Offline


  19. Offline


    Awesome tutorial. Helped alot :D could you maybe add a section on reading/writing to excel files and searching certain columns then returning what the row says? or something like that. thanks :)
    edit: oops just realized i was meant to say this as a pm
  20. :p I also tried to find out how to work with excel but the API's I found didn't look very friendly :(
  21. Offline


    I'll definitely be showing this to people I know interested in learning to program for bukkit
  22. Offline


    My only suggestion so far would be to add IntelliJ IDEA Community Edition to the list of main Java IDEs; it's widely used commercially.

    You can find it here:

    Also, where is this on the wiki? Once it gets added there, I would possibly be able to do a quick set-up tutorial on how to get your project going with IntelliJ.
  23. I've never used IntelliJ but if you could provide some pictures and a brief guide that would be great :D. As for the wiki I am migrating the rest of it over today, I just need to format everything.
  24. Offline


    Shouldn't in.close(); be within the block? If not, why not?
  25. Yes it should, thank you for pointing that out.
  26. Offline


  27. It's really hard to read all that unformatted code. I am working on writing a bunch of simple plugins and releasing the source for free so when I get that done you'll be able to learn from that also :D
  28. Offline


    i put the new paste bin files on a post
  29. Sorry, I really don't have the time to trawl through all the code.
Thread Status:
Not open for further replies.

Share This Page