From a0e47473cea6bec287b67faea0ccbd576c7b6bce Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 30 Jun 2019 09:52:18 +1000 Subject: [PATCH] SPIGOT-5121: Method to set PierceLevel of arrows --- .../org/bukkit/craftbukkit/entity/CraftArrow.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java index 0e4afe8f00..2793ce7a19 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java @@ -39,6 +39,18 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow { getHandle().setDamage(damage); } + @Override + public int getPierceLevel() { + return getHandle().s(); // PAIL: rename + } + + @Override + public void setPierceLevel(int pierceLevel) { + Preconditions.checkArgument(0 <= pierceLevel && pierceLevel <= Byte.MAX_VALUE, "Pierce level out of range, expected 0 < level < 127"); + + getHandle().b((byte) pierceLevel); // PAIL: rename + } + @Override public boolean isCritical() { return getHandle().isCritical();