mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 05:47:45 +01:00
Fix NPE of AbstractArrow#getWeapon (#10933)
This commit is contained in:
parent
5c5a5fb93c
commit
22e64d8059
@ -742,6 +742,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
public abstract EnchantmentTarget getItemTarget();
|
public abstract EnchantmentTarget getItemTarget();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
diff --git a/src/main/java/org/bukkit/entity/AbstractArrow.java b/src/main/java/org/bukkit/entity/AbstractArrow.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/org/bukkit/entity/AbstractArrow.java
|
||||||
|
+++ b/src/main/java/org/bukkit/entity/AbstractArrow.java
|
||||||
|
@@ -0,0 +0,0 @@ public interface AbstractArrow extends Projectile {
|
||||||
|
*
|
||||||
|
* @return The firing ItemStack
|
||||||
|
*/
|
||||||
|
- @NotNull
|
||||||
|
+ @Nullable // Paper
|
||||||
|
@ApiStatus.Experimental
|
||||||
|
public ItemStack getWeapon();
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/entity/Enderman.java b/src/main/java/org/bukkit/entity/Enderman.java
|
diff --git a/src/main/java/org/bukkit/entity/Enderman.java b/src/main/java/org/bukkit/entity/Enderman.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/entity/Enderman.java
|
--- a/src/main/java/org/bukkit/entity/Enderman.java
|
||||||
|
@ -201,6 +201,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isInBlock() {
|
public boolean isInBlock() {
|
||||||
|
@@ -0,0 +0,0 @@ public class CraftAbstractArrow extends AbstractProjectile implements AbstractAr
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getWeapon() {
|
||||||
|
+ if (this.getHandle().getWeaponItem() == null) return null; // Paper - fix NPE
|
||||||
|
return CraftItemStack.asBukkitCopy(this.getHandle().getWeaponItem());
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public class CraftAbstractArrow extends AbstractProjectile implements AbstractAr
|
@@ -0,0 +0,0 @@ public class CraftAbstractArrow extends AbstractProjectile implements AbstractAr
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "CraftArrow";
|
return "CraftArrow";
|
||||||
|
Loading…
Reference in New Issue
Block a user