RepairDispenser
Overview
version: 0.3.1
| craftbukkit: #2149
| Source
Description
RepairDispenser is a plugin that will allow players to repair their tools and equipment using raw materials by placing both into a Dispenser and dispensing it (requires some kind of redstone power source, like a button or pressure plate). The raw material required is whatever material is needed to make the item being repaired (ex. Diamond Pickaxe requires a Diamond as a raw material). The amount repaired is based on the amount of raw material required to initially make the item (ex. Diamond Pickaxe is repaired 33% (1/3) for each Diamond).
One of the major benefits of RepairDispenser is that the repaired item's enchantments will not be removed. This allows players to fully use those hard-to-get enchanted items without worrying about them eventually being destroyed. Also, since the raw materials required are the core component of the tool already, it is not imbalanced either.
Usage
How to use RepairDispenser:
- Build regular dispenser.
- Attach button/lever/pressure plate/redstone signal to dispenser.
- Open dispenser and place tool + raw material inside dispenser.
- Press/use the button/lever/pressure plate/redstone signal.
- Rejoice as your repaired item is dispensed!
FAQ
- Can I repair bows and fishing rods?
Of course! To repair bows and fishing rods, use String as the raw material.
- My server is still running a version of Bukkit before 2149! Use RepairDispenser 0.3.0 if you are running a build before 2149.
Config Options
Quote from the Config File:over-repair: [ true | false ] - Allow items to be over-repaired (ie. if a 99% pickaxe is repaired with 1 raw material, it will have 132% durability instead of 100% durability, preventing the raw material from being "wasted" on a 1% repair).
Commands
There are no commands.
Permissions
There are no permissions (as dispensers can be triggered by non-players, so having permissions is useless).
To Do List
My current to-do list:
- Add a config option to change raw materials for items. Current implementation doesn't support it, though.
- Add a config option to set the percentage repaired per raw material item.
- Add a chat message for how much was repaired.
- Add a check command to see what's needed for repair.
Change Log
View the Change Log.
Credits
- slipcor for helping with the banner's screenshot!
- garbagemule for inspiration and code help along the way!
Let me know if you need another pair of eyes to scan the code, I know it always helps me! Damned Java and its horrible debugging services...
@AgnateHeartstone
That's what I thought too, actually, I checked under the stairs and behind the building, but he said that the only thing that was fired was the pants, and the other item was gone (Diamond breastplate). There was still one diamond left in the dispenser, however. If he comes around on MSN I'll ask him if he remembers what order they were in.
Also, the dispenser had its back against a wall, but it was a thin wall, and we didn't see anything behind it.
Hey, update! After chopping down a few forests, my axe now claims it has a green durability bar. It seems like it was either over-durabilitied or under-durabilitied and the integer just happened to rollover back to positive or something (although that'd be a lot of trees before it was visible...)
@Paril101 The dispenser will only dispense one at a time, so it's odd that the other one was lost. Either way, I'll definitely check it out. If you could get a detailed description of what he put in (even placement), that would be helpful. :)
Right now, enchanted items "drop onto the ground" wherever the dispenser block is, so it's possible they shot in a different direction, too. (Still going to check, of course).
@AgnateHeartstone
Well, I know there's no config YET, but eventually it'd be nice to have the ability to set up custom tools/raw materials!
It was a friend who had done it actually, but I believe he had put an enchanted chestplate and an unenchanted pair of diamond leggings in the thing. He hit the button and only the leggings came out; that's about all I know.
As for the bar, the axe has been stuck at infinite/"no bar" mode, and even if I drop it/pick it up/reconnect it stays that way. Might have to code a simple command in a bit to see what the durability value actually is...
@Paril101 Well, this has no config file, so no YML needed. :D
@Paril101 Hmm, odd... I'll investigate this one. Did it seem like any particular item was lost (such as always a tool, etc.)?
(Update) Ahhhh, I bet you the tool you were repairing was unenchanted, yes? This is a bug as a result of my enchantment-loss-prevention-hack. Pretty sure I know how to fix this. :D
@Paril101 Weird for the infinite uses thing. I did read a bug report where sometimes it is visually infinite and then suddenly breaks (bar doesn't update), but I'll definitely triple-check this! I thought I tested this all out, but it's possible I missed something. It's SUPPOSED to only use the minimum amount of raw materials to do the repairs (so you could theoretically stockpile the dispenser with raw materials and broken tools for quick repairs). Again, I'll have a gander at this. Might not have time to post a fix until Friday, though. Busy week!
(Update) I'm going to assume this is just a calculation error with my code, so a small tweak should fix it. I'll definitely triple-test this, though. Since I think I found the two problems, I'll try to post the update when I get home tonight. :)
Editing posts seems to be broken, sorry:
Bug numero dos: somehow, I ended up with a diamond axe with infinite (or at least, visually infinite) durability. May have been because I overstuffed diamonds?
Slight bug: if you place multiple items in the dispenser, and attempt to repair them at once, you lose one of them. Should be an easy fix, though!
Haha, magnificent!
This reminds me a lot of Thief 2's last mission where you have to move a bunch of items between machines to make diodes and stuff.. except this time you're repairing, but it did the same thing (put items in boxes, it spat out the final item).
I might try creating my own implementation of this (I avoid using other plugins and end up writing them myself to avoid the worst markup language ever, yml)!
CB #1555 had some enchantment fixes, but sadly, none of them resolved the dispenser removing enchantments, so enchanted tools/armour still drop "differently" than normally-dispensed items (they just drop on the ground normally, instead of being dispensed). :)
@Lextao I didn't mean to sound like a total turd! I just like to keep my plugins simple and to the point, that's all. I also like the functionality to feel as though it was part of vanilla (coming back to the simplicity point). :)
@TechJawa Thanks! Glad you like it. :D
This is AWESOME. I'll be implementing this as long as development continues! :D Thanks!
@Lextao
Do you mean which raw material would repair the item? Either way, no. Currently there's no configuration options. I may add this later, though.
Great plugin! I've been looking for this so long.
Can we set which item repairs X tool/equipment?