3
0
Mirror von https://github.com/Moulberry/AxiomPaperPlugin.git synchronisiert 2024-09-29 16:00:04 +02:00

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.craftbukkit.v1_20_R2.util.CraftNamespacedKey;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.Objects;
public class ServerWorldPropertyHolder<T> { public class ServerWorldPropertyHolder<T> {
private T value; private T value;
@ -56,7 +58,7 @@ public class ServerWorldPropertyHolder<T> {
} }
public void setValue(World world, T value) { 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; this.value = value;
if (sync) { if (sync) {
this.sync(world); this.sync(world);