diff --git a/SpigotCore_Main/src/de/steamwar/entity/REntityServer.java b/SpigotCore_Main/src/de/steamwar/entity/REntityServer.java index 577cb13..c8cf486 100644 --- a/SpigotCore_Main/src/de/steamwar/entity/REntityServer.java +++ b/SpigotCore_Main/src/de/steamwar/entity/REntityServer.java @@ -30,8 +30,10 @@ import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerQuitEvent; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; +import java.util.Set; import java.util.function.BiConsumer; import java.util.function.Consumer; @@ -42,7 +44,7 @@ public class REntityServer implements Listener { private static final HashSet emptyPlayers = new HashSet<>(0); private final HashMap> entities = new HashMap<>(); - private final HashMap> players = new HashMap<>(); + private final HashMap> players = new HashMap<>(); private final HashMap lastLocation = new HashMap<>(); public REntityServer() { @@ -145,7 +147,7 @@ public class REntityServer implements Listener { forChunkInView(player, location, (x, z) -> players.get(chunkToId(x, z)).remove(player)); } - private void onMissing(HashSet of, HashSet in, Consumer> packetProvider) { + private void onMissing(Set of, Set in, Consumer> packetProvider) { if(of == null) return; @@ -178,7 +180,7 @@ public class REntityServer implements Listener { private void removePlayerFromChunk(Player player, int x, int z) { long id = chunkToId(x, z); - players.get(id).remove(player); + players.getOrDefault(id, Collections.emptySet()).remove(player); for(REntity entity : entities.getOrDefault(id, emptyEntities)) { entity.despawn(packet -> TinyProtocol.instance.sendPacket(player, packet)); }