AutoRepair
version 2.16 (For 1.9.4)
Overview
Allows a player to repair their tools, either manually, or automatically just before they break. Automatic repairing will trigger on hitting a block with a tool when the tool is about to break. This repairing can be done at the cost of a given amount of one or more materials, a set amount of money if an economy system is in use, a set amount of experience points deducted from the player's total, or for free. There is a variety of configurability included within this feature set.
Features
- Repairs your tools, weapons and armour
- Repairs can either be free, cost items, cost via economy, cost xp, or any combination thereof; these can vary on a per-item basis, depending on configuration settings.
- Repairs can be triggered manually or automatically
- Automatic repairs are triggered just before an item breaks
- Works on enchanted items too, this can be disabled via config options; has ability to have different prices for enchanted and non-enchanted items!
- Permissions support through PermissionsBukkit (may work, but not tested with, other Permissions systems)
- Economy support through Vault
- Repairs can be set to have varying cost depending on how damaged the item is
- Repair anvils can be constructed to force repairs to occur at a certain location.
- Added configurable sets of items that are attached to specific permission nodes, allowing admins to select which groups of users should be able to repair specific items or sets of items.
- [NEW] Per-player disabling via command is now supported.
New
Version 2.16
- Removing items from the recipes list is now officially supported. The config.yml will automatically generate the first time the plugin is started, and contain all supported items. If an item is removed, repair of that item is effectively disabled.
- Added 'enable' and 'disable' commands that allow players to disable autorepair on themselves, if they like (and if they're given permissions to do so).
- Hoes now properly autorepair.
Version 2.12
- Fishing poles actually autorepair now.
Version 2.10
- Added new command alias: '/ar'
- Added ability for items to be repaired in the recipe section to be specified as their item id, i.e. DIAMOND_SWORD could also be '276'. This should allow compatibility with weapon mods (however, this is untested! Looking for testing volunteers).
Version 2.00
- Most of the new information about version 2.00 can be found under the "setup" section; that section has been completely rewritten for this new version.
- Added new cost type: XP
- Added ability to differentiate prices between enchanted and non-enchanted items
- New, more user-friendly config format; if old config files are present, it will convert their contents to the new format
- Config will now install itself when the plugin is run, instead of requiring manual installation
Version 1.84
- Added ability to construct and repair at Anvils (1 iron block next to a sign that says "anvil")
- Added ability in configuration to have enchanted items lose their enchantment upon being repaired
- Added in ''repcommands'' permission node to restrict access only to the manual repair commands
Setup
As of version 2.00, there is only one config file for AutoRepair: it's the config.yml in your plugins/AutoRepair folder. This file has two sections, one dedicated to the repair "recipes", and the other dedicated to the configuration.
If you have the old 1.84 or before config files, then v2.00 will take those settings, and construct a new config.yml from them, and then begin using that file. Settings should not be lost in the transition from 1.84 to 2.00.
For an example config.yml file, go here.
'recipes' section
The recipe section enumerates the specific cost for each item that it is possible to repair. Each of the fields under each item is optional; if no fields are present, it is assumed that there is no repair cost for the item and that repairs are free. The following is the largest possible format for one specific item:
LEATHER_HELMET: permission-group: 1 normal: LEATHER: 5 item-cost-min: 1 econ-cost: 5.5 econ-cost-min: 1.0 xp-cost: 6 xp-cost-min: 1 enchanted: LEATHER: 5 GOLD_INGOT: 1 item-cost-min: 1 econ-cost: 7.5 econ-cost-min: 2.0 xp-cost: 20 xp-cost-min: 5 '276': normal: DIAMOND: 2 STICK: 1
- ITEM_NAME (upper): Describes what this particular recipe is for. List of valid item names here. Alternatively, this can be specified as '<item-data-id>'; this should allow for compatibility with weapon mods (untested!!).
- permission-group: Range is 1-9. Allows a specific item to be sorted into one of 9 groups that then require a specific permission to be set in order to allow repair on that group of items. Permission is 'autorepair.itemgroup#', where # is replaced by the desired group number. If not specified, items default to 0, which is the same as "no group".
- normal vs enchanted: it is possible to specify seperate costs for normal and enchanted items.
- ITEM_NAME (lower): the item cost of repairing this specific item. List of valid item names here. There can be multiple item costs for each item, as seen in the example under 'enchanted'.
- XXX-cost: the specific cost of repairing the item. If the corresponding config option is turned off, this will be ignored. If this cost is missing, it is assumed that the cost is 0.
- XXX-cost-min: if the specific cost is set to be "adjusted" in the config, then this is the minimum cost possible when conducting a repair. This prevents users from repairing after 3 uses of an item, causing the item cost to be 0 every time and thus getting away with free repairs.
'config' section
The config section now has a layout more consistant with other Bukkit plugins; a series of true/false variables that allow customization of the plugin. Please note, that nothing here is new to version 2.00, it's just presented in a slightly different format. All fields are true/false, except for anvilUse.anvilBlockType.
- repairOfEnchantedItems.allow: allow repair of enchanted items.
- repairOfEnchantedItems.lose-enchantment: if repairs of enchanted items are allowed, they will lose their enchantment upon being repaired
- usePermissions: if a permissions system is installed, this will force permission checks on all operations. '''ONLY USE IF''' a permissions system is installed.
- automaticRepair.allow: allow repairs to be done automatically before tools break, if cost requirements are met.
- automaticRepair.no-warnings: This turns off warnings that would otherwise occur when tools are near breaking points; this is true whether automatic repairs are on or off.
- automaticRepair.no-notifications: Disables repair notifications that occur when tools are repaired automatically.
- anvilUse.allow: allow construction and use of anvils
- anvilUse.anvilBlockType: specifies the specific block type that is required to make an anvil. Same format as items in the recipe section. Default is IRON_BLOCK.
- econCost.use: use economy cost for an item, if economy linked, and econ cost specified for specific item in recipe section
- econCost.adjust-for-damage: if econCost is enabled, this will adjust the economy cost of repairing based on the % of damage to the item.
- xpCost.use: use experience point cost for an item, if xp cost specified for specific item in recipe section
- xpCost.adjust-for-damage: if xpCost is enabled, this will adjust the xp cost of repairing based on the % of damage to the item.
- itemCost.use: use item cost for an item, if item cost specified for specific item in recipe section
- itemCost.adjust-for-damage: if itemCost is enabled, this will adjust the item cost of repairing based on the % of damage to the item.
Economy
Usage of an economy plugin via Vault is optional. You can configure this plugin to use an economy plugin's cash to charge for a repair. However, if you wish to use an economy plugin you MUST also run Vault.
If an economy plugin and/or Vault is not detected, and you have econCosts enabled in your configuration, these will be disabled until a valid economy is installed.
Anvils
Anvils can now be constructed to force players to conduct their repair operation in one specific location.
An anvil is construct by placing an iron block, and then placing a sign that says "anvil" in any neighboring space. Right-clicking the iron block will then initiate the repair, given that the proper configuration and permission options have been set.
Permission and configuration setup for a situation where an admin wishes to limit repairs to only at anvils are as follows: (unmentioned fields are assumed to be non-relevant or up to the admin)
- anvilUse.allow: true
- automaticRepair.allow: false
- automaticRepair.no-warnings: true
- usePermissions: true ''(you need to have a permissions plugin)''
- permission nodes AutoRepair.access, AutoRepair.repair, and AutoRepair.warn are enabled
- permission node AutoRepair.repcommand is explicitly disabled
Permissions
The only new permissions in version 2.00 are the "itemgroup" permissions. It is necessary to specify each one of these that a user should belong to; if they should belong to all 9 possible itemgroups, then you will have to specify out each of those 9 permissions.
Bukkit permissions is optional and if permissions is either not installed or is disabled for this plugin, all features will be available for all users. Will be turned on if the line permissions=false in the default config.properties file is changed to true.
Available permission nodes are (case sensitive):
- AutoRepair.access - allows the use of this plugin, without this a user cannot do anything
- AutoRepair.info - allows the use of the ? and dmg commands
- AutoRepair.warn - allows warning when a tool is about to break
- AutoRepair.repair - allows items in a user's inventory to be repaired, whether automatic or manually
- AutoRepair.repcommands - allows manual commands to be used to repair items
- AutoRepair.repair.enchanted - allows enchanted items to be repaired, if autorepair config is set accordingly
- AutoRepair.auto - enables AutoRepair of tools in a user's inventory
- AutoRepair.auto.disable
allows a player to disable autorepair via the '/rep disable' command. - AutoRepair.reload - allows a user to reload the plugin
- AutoRepair.itemgroup1 - allows a user to repair items that have been set into item group 1 by the configuration
- AutoRepair.itemgroup2 - allows a user to repair items that have been set into item group 2 by the configuration
- AutoRepair.itemgroup[3-9] - follows the same format as itemgroup1 and 2, but for groups 3 through 9.
Commands Usage
There are three command aliases: '/repair', '/rep', and '/ar'. For convenience, we will use /rep to describe the commands.
- '/rep [quickbar slot 1-9]' repairs the tool/armour in this slot and deducts cost from inventory
- '/rep [quickbar slot 1-9] ?' tells you what item and how much of it is needed to repair this item
- '/rep [quickbar slot 1-9] dmg' tells you how many uses are left before this tool breaks
- '/rep', '/rep ?', '/rep dmg' for the item in your hand
- '/rep all' to repair ALL repairable items in your inventory including worn armor
- '/rep arm' repairs all of your currently equipped armor
- '/rep arm ?' tells you what you need to repair your equipped armor
- '/rep reload' reloads the config files
- '/rep disable' Disable autorepair for yourself
- '/rep enable' Re-enable autorepair for yourself (after disabling)
Bugs - Create a ticket if you find one, please
- None known
Pull Requests
I'm open to pull requests for this project at my github repo.
Version 1.82 is now released.
I've closed out most of the issues that have been reported so far, including all the crashes. There are 1 or 2 enhancement requests that i haven't tackled yet, but if you've reported a crash or a bug, it should be fixed now. Please let me know if it's not, and if you could file a ticket and attach an updated crash report and, if possible, a log of what happens when your server starts, that should be enough for me to fix it.
Thanks for all your help getting me off the ground on this one, guys. If you have any enhancement requests, let me know.
@Sepulzera
Ticket for your issue here.
Do you by chance either:
Either one should normally be fine, but I just found a bug relating to this, so if it the answer is yes, I think I'll have it fixed in 1.82.
@brisny
Filed a ticket on this issue for your tracking convenience here.
This looks like a great mod and I can't wait to get it up and running on my server. I am having an issue when I try to use any of the /rep commands I get an error saying "An internal error occurred while attempting to perform this command". Here is the error off the server including the info about what I have loading. Any help will be appreciated.
00:55:15 [INFO] Starting minecraft server version 1.2.4 00:55:15 [INFO] Loading properties 00:55:16 [INFO] This server is running CraftBukkit version git-Bukkit-1.2.4-R1.0 -b2126jnks (MC: 1.2.4) (Implementing API version 1.2.4-R1.0) 00:55:16 [INFO] [jCommands] Loading jCommands v1.0.4 00:55:16 [INFO] [LWC] Loading LWC v4.1.1 (b645-git-b24cc99e) 00:55:16 [INFO] [DeathTpPlus] Loading DeathTpPlus v3.9.2.1986 00:55:16 [INFO] [AutoRepair] Loading AutoRepair v1.81.1 00:55:16 [INFO] [ExpMiner] Loading ExpMiner v1.7 beta 00:55:16 [INFO] [LWC] Enabling LWC v4.1.1 (b645-git-b24cc99e)
00:55:51 [INFO] [PLAYER_COMMAND] brisny /rep 6
00:55:51 [SEVERE] null org.bukkit.command.CommandException: Unhandled exception executing command 'rep' in plugin AutoRepair v1.81.1 at org.bukkit.command.PluginCommand.execute(PluginCommand.java:42) at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:16 6) at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:4 73) at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler. java:821) at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:781)
at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:764) at net.minecraft.server.Packet3Chat.handle(Packet3Chat.java:33) at net.minecraft.server.NetworkManager.b(NetworkManager.java:229) at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:113) at net.minecraft.server.NetworkListenThread.a(NetworkListenThread.java:7 8) at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:554) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:452) at net.minecraft.server.ThreadServerApplication.run(SourceFile:490) Caused by: java.lang.NoClassDefFoundError: net/milkbowl/vault/economy/Economy at com.mrockey28.bukkit.ItemRepair.AutoRepairSupport.doRepairOperation(A utoRepairSupport.java:79) at com.mrockey28.bukkit.ItemRepair.Repair.manualRepair(Repair.java:25) at com.mrockey28.bukkit.ItemRepair.AutoRepairPlugin.onCommand(AutoRepair Plugin.java:164) at org.bukkit.command.PluginCommand.execute(PluginCommand.java:40) ... 12 more Caused by: java.lang.ClassNotFoundException: net.milkbowl.vault.economy.Economy at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader. java:41) at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader. java:29) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 16 more
I started using this plugin with the version 1.81 on my server with friends.
The plugin seems to work, but I can't reproduce any thing that will create this error (and it seems I'm not the one causing this)
My error continues. Did get it to work once, I commented the ticket further.
@Sepulzera
You can't reproduce it on 1.81? So the spam all occurred when you had the first version installed?
My log is spammed with this error message:
Can't reproduce it...just to let you know
@sibilla6
Yeah, I've grouped your problem under "plugin incompatibilities" in the buglist, I think that's what's causing it. I'll try and determine what exactly is the problem this evening.
I had already updated to v1.81, tested after updating RepairCosts.properties and the errors still persists. See my post bellow for the log, it was the same.
I've posted version 1.81. If you don't want to read the changelog yourself, here's the short and sweet:
I've fixed most of the bugs reported on my original version yesterday. If I didn't fix it, I put it in the Buglist or TODO in the plugin description.
If you reported an outright bug yesterday and it isn't listed in the buglist, please test again and make sure that bug is gone.
FYI - This is important if you installed the plugin yesterday: you have an outdated version of the AutoRepair.properties file in your plugin/AutoRepair directory. This needs to be fixed. I had the wrong durability for all wood items (should be 60), and I mixed up the durability for wood swords and gold swords. If you want, you can fix this yourself by just correcting the values, if you don't want to overwrite the file you took the time to adjust it yesterday. Otherwise, just recopy the file in. The Config.properties file didn't change.
I updated to the latest release (v1.81) and the errors still persist, including /rep 1 giving me a list of commands and /rep crashing.
Log of /rep crash:
2012-03-30 04:10:41 [SEVERE] null org.bukkit.command.CommandException: Unhandled exception executing command 'rep' in plugin AutoRepair v1.81 at org.bukkit.command.PluginCommand.execute(PluginCommand.java:42) at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:166) at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:473) at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:821) at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:781) at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:764) at net.minecraft.server.Packet3Chat.handle(Packet3Chat.java:33) at net.minecraft.server.NetworkManager.b(NetworkManager.java:229) at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:113) at net.minecraft.server.NetworkListenThread.a(NetworkListenThread.java:78) at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:554) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:452) at net.minecraft.server.ThreadServerApplication.run(SourceFile:490) Caused by: java.lang.NullPointerException at com.mrockey28.bukkit.ItemRepair.AutoRepairSupport.doRepairOperation(AutoRepairSupport.java:84) at com.mrockey28.bukkit.ItemRepair.Repair.manualRepair(Repair.java:25) at com.mrockey28.bukkit.ItemRepair.AutoRepairPlugin.onCommand(AutoRepairPlugin.java:142) at org.bukkit.command.PluginCommand.execute(PluginCommand.java:40) ... 12 more
@sibilla6 sibilla6, I have not seen that. I'm going to have to try out some of those plugins to check for compatibility issues. It may take me a bit to get to that. Vault is obviously not an issue, haha.
diannetea, yeah, I need to add protection against that, but I think it'll only be able to be against items that have no damage whatsoever.
Conderan, I think I've got that issue worked out. Going to try and get a few other fixes in before publishing, shooting for late tonight.
I've been having problems with this plug-in in 1.2.4
When I type /rep 1 or /repair 1 it says that is not a valid command and gives me a list of commands, even if I have a sword or any other damaged item in my first slot. /rep reload and /rep arm are the only things that work. Also I set it to auto-repair and tested it out with a wooden sword, it broke without doing anything and no messages displayed, I was carrying the necessary items for the repair as well (that was after a /rep reload that changed that setting to "yes")
I'm running it alongside CreativeGates, MobCatcher, MoreExp, PluginMetrics, TobiMotd and Vault. Client-side I have Rei's minimap running. Could this be a conflict issue?
last thing, is there any way it could NOT repair things that aren't damaged?
I've seen the problem like is describe below. basically, if you /rep with nothing repairable in your hand it gives a bukkit error, would probably be better if there was just a nice clean message about how the item can't be repaired.
ALSO!
2012-03-29 15:36:00 [SEVERE] Could not pass event BlockDamageEvent to AutoRepair org.bukkit.event.EventException at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:303) at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:459) at org.bukkit.craftbukkit.event.CraftEventFactory.callBlockDamageEvent(CraftEventFactory.java:211) at net.minecraft.server.ItemInWorldManager.dig(ItemInWorldManager.java:141) at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:537) at net.minecraft.server.Packet14BlockDig.handle(SourceFile:43) at net.minecraft.server.NetworkManager.b(NetworkManager.java:229) at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:113) at net.minecraft.server.NetworkListenThread.a(NetworkListenThread.java:78) at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:554) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:452) at net.minecraft.server.ThreadServerApplication.run(SourceFile:490) Caused by: java.lang.NullPointerException at com.mrockey28.bukkit.ItemRepair.AutoRepairBlockListener.onBlockDamage(AutoRepairBlockListener.java:50) at sun.reflect.GeneratedMethodAccessor95.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:301) ... 12 more
I will create a ticket.
this was with nothing in hand
15:18:43 [SEVERE] null org.bukkit.command.CommandException: Unhandled exception executing command 'rep' in plugin AutoRepair v1.8 at org.bukkit.command.PluginCommand.execute(PluginCommand.java:42) at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:166) at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:473) at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:821) at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:781) at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:764) at net.minecraft.server.Packet3Chat.handle(Packet3Chat.java:33) at net.minecraft.server.NetworkManager.b(NetworkManager.java:229) at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:113) at net.minecraft.server.NetworkListenThread.a(NetworkListenThread.java:78) at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:554) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:452) at net.minecraft.server.ThreadServerApplication.run(SourceFile:490) Caused by: java.lang.NullPointerException at com.mrockey28.bukkit.ItemRepair.AutoRepairSupport.doRepairOperation(AutoRepairSupport.java:98) at com.mrockey28.bukkit.ItemRepair.Repair.manualRepair(Repair.java:25) at com.mrockey28.bukkit.ItemRepair.AutoRepairPlugin.onCommand(AutoRepairPlugin.java:142) at org.bukkit.command.PluginCommand.execute(PluginCommand.java:40) ... 12 more
It also will not let me repair tools? I cannot repair an iron shovel. In RepairCosts.Properties it is set to IRON_SPADE=251:265,1:280,1 My chat says "This item is not in the AutoRepair database."
One last thing, /repair all would be really nice :)
@Conderan
So, right now it's the Config.properties file that specifies whether items or gold or both are used to determine cost, and that's flat across the board for all items. It would be a good change to make it so that there is another setting to choose (aside from true, false, both) that makes it so the cost of each item is determined by what's listed in the AutoRepair.properties file, so that you can do what you described in your post.
I'll file a ticket about it so you can track it, and I'll get that update out over the weekend, if not before. Ticket: http://dev.bukkit.org/server-mods/autorepair/tickets/2-add-mode-for-the-economy-setting-to-let-cost-config/
also, maybe my syntax was wrong ... but, when I tried to make one item only use econ and the rest use items and econ... it just charged 100% every time for the only econ item.
was using: GOLD_HELMET=78: econ=122
My sever uses a gold based economy so money=gold.. made sense for us for the armor to have a pure econ cost while everything else costs items and a small econ charge.
"/rep all" fails and gives the help screen for me.