mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Empty player list on transition, despawn skulls
This commit is contained in:
parent
2a6025f3fc
commit
e391a67e38
2 changed files with 21 additions and 2 deletions
|
|
@ -87,6 +87,7 @@ import org.geysermc.geyser.entity.attribute.GeyserAttributeType;
|
|||
import org.geysermc.geyser.entity.type.Entity;
|
||||
import org.geysermc.geyser.entity.type.ItemFrameEntity;
|
||||
import org.geysermc.geyser.entity.type.Tickable;
|
||||
import org.geysermc.geyser.entity.type.player.PlayerEntity;
|
||||
import org.geysermc.geyser.entity.type.player.SessionPlayerEntity;
|
||||
import org.geysermc.geyser.erosion.AbstractGeyserboundPacketHandler;
|
||||
import org.geysermc.geyser.erosion.GeyserboundHandshakePacketHandler;
|
||||
|
|
@ -887,8 +888,18 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
|||
public void packetReceived(Session session, Packet packet) {
|
||||
if (protocol.getState() == ProtocolState.CONFIGURATION) {
|
||||
if (packet instanceof ClientboundFinishConfigurationPacket) {
|
||||
// Prevent
|
||||
GeyserSession.this.ensureInEventLoop(() -> GeyserSession.this.sendDownstreamPacket(new ServerboundFinishConfigurationPacket()));
|
||||
GeyserSession.this.ensureInEventLoop(() -> {
|
||||
// Clear the player list, as on Java the player list is cleared after transitioning from config to play phase
|
||||
PlayerListPacket playerListPacket = new PlayerListPacket();
|
||||
playerListPacket.setAction(PlayerListPacket.Action.REMOVE);
|
||||
for (PlayerEntity otherEntity : GeyserSession.this.getEntityCache().getAllPlayerEntities()) {
|
||||
playerListPacket.getEntries().add(new PlayerListPacket.Entry(otherEntity.getTabListUuid()));
|
||||
GeyserSession.this.getEntityCache().removePlayerEntity(otherEntity.getUuid());
|
||||
}
|
||||
GeyserSession.this.sendUpstreamPacket(playerListPacket);
|
||||
|
||||
GeyserSession.this.sendDownstreamPacket(new ServerboundFinishConfigurationPacket());
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -243,8 +243,16 @@ public class SkullCache {
|
|||
}
|
||||
|
||||
public void clear() {
|
||||
for (Skull skull : skulls.values()) {
|
||||
if (skull.entity != null) {
|
||||
skull.entity.despawnEntity();
|
||||
}
|
||||
}
|
||||
skulls.clear();
|
||||
inRangeSkulls.clear();
|
||||
for (SkullPlayerEntity skull : unusedSkullEntities) {
|
||||
skull.despawnEntity();
|
||||
}
|
||||
unusedSkullEntities.clear();
|
||||
totalSkullEntities = 0;
|
||||
lastPlayerPosition = null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue