WorldProperties: Prevent NPE if setValue is called with null

Dieser Commit ist enthalten in:
Moulberry 2023-11-16 22:39:20 +08:00
Ursprung b6afa50b04
Commit f38226c9fb

Datei anzeigen

@ -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<T> {
private T value;
@ -56,7 +58,7 @@ public class ServerWorldPropertyHolder<T> {
}
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);