Skip to content

Commit

Permalink
Merge branch 'dev/patch' into fix/exploded-blocks-remove
Browse files Browse the repository at this point in the history
  • Loading branch information
Moderocky authored May 6, 2024
2 parents 871dedc + 2af552e commit 4e80ae6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/ch/njol/skript/effects/EffHealth.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ protected void execute(Event event) {
if (this.amount == null) {
ItemUtils.setDamage(itemStack, 0);
} else {
int damageAmt = (int) Math2.fit(0, (isHealing ? -amount : amount), itemStack.getType().getMaxDurability());
int damageAmt = (int) Math2.fit(0, (ItemUtils.getDamage(itemStack) + (isHealing ? -amount : amount)), itemStack.getType().getMaxDurability());
ItemUtils.setDamage(itemStack, damageAmt);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
test "slot damage accountability":
set {_inv} to chest inventory named "slot accountability"
set slot 0 of {_inv} to diamond sword with damage 100

repair slot 0 of {_inv} by 10
assert damage of slot 0 of {_inv} is 90 with "Durability of slot 0, was not updated correctly"
repair slot 0 of {_inv}
assert durability of slot 0 of {_inv} is maximum durability of slot 0 of {_inv} with "Durability of slot 0, was not fully repaired"

0 comments on commit 4e80ae6

Please sign in to comment.