From 969d5cd396db51fa10812b89cc81563df2197ae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ZX=E5=A4=8F=E5=A4=9C=E4=B9=8B=E9=A3=8E?= Date: Sat, 2 Nov 2024 13:15:08 +0800 Subject: [PATCH] fix: manually boxing for targetable boolean state to prevent NPE (#3174) * fix: manually boxing for comparison is necessary as the targetable state may undefined * chore: remove unused import --- main/src/main/java/net/citizensnpcs/trait/TargetableTrait.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/src/main/java/net/citizensnpcs/trait/TargetableTrait.java b/main/src/main/java/net/citizensnpcs/trait/TargetableTrait.java index 621b805de..4881f47f5 100644 --- a/main/src/main/java/net/citizensnpcs/trait/TargetableTrait.java +++ b/main/src/main/java/net/citizensnpcs/trait/TargetableTrait.java @@ -67,7 +67,7 @@ public class TargetableTrait extends Trait { } public void setTargetable(boolean targetable) { - if (this.targetable == targetable) + if (Boolean.valueOf(targetable).equals(this.targetable)) return; this.targetable = targetable; if (!targetable) {