My first plugin - fill/fillhollow - Asking for advise/suggestions/hints

Discussion in 'WIP and Development Status' started by Master-Guy, Jan 15, 2011.

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

    Master-Guy

    Hi all,

    My very first bukkit plugin, originally just to test with bukkit and Git.

    Filler - The fill/fillhollow plugin:
    Version: 0.2
    Build and tested on: CraftBukkit 211
    Author: Master-Guy

    Features:
    • Fill a cubic
    • Fill a cubic and make it hollow
    • Hot-swappable configuration file (Wildcard "*" for allowedPlayers and allowedBlocks)

    Changelog:
    Version 0.2
    • Added colors to the plugin
    Version 0.1
    • First release, was just for testing purposes

    ToDo:
    Suggestions accepted:
    • Allow use of "/fill wood" instead of "/fill 5"

    Usage:
    Right-click two blocks with a stick (item 280) to set a cube. Then type "/fill <block ID>" or "/fillhollow <block ID>" (both without quotes) to fill the cube. "/fillhollow" fills the inner part of the cube with air, where there only is a one block thick wall. Can also be used on flat surfaces to create walls, floors or roofs.



    What I'm looking for is advise on how to improve my coding, and how to increase performance. If you got any, please let me know so I can test with it.

    Please note: I'm kinda new with Java, using Eclipse and trying out a lot of random stuff, so please don't start yelling "noob", but instead tell me how to improve, so I can become one of you better developers :D

    Wkr,

    "Master-Guy" Marcel
     
  2. Offline

    JaredKey

    I really enjoy the plugin! However, sometimes, it says to "set two positions first" after I already selected two positions. It seems pretty inconsistent. I'll select a block and it says Position 1 is selected, then I select another block 50 blocks away and it says Position 2 is selected. But, it will instruct me to "set two positions first". Again, sometimes it works, sometimes it doesn't.

    Again, I REALLY appreciate the plugin!

    EDIT: I figured it out! Occasionally I was setting position 2 first and position 1 next. This can be a bit confusing unless you're paying attention. You might want to mention it in the plugin notes.
     
  3. Offline

    Master-Guy

    Tnx for the feedback, I'll see what I can do with colors to make it more clear ;)

    Edit:
    BUILD AGAINST:
    Bukkit snapshot 0.0.1 Bamboo build 42
    CraftBukkit snapshot 0.0.1 Bamboo build 50
     
  4. Offline

    JaredKey

    I was thinking about it last night how to improve it and I think colors is the way to go! Maybe Position 1 could be green and Position 2 could be red. Or, you could make use of left click-right click. Good luck!
     
  5. Offline

    Archelaus

    I like this plugin. Perhaps a chat based way to make things too?

    E.g.
    Code:
    /fill X Y false //For hollow fill
    /fill X Y true //For filled in
     
  6. Offline

    Fifteen

    Add a way to change which item selects the blocks and I'll download :)
     
  7. Offline

    Master-Guy

    Turned the two colors around, but that is what I had ;)



    What direction will X Y and Z be in then? :p


    As soon as I know how to properly use the properties files
     
  8. Offline

    Archelaus


    Sorry got confused. But you know what I mean :p
     
  9. Offline

    Master-Guy

    Not really ^^
     
  10. Offline

    Archelaus

    As in, instead of marking co-ords via stick. You say them. Like so (my last example was wrong and wasn't really thought through)

    Code:
    /chatfill X1 X2 Z1 Z2 Y1 Y2 true
    //xcoords, zcoords, ycoords, hollow(boolean)
     
  11. Offline

    JaredKey

    It may work better the other way around (the way you had it originally)? Idk...what do I know? lol Either way works.
     
  12. Offline

    blazinbai

    this is not working help
     
  13. Offline

    Master-Guy

    I'll take a look at it, hold on..

    Edit: Solved the issue, was because of another build update.. Thanks Grum! ;-)

    PS: Now also know how I can work with properties files, so will update the plugin as soon as I got some time to do it.. Very busy day today for me!
     
  14. Offline

    Master-Guy

    Re-build with bukkit builds 57/87/31

    Now only allows specified players to use the tool and only allows the specified block types to be used.
    The tool ID can now also be specified.
    Finally: The commands can also be defined inside the configuration file. This means it does not need to be /fill, but it will be by default.

    Configuration file will be generated or updated on first run and can be changed run-time (without server restart!!)
    It's location, like it will be for all my plugins, is the "settings" directory, which it will create if it does not yet exist.

    With kind regards,
    MG


    Edit:
    Re-build for:
    Bukkit builds 47 through 63
    Craftbukkit build 61 through 102
    Scrapbukkit build 16 through 37
     
  15. Offline

    Seth.D

    Code:
    SEVERE: Could not pass event PLAYER_COMMAND to MG
    java.lang.ArrayIndexOutOfBoundsException: 1
            at com.bukkit.mg.mg.MGPlayerListener.onPlayerCommand(MGPlayerListener.ja
    va:47)
            at org.bukkit.plugin.java.JavaPluginLoader.callEvent(JavaPluginLoader.ja
    va:135)
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:201)
            at net.minecraft.server.NetServerHandler.c(NetServerHandler.java:547)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:523)
            at net.minecraft.server.Packet3Chat.a(SourceFile:24)
            at net.minecraft.server.NetworkManager.a(SourceFile:232)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:65)
            at net.minecraft.server.NetworkListenThread.a(SourceFile:104)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:261)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:197)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:512)
    That always happens whenever I use a command.
     
  16. Offline

    Master-Guy

    Sorry Seth that I didn't reply, I'll take a look at it this evening for you. Can you tell me what bukkit builds you are running? (downloaded form where) and when you downloaded the plugin.
     
  17. Offline

    Seth.D

    Sorry if this is a noob question, but how do I find out what Bukkit build I have?

    And the first time I downloaded the plugin was probably about 2 weeks ago. I just re-downloaded it a few days ago in hopes that the error was fixed but apparently not.
     
  18. Offline

    Master-Guy

  19. Offline

    Seth.D

    I downloaded it probably about a week ago.
     
  20. Offline

    Master-Guy

    That might be part of the problem. They advanced about 80 builds in the last week.
    But I'll take a look at the code when I get home after work. Can you tell me what steps you take to reproduce the error?

    The way it should be: First right-click two blocks, then use /fill or /fillhollow followed by a block ID
     
  21. Offline

    Seth.D

    The error just happens whenever I use a command. Simple as that. Even when the command has nothing to do with the plugin such as /home, and /me. It gives me an error even when I use a non-existant command such as /lol or /asdf.

    EDIT: It's probably not Bukkit's fault this is happening. I just updated Bukkit right now and the error's still happening.

    EDIT 2: Did some more testing. Ran this plugin on an empty Bukkit server with no plugins and I still got the error after using commands.
     
  22. Offline

    Master-Guy

    Checking it out and will work on it as soon as I got access to my computer
     
  23. Offline

    Master-Guy

    Fixed that issue Seth.D, sorry for the problems.
     
  24. Offline

    Seth.D

    Well, it appears as though the error doesn't occur anymore when I use /fill or /fillhollow, but I still get the error when I use any other command.

    Code:
    Feb 3, 2011 12:12:14 PM org.bukkit.plugin.SimplePluginManager callEvent
    SEVERE: Could not pass event PLAYER_COMMAND to Filler
    java.lang.ArrayIndexOutOfBoundsException: 1
            at com.bukkit.MasterGuy.FillerPlayerListener.onPlayerCommand(FillerPlaye
    rListener.java:49)
            at org.bukkit.plugin.java.JavaPluginLoader.callEvent(JavaPluginLoader.ja
    va:135)
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:201)
            at net.minecraft.server.NetServerHandler.c(NetServerHandler.java:554)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:528)
            at net.minecraft.server.Packet3Chat.a(SourceFile:24)
            at net.minecraft.server.NetworkManager.a(SourceFile:232)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:65)
            at net.minecraft.server.NetworkListenThread.a(SourceFile:104)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:261)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:197)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:512)
     
  25. Offline

    Master-Guy

    What the H is going on.. It seems as if Github had a rollback or something like that.. my updates from this morning and yesterday are gone..

    Will re-upload it again tomorrow morning.. sorry for the problems, it's a check that needs to be done the other way around, I know the problem.
    --- merged: Feb 5, 2011 8:07 AM ---
    I've patched the plugin, now it does create the directory if it does not exist, and it is located in the /plugins/<pluginname>/ directory now.
     
Thread Status:
Not open for further replies.

Share This Page