From f38226c9fbb8ba333fe1667c2abf11242e7287f8 Mon Sep 17 00:00:00 2001 From: Moulberry Date: Thu, 16 Nov 2023 22:39:20 +0800 Subject: [PATCH] WorldProperties: Prevent NPE if setValue is called with null --- .../world_properties/server/ServerWorldPropertyHolder.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/moulberry/axiom/world_properties/server/ServerWorldPropertyHolder.java b/src/main/java/com/moulberry/axiom/world_properties/server/ServerWorldPropertyHolder.java index 58a9276..676f2c6 100644 --- a/src/main/java/com/moulberry/axiom/world_properties/server/ServerWorldPropertyHolder.java +++ b/src/main/java/com/moulberry/axiom/world_properties/server/ServerWorldPropertyHolder.java @@ -12,6 +12,8 @@ import org.bukkit.World; import org.bukkit.craftbukkit.v1_20_R2.util.CraftNamespacedKey; import org.bukkit.entity.Player; +import java.util.Objects; + public class ServerWorldPropertyHolder { private T value; @@ -56,7 +58,7 @@ public class ServerWorldPropertyHolder { } public void setValue(World world, T value) { - boolean sync = this.unsyncedValue || !value.equals(this.value); + boolean sync = this.unsyncedValue || !Objects.equals(value, this.value); this.value = value; if (sync) { this.sync(world);