Durability plugin

Discussion in 'Plugin Requests' started by alexei7, Jan 7, 2020.

  1. Offline

    alexei7

    I've been looking for a plugin to increase the max durability of armour for my server.
    A few weeks ago i ran into a problem on my OPFactions server where the custom unbreaking on armour wouldn't work. After some research I found out it's not possible to get unbr3+ to work as unbreaking caps at 60% chance.
    I then came up with the idea to add the unbreaking enchantments on to the armour + extra durability to make it seem like the unbreaking enchants were working, when they actually weren't it was just the extra durability.
    Problem is I can't find a plugin like that ANYWHERE and adding negative durability onto my items doesn't work either. If anyone could link me a plugin or possibly write me one I would greatly appreciate it!
     
  2. Offline

    dbaum102

    I could do this but, I'd rather not start this project until you provide more information on what you want the finished plugin like. Such as config or as to how you want to get the enchantments.. As a book? A command? Only kits? Please provide more information and I will get back yo you with a plugin.
     
  3. Offline

    JRL1004

    @alexei7
    I know it is not exactly what you asked, as you wanted to have more item durability, but I made a quick plugin to fix the unbreaking issue for you. If you care, the durability function that I used and how I got it is explained below. If not, know that unbreaking levels 0, 1, 2, and 3 all work normally, but levels from 4 to 32k (or whatever the Minecraft maximum is) also work. Note that armor becomes indestructible at levels 78+.

    The math I used (open)
    I took the existing values for unbreaking from the Minecraft wiki and plug them into a table on the Desmos online graphing calculator. At first glance, the functions appeared to be logarithmic, but I was unable to find any logarithmic recursion results that satisfied any of the original values, So I decided to try an exponential recursion instead and got lucky. Below, this graph is given as a result when using the values from the recursion.
    upload_2020-1-10_21-51-52.png
    As you can see, the curve has some error, but passing the resulting scalars through a rounding function ensures that the values from the original enchantment are matched truthfully. With this knowledge, I wrote a quick listener to handler the damage computations and that was it. As a note, this is only for armor. For items, The wiki already had a formula. I just enforced it.


    Known bugs that I don't care enough to fix: Some items take more than one damage when performing certain actions. For example, using an axe for combat deals 2 damage to the axe per impact, while using the axe to break any block only causes the axe one damage. The opposite is true for swords. I didn't want to check for these cases, so I just made all actions have a base damage of 1, so swords can now break twice as many blocks, and tools last twice as long in combat. If it's a tremendously huge issue, I apologize but I wanted to keep the plugin simple and the Bukkit API makes these cases annoyingly complex (by comparison).

    If you find other bugs, however, I might care about those so please do inform me!

    Link to download from my dropbox (I forget where I can post download links from. I don't use this forum as much as I used to): https://www.dropbox.com/s/n2dyua217rsyumn/UnbreakingPatch_1.0.jar?dl=0

    Edit:
    Built using Java 8 and Spigot 1.15.1. Due to checking if an item is armor or not, the plugin requires API version 1.13. I don't know if that makes this plugin only work for 1.13 and up, but you can just run it and see if you get an error when it loads.
     
    Last edited: Jan 10, 2020

Share This Page