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.
@minecraftbreda
Nope, this:
http://dev.bukkit.org/server-mods/vault/
No setup required, just stick it in your plugins folder, and it should hook right into iConomy.
@mrockey28
do you mean this?
http://forums.bukkit.org/threads/fun-vault-slots-v1-7-simple-slot-machines-1-1-r1.43864/
@minecraftbreda
Have you installed Vault? If you don't have both Vault and an economy plugin installed, setting economy = true will result in repairs being free.
@mrockey28
I have don loaded the update you have made Now I can do /rep reload whit now problems And he do auto repair the tools. But first he used wood and sticks. I have now set ecomomy on true. Now he don't use sticks and wood. But It cost no money
@minecraftbreda
I looked at your files, and everything seems to be fine. I wonder... is it possible that you don't have your two .properties files in the folder ./plugins/AutoRepair? That's the only other reason I can think for getting the "Error reading AutoRepair config" message.
@mrockey28
Don I have created a ticket
@minecraftbreda
Can you open a ticket on this issue, please? Once you've opened a ticket, you should be able to attach files to the ticket; if you could attach your Config.properties and your RepairCosts.properties files to the ticket, it should be no problem for me to figure out what the issue is. Thanks!
@mrockey28
If i reload I get this message: Error reading AutoRepair config
if i do /rep then sometimes I get this message: ... is already fullie repaired
the line economy is : economy=true
I don't have a AutoRepair.properties file. I have only: the .jar, Config.properties and RepairCosts.properties
@minecraftbreda
A couple things would help narrow down the possible causes:
I have 2 things
one my tools stil break. (and I have auto-repair on true)
two If i manual repair my tools it don't cost any money (I have repair cost on true). The plugin I use for money is icomomy
hmm. im not very known with java programming. so cant help you out there:/
but there could be something like it is now, only an option for enchanted picks, swords, armor. of each material, and just add a option like:
GOLD_PICKAXE=266,3:280,2 Enchanted_GOLD_PICKAXE=266,5:280,2
(im not sure if its doable to recognize enchant levels. but then again that might be complicated to make an easy option for it..)
@boblefisk
Yeah, I can do that. I've opened an enhancement ticket for it here. I probably won't get to this until next week, as I'm on vacation right now.
If you have any ideas about how you'd like to see this done, let me know, I'm open to suggestions.
Hi. is it possible to make enchanted items cost more to repair than non enchanted? would like to make it more even on my server. people with lots of diamonds and good enchanted items should pay more, then new players with no enchants.
great plugin btw! nice job redoing it!:D
@Damimad
So it looks like you deleted the listed durability for all your items and that's why its throwing the error. If you don't want to have item cost for your items, you have two options:
AutoRepair reads the hard coded durability right out of that file, so that number right after the first "equals" sign needs to stay in there.
As for the output of "/rep all", once your repairs start costing money, /rep all will output a list of the items that your users couldn't afford to repair. If it doesn't list *anything*, they can assume that everything they have has been repaired. Does that work for you?
[ERROR] Bad or no durability given for item DIAMOND_SWORD! Weird, it says that about all items. I did this, because I don't want it to require any items. LEATHER_LEGGINGS= econ=25 (All items are formatted like this, with different econ prices.
My users are able to repair for free... /rep all also doesn't output anything. When they type /rep it repairs. I think it should output all the commands.
I will install your new version and give you a feedback within the next few days.
Keep up your good work, love this plugin :)
PS: Vault and iConomy6 are both installed and working fine with other plugins ;)
@diannetea
I think I have this one figured out. Look for a fix in the next release.
14:20:57 [SEVERE] Could not pass event EntityDamageByEntityEvent 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.callEntityDamageEvent(CraftEventFactory.java:359) at org.bukkit.craftbukkit.event.CraftEventFactory.handleEntityDamageEvent(CraftEventFactory.java:377) at net.minecraft.server.EntityLiving.damageEntity(EntityLiving.java:608) at net.minecraft.server.EntityHuman.damageEntity(EntityHuman.java:595) at net.minecraft.server.EntityPlayer.damageEntity(EntityPlayer.java:215) at net.minecraft.server.EntityMonster.a(EntityMonster.java:80) at net.minecraft.server.PathfinderGoalMeleeAttack.e(PathfinderGoalMeleeAttack.java:78) at net.minecraft.server.PathfinderGoalSelector.a(SourceFile:55) at net.minecraft.server.EntityLiving.z_(EntityLiving.java:1229) at net.minecraft.server.EntityLiving.e(EntityLiving.java:1109) at net.minecraft.server.EntityMonster.e(EntityMonster.java:21) at net.minecraft.server.EntityZombie.e(EntityZombie.java:55) at net.minecraft.server.EntityLiving.F_(EntityLiving.java:447) at net.minecraft.server.EntityMonster.F_(EntityMonster.java:25) at net.minecraft.server.World.entityJoinedWorld(World.java:1265) at net.minecraft.server.WorldServer.entityJoinedWorld(WorldServer.java:106) at net.minecraft.server.World.playerJoinedWorld(World.java:1247) at net.minecraft.server.World.tickEntities(World.java:1154) at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:545) 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.eventAffectsArmor(AutoRepairBlockListener.java:150) at com.mrockey28.bukkit.ItemRepair.AutoRepairBlockListener.onEntityDamage(AutoRepairBlockListener.java:92) at sun.reflect.GeneratedMethodAccessor221.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:301) ... 23 more
mrocky28 thank you so much for the quick turn around the plugin is working perfectly now.