Dieser Commit ist enthalten in:
Ursprung
5e6b86f2ba
Commit
02d756137e
@ -197,11 +197,18 @@ public class REntityServer implements Listener {
|
||||
@EventHandler
|
||||
public void onQuit(PlayerQuitEvent e) {
|
||||
Player player = e.getPlayer();
|
||||
viewDistance.remove(player);
|
||||
Location location = lastLocation.remove(player);
|
||||
if(location == null)
|
||||
return;
|
||||
|
||||
forChunkInView(player, location, (x, z) -> players.get(chunkToId(x, z)).remove(player));
|
||||
forChunkInView(player, location, (x, z) -> {
|
||||
long id = chunkToId(x, z);
|
||||
Set<Player> playersInChunk = players.get(id);
|
||||
playersInChunk.remove(player);
|
||||
if(playersInChunk.isEmpty())
|
||||
players.remove(id);
|
||||
});
|
||||
}
|
||||
|
||||
private void onMissing(Set<Player> of, Set<Player> in, Consumer<Consumer<Object>> packetProvider) {
|
||||
@ -237,7 +244,12 @@ public class REntityServer implements Listener {
|
||||
|
||||
private void removePlayerFromChunk(Player player, int x, int z) {
|
||||
long id = chunkToId(x, z);
|
||||
players.get(id).remove(player);
|
||||
|
||||
Set<Player> playersInChunk = players.get(id);
|
||||
playersInChunk.remove(player);
|
||||
if(playersInChunk.isEmpty())
|
||||
players.remove(id);
|
||||
|
||||
for(REntity entity : entities.getOrDefault(id, emptyEntities)) {
|
||||
entity.despawn(packet -> TinyProtocol.instance.sendPacket(player, packet));
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren