SteamWar/SpigotCore
Archiviert
13
0

Fix REntityServer NPE
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
Lixfel 2023-01-15 18:15:21 +01:00
Ursprung 745d04845b
Commit 8d3037f67d

Datei anzeigen

@ -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<Player> emptyPlayers = new HashSet<>(0);
private final HashMap<Long, HashSet<REntity>> entities = new HashMap<>();
private final HashMap<Long, HashSet<Player>> players = new HashMap<>();
private final HashMap<Long, Set<Player>> players = new HashMap<>();
private final HashMap<Player, Location> 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<Player> of, HashSet<Player> in, Consumer<Consumer<Object>> packetProvider) {
private void onMissing(Set<Player> of, Set<Player> in, Consumer<Consumer<Object>> 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));
}