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.
@alien12
Yup, just noticed this was happening on our server also....Other than this it's been working fine....
@mrockey28
There are still strange cases when enchanting items. Low level enchants are giving xp, and high level enchants (max level 30) are not taking enough xp. I've started with 47 levels and done a level 30 enchant which decreased my level to 25.
If I start on say 17 levels and use a low level enchant (level 5 in this case) my level will increase to 24.
This was tested using a vanilla bukkit setup with just autorepair running. It's completely fine without autorepair. Latest bukkit RB and latest autorepair.
Hi. Is it possible to add an Option that Armors won't be fully repaired? I actualy only need a way to make leather-armors usable at my server (for mages that can't wear iron but its wrecked after a few mobs) and auto-repair every x seconds for x Percent would make the situation a bit better.
@deljr15
@elforesto
Fixed. Watch for version 2.11.
@deljr15
@elforesto
Well that is pretty odd behavior. That should give me something specific to look for, though! I'll hopefully have it tracked down relatively quickly.
@elforesto
I'm seeing the same thing. I started at level 10, repaired a item for 5 xp (Diamond Axe) and jumped to level 48 with 85% to next level. So I enchanted a random item and repaired a diamond pick for 5 xp and returned to level 48 and 85%. At this point i broke a branch with the diamond axe and repaired it again this time it took the 5 xp (note acually 5 xp not 5 levels) so I continued breaking a branch and repairing and it continued to work. lowered to lvl 47 and repair brought back to 48 and 85%
I'm seeing a really odd behavior whenever doing a repair. Instead of deducting the XP specified for the item in xp-cost, 40 levels worth of xp are instead added to the player's balance. Is this something that anyone has seen before?
@caluo
Sure! That would be great! I need to work on incorporating language support into the plugin before that happens, but PM me, and I'll work on getting you something you can help translate.
can i help with german translation?
@mrockey28
Thank You! Everything works beautifully now! This is going to be a great addition to my server. Should have never mention the xp bug to my son though....he immediately started trying to exploit it. Kids...can't live with...can't abuse em. :)
@BEQOsNtDi6xRDGzqIAT7
I added the ability to use '<item-id>' to specify items that can be repaired. See the readme for the config.yml file above.
@PsychoFad
I added a new alias: '/ar'
@grinch843
Hi Scott,
I've thought about how to incorporate the ability to actually change the durability of an item, and I've decided that there is too much complexity in that one piece of functionality for me to try and tack it on into this plugin. Further analysis here.
I am, however, considering making a separate plugin that would be compatible with this one that could handle and be dedicated to that sort of functionality.
@mrockey28
posted a bug I found in the ticket system.
Thanks
@mrockey28
Thanks...that would be awesome!
Also if any of your other plugin users are curious, AutoRepair plays nice with McMMO, but you will definitely need to change the Anvil to another block or you will be double-charged for the repair (McMMO just requires the material that makes up the "head" of the tool) when you right-click. I changed it to a GOLD_BLOCK and it's working just fine. Took me a minute to figure out that you can't put the "Anvil" sign on the block or on the wall behind it or it won't work....has to be beside it or under it for it to recognize it as an Anvil. I can work with under it and just put one on the wall behind it with a better explanation. Would be cool if it could go on it or on the wall behind it though!
Thanks!
I'll look into creating another command alias that isn't in conflict with the ones you mention.
@mrockey28
wow..that was quick reply. I just updated my post to ask you if you could add a command alias. or is there one already?
/rep is used by PKSystem
/repair is used by McMMO
so it would have to be something like /ar or /autorepair....I currently can't reload the plugin without restarting the server due to the command being already in use. Figured I would test the plugin myself.
@PsychoFad
I can't confirm compatibility with McMMO, but in v2.00 of AutoRepair, you can change the block type used for the anvil. So if you want, you can have iron_block for mcmmo anvil, but wood block for your autorepair anvil.
Can anyone confirm that this plugin will work on a server running McMMO since it also uses the IRON_BLOCK as an anvil? I would love to be able to use both. That way if a player wants to repair the items themselves they can learn the repair skill through McMMO but also offer an option to players to pay to have their items repaired in town at an AutoRepair Anvil.
Thanks for any info!
Also...to the author....Any chance of a command alias being added? /rep is used by PKSystem and /repair is used by McMMO. I use both on
my server currently. Perhaps /ar or /autorepair?
Thanks!
@BEQOsNtDi6xRDGzqIAT7
Yes. I did a small amount of testing to make sure that yes, the mod should work with 1.2.5.
Speaking of compatibility: is the 1.3.x mod version still compatible with cb 1.2.5? :)