Plugin request: Always Repaired

Discussion in 'Archived: Plugin Requests' started by NatsuLT, Mar 5, 2013.

  1. Offline

    NatsuLT

    Plugin category: Repairing
    Suggested name: Always Repaired

    What I want: A plugin which could automaticly repair all of the player inventories,same like /repair all does but for every player logged for every 5seconds or items not loosing durability.

    Ideas for commands: No commands needed for this plugin.

    Ideas for permissions: repairall.ignore - Players with this permissions ignore the plugin

    When I'd like it by: the sooner the better :)
     
  2. Offline

    Wolf7115

    So... do you just want a plugin where people can be exempt from their tools losing durability?
     
  3. Offline

    NatsuLT

    Tools weapons and armor. At first i wanted for impossible to break item (not loosing durability at all) but i decided tu rename to repair becouse tampering with minecraft core can lead to unexpected bug's can't it?

    Wolf7115 But if you can amnage making durability go away thats more than perfect :)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  4. Offline

    DarkRiddles

    Im pretty sure essential has this! I think the command is /repair
     
  5. Offline

    SuperEvan200

    This doesn't disable it globally unless the command is executed and does not happen on a time interval. While theres no such plugin however, I would reccomend giving your players the permission /repair.
     
  6. Offline

    NatsuLT

    SuperEvan200 yeah i did /repair and /repair all but mindless sheep as they are they forget to use the command and end up loosing the items.
     
  7. Offline

    NatsuLT

  8. Offline

    lycano

    If someone wants to do this it should be pretty easy as long as you dont care about the durability meter. Cause i would not recommend running a task every 5 seconds and set durability to full.

    I would rather listen on the BlockDamageEvent or EntityDamageByEntityEvent and reset the durability to full whenever its near 0. As i never worked with durability i can only guess that if an item has 100 and reaches 1 it would then be destroyed at the next usage.

    So for the first event you get the item in hand and setDurability after checking if its near 0 with getDurability (see apidocs). For the second Event you first have to get the source of the damage and then check if its entity.player. If so then upcast with ( (Player) entity) and get the Item in hand with getItemInHand() and do the same as you do in the first event.

    I would create a private method in your listener that can check and reset the item durability and use that in each event so you wont have to copy paste.
     
    MrBluebear3 and Ne0nx3r0 like this.
  9. Offline

    NatsuLT

    if anyone is making theplugin do as lycano sais no durability is the way to go, and no server lag please.
     
  10. Offline

    Ne0nx3r0

    lycano Why not reset the durability every time? I don't think it would be that big of a resource hog.

    Also notably I'm not sure if armor gets damaged from falls, fire, etc... Might have to listen on EntityDamageEvent if that's the case.
     
  11. Offline

    lycano

    Ne0nx3r0 the armor thingy, yes that may work i did not thought about that.

    For the armor i would also only check if the dmg would destroy the item and only then reset.
    As for the item: Why not reset the durability on each hit? Well i would guess that a check with IF will be more efficient as a reset on durability will crawl through item updates. So the less you update the better it will run.
     
  12. Offline

    Chloe-chan

    I've updated it. :D

    Commands:
    -no commands-

    Permissions:
    alwaysrepaired.allow.tools - Allow repair of tools on block breaks.
    alwaysrepaired.allow.armour - Allow repair of armour on receive damage.
    alwaysrepaired.allow.bow - Allow repair of bows on arrows shot.
    alwaysrepaired.allow.flintandsteel - Allow repair of flint and steel on ignite.
    alwaysrepaired.allow.* - Allows the above permissions.

    Download link here. (same)

    Known caveats:
    - I have fixed the wool issue, but not sure if it will work. >~<

    Source:
    https://github.com/Chloe-chan/AlwaysRepaired
     
    NatsuLT likes this.
  13. Offline

    NatsuLT

    Chloe-chan Thnx very much, and yeah if you could upload it :)
     
  14. Offline

    Chloe-chan

    Last edited by a moderator: May 31, 2016

Share This Page