mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2024-12-22 04:37:42 +01:00
Custom Durability Rework
Mending better support
This commit is contained in:
parent
7e2a1e8d8b
commit
c1840631d9
2
pom.xml
2
pom.xml
@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>net.Indyuce</groupId>
|
||||
<artifactId>MMOItems</artifactId>
|
||||
<version>5.2.1</version>
|
||||
<version>5.2.2</version>
|
||||
<name>MMOItems</name>
|
||||
<description>A great item solution for your RPG server.</description>
|
||||
|
||||
|
@ -115,6 +115,13 @@ public class DurabilityItem {
|
||||
*/
|
||||
double ratio = (double) durability / maxDurability;
|
||||
int damage = (int) ((1. - ratio) * item.getType().getMaxDurability());
|
||||
|
||||
/*
|
||||
* make sure the vanilla bar displays at least 1 damage so the item can
|
||||
* always be mended
|
||||
*/
|
||||
damage = Math.max(ratio < 1 ? 1 : 0, damage);
|
||||
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
((Damageable) meta).setDamage(damage);
|
||||
item.setItemMeta(meta);
|
||||
|
Loading…
Reference in New Issue
Block a user