[INACTIVE][MECH] KitPlugin v1.2 - Dispense kits to your players (now w/ iConomy5 support) [600-818]

Discussion in 'Inactive/Unsupported Plugins' started by FloydATC, Jan 19, 2011.

  1. Offline


    This simple plugin does only one thing: It dispenses kits to players upon request, like in hMod.
    Source is included in the .jar, feel free to do whatever you want with it.

    v1.00 - Initial release
    v1.01 - Rebuild (fixed onPlayerCommand issue)
    v1.02 - Implemented Permissions
    v1.03 - Rebuild, implemented cooldown timers
    v1.04 - Rebuild
    v1.06 - Changed cooldown code to use SECONDS, please update kits.txt!
    v1.07 - Time until cooldown is shown in a friendly (but inaccurate) way
    v1.08 - Improved error-checking, simplified install, use onCommand, switched namespace.
    v1.09 - Added "/kit reload" to reload the config without a server restart
    v1.10 - Removed the "stupidly long constructor" as per Bukkit team recommendation
    v1.11 - Added support for item data (yes, wool colors!) and durability. Read the thread.
    v1.12 - Added support for giving kits to other players
    v1.13 - Added an informational log message when a player with 'kit.proxy' permission bypasses a cooldown
    v1.14 - Minor changes to the permission checking and logging
    v1.15 - Added optional iConomy support and price tags
    v1.2 - Updated to support iConomy 5.0 (overhaul by Xemnas33)

    • Requires the Permission plugin (2.6 or equivalent)
    How to use:

    Show a list of available kits:
    Get a named kit (example):
    /kit starterkit
    How to install:

    1. Download http://minecraft.atc.no/plugins/KitPlugin.jar
    2. Copy it to your "plugins" directory
    3. Create a file calles plugins/KitPlugin/kits.txt
    4. Describe the kits you want to dispense. For example:
    # Name;ID Amount;ID Amount;ID amount (etc)[;-cooldown][;$price]
    Starterkit;268 1;269 1;-300
    Rock;1 256
    Wool;35:0 64;35:1 64;35:2 64;35:3 64;35:4 64;35:5 64;35:6 64;35:7 64;35:8 64;35:9 64;35:10 64;35:11 64;35:12 64;35:13 64;35:14 64;35:15 64;-3600
    Note that the cooldown is an optional negative integer. -300 means 300 SECONDS (5 minutes)
    ID can be just a numerical id, id:data, id::durability or id:data:durability

    • 'kit' (or 'kit.kit') required to access the command itself
    • 'kit.reload' required to reload the configuration
    • 'kit.proxy' required to give kits to other players and bypasses any cooldown checks.
    • 'kit.<name of kit>' required to get a specific kit (use lowercase!)
            - 'kit.kit'
            - 'kit.reload'
            - 'kit.proxy'
            - 'kit.starterkit'
            - 'kit.tools'
            - 'kit.*'
    I'm a Java newbie, please be gentle.
    Thank you :)
  2. Offline


    Must be a bug, I've seen it myself and I have a really hard time tracking it down. The time unit is minecraft "ticks", there are about 6000 ticks in 5 minutes. I suspect that the damned thing resets every time you restart the server so I think I'll have to find some other time reference.

    @zoah1984: Let me see if I can add some debug code to find out if this is related to permissions or something else. Expect a new version soon [tm]

    Update: I need some more time for this, it seems getTime() has changed completely so I'll have to fix that before I can compile a new version. Remove the cooldowns until further notice.
  3. Offline


    Ah, yes recently in Bukkit they changed it. I just did what you ended up suggesting, removing the cooldown timer.

    Might I suggest some enhancements? I am quite unfamiliar with Java's precision time measurement but I know that 1 ticket in c# is 10 nanoseconds (1 billion nanoseconds is 1 second) so that would not make sense for what you're dealing with. Nonetheless, should it not be quite simple to convert it to seconds, as well as accept a positive integer and then convert it yourself behind the scenes? That's just a usability thing there, but I'm sure it would help some of these people.
  4. Offline


    Thanks Floyd, I'll wait for your update and we'll see how that goes.
  5. Offline


    v1.06: Rewrote the cooldown code to use java.util.Date, the cooldown is now in seconds and uses wallclock time instead of the funny internal timer. Remember: 5 minutes = 300 seconds, 1 hour is 3600, 1 day = 86400.

    Version 1.06 also adds a bit of proper logging instead of just printing to the console.

    @zoah1984: If you still don't get any response, check the logs carefully and report your findings please.

    @GEN3RIC: The cooldown feature was not there from the beginning and is negative in the config so it can be easily distinguished from item IDs.
  6. Offline


    I'm getting an unknown console command when I try /kit or /kit Range.. etc. Could you help me out please?

    Edit: I've figured it out

    Thanks for the time on the plugin bro.
  7. Offline


    # Name;ID Amount;ID Amount;ID amount (etc)[;-cooldown]
    Starterkit;268 1;269 1;-300
    Rock;1 256

    What does the "Rock;1 256" section of this actually do?
  8. Offline


    "Rock" - Name of the Kit.
    "1" = Stone
    "256" amount which is given.

    So, It gives you 256 Stones.
  9. Offline


    Ah, thanks. I'm not sure why that confused me.
  10. Offline


    Is it possible to have the kit dispense in a certain order?
  11. Offline


    Not sure what you mean, the kits will always appear in the order in which they are listed in kits.txt, and the material components are dispensed in the order in which they appear for each kit.

    That said, I don't think there is a practical way to control exactly where in the inventory those materials end up. I just call inventory.add() on each material stack and then it's up to the game what slots they appear in. The logic to merge existing stacks, split new ones, locate available slots etc. is way beyond the scope of this plugin.

    If your inventory is empty when you request a kit, the materials should therefore appear in the expected order. If it's not, then the game itself decides where to put stuff.
  12. Offline


    Is cooldown based on server time?

    With kits in hmod if you restarted your server the timer for kits would reset so if you had a 4 hour kit and restarted after 3 hours of uptime that 4 hour kit cool down would be reset and the kit would not be obtainable for another 4 hours even though it had 1 hour left before the restart.

    Kits would also take longer to receive to due server time lag from to much stress on the processor. But there has since been a plugin to correct the server time lag issue.
  13. Offline


    The plugin uses system time (wallclock) so it should be unaffected by lag or restarts since I made the switch from game time
  14. Offline


    Got this working a treat, thanks alot it's awesome.

    One thing I would like to suggest is possibly a visible cooldown counter as I have some kits on very long cooldowns and when you request it again, you have no idea how long you have to wait, so maybe "You have already received this kit, please wait <time left> and try again"
  15. Offline


    This would be amazing. My cool downs are set to 12 hours for a majority of the kits my server uses. Letting users no the time they have left before they can use a kit again would be great!
  16. Offline


    Something similar to a /cooldown command :D
  17. Offline


    Version 1.07 posted. The generic "already received" message has been replaced with a human-readable time left. This is a quick hack so it's not very precise. For example, because numbers are rounded down, 179 minutes becomes "about 2 hours" which at best is a very broad definition of the word "about". I hope this is good enough for now.
    th3sarg and NEO like this.
  18. Offline


    You Sir, are a Legend, everyone is already loving this implementation, lots of swearing going on with "OMFG 7 hours left you have to be kidding me!"

    I have a gladiator set with diamond armor and sword that is on a week cooldown and I love that it now displays days as well, that's soo good!

    Thanks alot!
  19. Offline


    And they say guys can't express their feelings? :)
  20. Offline


    I love this plugin! Using it on my own server.

    Would love to see iConomy supported
  21. Offline


    I know it's a minor thing, but could you have the plugin automatically create the required directory and kits.txt on first run? or include it in a zip file along with the jar. (see the post below me for an example of why)

    Other than that, I love it. I'm trying to get away from the mess that is General Essentials and use independent plugins instead.

    Thanks for the great work.
  22. Offline


    java.io.FileNotFoundException: plugins\KitPlugin\kits.txt (Das System kann die
    ngegebene Datei nicht finden)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(Unknown Source)
    at java.io.FileInputStream.<init>(Unknown Source)
    at java.io.FileReader.<init>(Unknown Source)
    at com.bukkit.floyd.kit.KitPlugin.onEnable(KitPlugin.java:58)
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:135)
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoad
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginMana
    at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:74)
    at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:55)
    at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:171)
    at net.minecraft.server.MinecraftServer.c(MinecraftServer.java:158)
    at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:110)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:209)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:512)

    hi i always get this message,, what am i diong wrong ??? pls hrelp
  23. Offline



    Seems your missing the "kits.txt" from the plugins\KitPlugin folder.
    Simply create a text file in the "KitPlugin" folder.
  24. Offline


    /\:|?*(ect.) can not be used in a file, WTF?
  25. Offline


    hy guys, i really dont see any problem in this code, because i get this massage
    Kit does not exist or is temp defined ..

    Can somebody please help?

    # Name;ID Amount;ID Amount;ID amount (etc)[;-cooldown]
    adminkit;276 1;277 1;278 1;279 1;310 1;311 1;312 1;313 1;261 1;262 64;50 64;322 64;345 1;58 1;325 1;-1
    beginner;272 1
  26. Offline


    I would love to be able to give kits to my users, the thing is that I don't want them to be able to get 'em for free.

    Please make this work with iConomy!

    Make the cooldown optional, and the iconomy price optional, so admins can set it up the way they want.

  27. Offline


    That doesn't look like an error message from KitPlugin; are you using Essentials or some other plugin that also uses the /kit command?
    --- merged: Feb 18, 2011 2:31 PM ---
    The cooldown is already optional. For iConomy support I would need some input on how to do it.
  28. Offline


    plugins/kitplugin/kits.txt <the system can not find the file specified>
    --- merged: Feb 19, 2011 12:51 AM ---
    now it says access is denied!
    can anyone fukin help me?
  29. Offline



    The "plugins/kitplugin/kits.txt <the system can not find the file specified>" error means you do not have the config file, simply create a text file in the KitPlugin folder.
    add the following to that file:

    # Name;ID Amount;ID Amount;ID amount (etc)[;-cooldown]
    Starterkit;268 1;269 1;-300
    Rock;1 256
  30. Offline


    thanks for the elp mate![/CODE]
    --- merged: Feb 19, 2011 5:57 AM ---
    it wont let me connect to MY server now! it says timeout! im sorry to say that i will NOT be using your plugin.[/CODE][/FONT][/FONT][/COLOR][/FONT][/quote]
  31. Offline


    [kit] you do not have any kits
    you do not have access to this command

    any idea what to fix?

    added kit.kit, kit.kit.tools
    to permissions

    2011-02-19 01:10:54 [INFO] [Kit] Imamoose requested kit tools
    Feb 19, 2011 1:10:54 AM org.bukkit.plugin.SimplePluginManager callEvent
    SEVERE: Could not pass event PLAYER_COMMAND to KitPlugin
    java.lang.NumberFormatException: For input string: ""
            at java.lang.NumberFormatException.forInputString(Unknown Source)
            at java.lang.Integer.parseInt(Unknown Source)
            at java.lang.Integer.parseInt(Unknown Source)
            at com.bukkit.floyd.kit.KitObject.<init>(KitObject.java:17)
            at com.bukkit.floyd.kit.KitPlayerListener.onPlayerCommand(KitPlayerListe
            at org.bukkit.plugin.java.JavaPluginLoader$5.execute(JavaPluginLoader.ja
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
            at net.minecraft.server.NetServerHandler.c(NetServerHandler.java:601)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:574)
            at net.minecraft.server.Packet3Chat.a(SourceFile:24)
            at net.minecraft.server.NetworkManager.a(SourceFile:232)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:71)
            at net.minecraft.server.NetworkListenThread.a(SourceFile:104)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:283)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:209)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:512)
    2011-02-19 01:10:54 [INFO] [PLAYER_COMMAND] Imamoose: /kit tools
    2011-02-19 01:10:54 [WARNING] Imamoose was denied access to command.

Share This Page