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.
@mrockey28
Hmm, I always thought that it had actually changed the durability of an item, guess I should have actually tested it out huh :-)........
Scott....
@grinch843
Hi Scott,
I removed the durabilities in the configuration because they didn't actually change anything. Let me explain: When I originally wrote the plugin, I was too stupid to figure out how to access the actual max durabilities of the items in question, so in order to allow me to figure this out, I put them in the configuration file. If you changed these values, it didn't really change the point at which the tool would break; it would only change the point at which auto-repair thought the tool would break. Since I've figured out how to get max item durability, this isn't needed in the configuration anymore.
HOWEVER, I can insert an option that will produce the functionality you're looking for, allowing you to adjust the virtual durability of an item. This would be fairly simple; let me work on this.
Hi, I like the new setup, but I have one suggestion if possible. Could you add the duribility option back? I liked being able to change some of the tools around...
Thanks, Scott...
Concerning the following enhancement requests: 1 2
I have made the requested enhancements as of v2.00. See the changelist for v2.00 for details, and read the README for configuration and implementation details.
To the best of my knowledge, this completes all known enhancement requests.
Concerning the following enhancement requests: 1 2 3
I have (finally) made the requested enhancements as of v1.84. See the changelist for v1.84 for implementation and usage details.
@Salrostrym
What is "item_rounding" set to in your Config.properties?
Hey my servers using version 1.3.1 -R2.0 and I had set auto repair off and repair costs to true. I am also using the default Repaircosts.properties file.
Yet whenever I or anyone else uses the /repair command it costs them nothing to repair. For example I had a diamond pickaxe in hand, used /repair and a message along the lines of "repaired for 0 diamonds and 0 sticks" came up and the item was repaired.
@Salrostrym
The latest version officially supports current Bukkit recommended release 1.3.1-R2.0, but I've verified compatibility with the beta Bukkit build as well, version 1.3.2-R0.1.
Is this working for 1.3.2 yet?
Any update for 1.3.x ??????
Thanks, Scott
@minecraftbreda
The only reason I can think of for the exact thing you describe is that you have misspelled the "access" permission like you did below. Make sure that it's "AutoRepair.access", and that everything is spelled correctly.
<<reply 734429="">>
yes
the only permission that works is autorepair.*
If I have some one give the permission
-autorepair.acces
-autorepair. repair
If people than do /rep nothing happends
no message in the consol and not in the game self.
@minecraftbreda
Have you made sure that "permissions=true" is in your Config.properties file in the AutoRepair folder?
<<reply 730204="">>
Sorry
I take my worts back
the plugin don't use it's permissions
<<reply 730821="">>
So far as I know works the auto repair perfectly.
I have no complains about it.
And I have test the /rep and that works to.
@mrockey28
I've just uploaded the latest patch, which fixes your issue; it should be live soon (v 1.83.6).
However, I believe the only way you could be getting the errors you were reporting was if your server was failing to load one of the config files for autorepair during server startup. If this is true, this fix will only make it so that you don't get all sorts of errors in the log in this condition; autorepair will still not work correctly. Please make sure you have all the right files in the right places, that they haven't changed lately, and that you aren't getting the error "Error reading AutoRepair config files" or something similar at startup.
@minecraftbreda
Alright, cool. I'll take a look at this, thanks.
hello I'll get this fault message.
29.05 20:25:09 [Server] INFO ... 17 more
29.05 20:25:09 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:301)
29.05 20:25:09 [Server] INFO at java.lang.reflect.Method.invoke(Unknown Source)
29.05 20:25:09 [Server] INFO at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
29.05 20:25:09 [Server] INFO at sun.reflect.GeneratedMethodAccessor440.invoke(Unknown Source)
29.05 20:25:09 [Server] INFO at com.mrockey28.bukkit.ItemRepair.AutoRepairBlockListener.onEntityDamageByEntity(AutoRepairBlockListener.java:56)
29.05 20:25:09 [Server] INFO at com.mrockey28.bukkit.ItemRepair.AutoRepairBlockListener.eventAffectsItemInHand(AutoRepairBlockListener.java:131)
29.05 20:25:09 [Server] INFO Caused by: java.lang.NullPointerException
29.05 20:25:09 [Server] INFO at net.minecraft.server.ThreadServerApplication.run(SourceFile:492)
29.05 20:25:09 [Server] INFO at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:449)
29.05 20:25:09 [Server] INFO at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:551)
29.05 20:25:09 [Server] INFO at net.minecraft.server.NetworkListenThread.a(NetworkListenThread.java:78)
29.05 20:25:09 [Server] INFO at net.minecraft.serverhook.NetServerHandlerProxy.a(NetServerHandlerProxy.java:83)
29.05 20:25:09 [Server] INFO at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:113)
29.05 20:25:09 [Server] INFO at net.minecraft.server.NetworkManager.b(NetworkManager.java:229)
29.05 20:25:09 [Server] INFO at net.minecraft.server.Packet7UseEntity.handle(SourceFile:33)
29.05 20:25:09 [Server] INFO at net.minecraft.serverhook.NetServerHandlerProxy.a(NetServerHandlerProxy.java:180)
29.05 20:25:09 [Server] INFO at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:997)
29.05 20:25:09 [Server] INFO at net.minecraft.server.EntityHuman.attack(EntityHuman.java:750)
29.05 20:25:09 [Server] INFO at net.minecraft.server.EntityAnimal.damageEntity(SourceFile:124)
29.05 20:25:09 [Server] INFO at net.minecraft.server.EntityLiving.damageEntity(EntityLiving.java:608)
29.05 20:25:09 [Server] INFO at org.bukkit.craftbukkit.event.CraftEventFactory.handleEntityDamageEvent(CraftEventFactory.java:381)
29.05 20:25:09 [Server] INFO at org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDamageEvent(CraftEventFactory.java:363)
29.05 20:25:09 [Server] INFO at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:459)
29.05 20:25:09 [Server] INFO at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
29.05 20:25:09 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:303)
29.05 20:25:09 [Server] INFO org.bukkit.event.EventException
29.05 20:25:09 [Server] SEVERE Could not pass event EntityDamageByEntityEvent to AutoRepair
@BEQOsNtDi6xRDGzqIAT7
That's an intriguing suggestion. I actually think this would be pretty simple to implement. Ticket Here.
<<reply 685208="">>
Speaking of major revisions... what are the odds of there being a ...uh, stationary lockdown implemented? Specifically i am asking for a anvil type item (iron block with a sign?) that needs to be used in order to repair said items. (preventing field repairs)
Would also be a tad more elegant than typing commands into chat. :)