Custom Damage with Durability

Discussion in 'Plugin Development' started by ninjaboy323, Jul 15, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    ninjaboy323

    So, I started working on my MMORPG server quite a bit ago and I am really stumped at this part. My current weapon generator makes the damage very high (up to 60k damage). Now the problem is that minecraft uses an alogorithim that makes the durability of the armor the player has lost based on how much damage was dealt. So hitting someone with one of these weapons instantly breaks an entire set of armor. I have tried many things such as a Thread that constantly sets the armors durability to 0 (max). also setting the players armor durability every time they are hit. I am really stumped on what to do and how to make it so it doesn't instantly break the armor. Maybe set the maximum durability of the armor to something really high?

    Thanks,
    Ninja.
     
  2. Offline

    bazsi700

  3. Offline

    ninjaboy323

    @bazsi, I tried with the maxium amount of unbreaking you can possibly have on armor (even with UnsafeEnchantments)

    For your second idea I think that wouldn't work because I would have to copy the itemstack, but if the armor breaks then the item stack doesn't exist anymore
     
  4. Offline

    Zombie_Striker

    @ninjaboy323
    Events happen Before the change has been made. You can always use Event.setCancled(true) to stop the armour braking event (meaning the armour will still have low durib if you don't change it, but it will still exist)
     
  5. Offline

    ninjaboy323

    @Zombie_Striker there is no e.setCanceled for ItemBreakEvent I have also tried to set the durability on itembreak to max, but it still doesn't seem to work.

    Bump! Still need help with this issue :/

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 12, 2016
  6. Offline

    Konato_K

    @Zombie_Striker This is normally the default behavior, but not all events are fired before something happens (PlayerChangedWorldEvent fires after the player already changed the world, it's just a notification event)
     
Thread Status:
Not open for further replies.

Share This Page