forked from GeyserMC/Geyser
Properly remove players from Geyser playerlist (Fixes #421
This commit is contained in:
parent
1a53f53d78
commit
8b487df698
3 changed files with 10 additions and 4 deletions
|
@ -48,7 +48,7 @@ public class ReloadCommand extends GeyserCommand {
|
||||||
}
|
}
|
||||||
sender.sendMessage(ChatColor.YELLOW + "Reloading Geyser configurations... all connected bedrock clients will be kicked.");
|
sender.sendMessage(ChatColor.YELLOW + "Reloading Geyser configurations... all connected bedrock clients will be kicked.");
|
||||||
for (GeyserSession session : connector.getPlayers().values()) {
|
for (GeyserSession session : connector.getPlayers().values()) {
|
||||||
session.getUpstream().disconnect("Geyser has been reloaded... sorry for the inconvenience!");
|
session.disconnect("Geyser has been reloaded... sorry for the inconvenience!");
|
||||||
}
|
}
|
||||||
connector.reload();
|
connector.reload();
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,10 +47,10 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(LoginPacket loginPacket) {
|
public boolean handle(LoginPacket loginPacket) {
|
||||||
if (loginPacket.getProtocolVersion() > GeyserConnector.BEDROCK_PACKET_CODEC.getProtocolVersion()) {
|
if (loginPacket.getProtocolVersion() > GeyserConnector.BEDROCK_PACKET_CODEC.getProtocolVersion()) {
|
||||||
session.getUpstream().disconnect("Outdated Geyser proxy! I'm still on " + GeyserConnector.BEDROCK_PACKET_CODEC.getMinecraftVersion());
|
session.disconnect("Outdated Geyser proxy! I'm still on " + GeyserConnector.BEDROCK_PACKET_CODEC.getMinecraftVersion());
|
||||||
return true;
|
return true;
|
||||||
} else if (loginPacket.getProtocolVersion() < GeyserConnector.BEDROCK_PACKET_CODEC.getProtocolVersion()) {
|
} else if (loginPacket.getProtocolVersion() < GeyserConnector.BEDROCK_PACKET_CODEC.getProtocolVersion()) {
|
||||||
session.getUpstream().disconnect("Outdated Bedrock client! Please use " + GeyserConnector.BEDROCK_PACKET_CODEC.getMinecraftVersion());
|
session.disconnect("Outdated Bedrock client! Please use " + GeyserConnector.BEDROCK_PACKET_CODEC.getMinecraftVersion());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
|
||||||
session.getUpstream().sendPacket(stack);
|
session.getUpstream().sendPacket(stack);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
session.getUpstream().disconnect("disconnectionScreen.resourcePack");
|
session.disconnect("disconnectionScreen.resourcePack");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -330,10 +330,16 @@ public class GeyserSession implements CommandSender {
|
||||||
downstream.getSession().disconnect(reason);
|
downstream.getSession().disconnect(reason);
|
||||||
}
|
}
|
||||||
if (upstream != null && !upstream.isClosed()) {
|
if (upstream != null && !upstream.isClosed()) {
|
||||||
|
connector.getPlayers().remove(this.upstream.getAddress());
|
||||||
upstream.disconnect(reason);
|
upstream.disconnect(reason);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.entityCache.getEntities().clear();
|
||||||
|
this.scoreboardCache.removeScoreboard();
|
||||||
|
this.inventoryCache.getInventories().clear();
|
||||||
|
this.windowCache.getWindows().clear();
|
||||||
|
|
||||||
closed = true;
|
closed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue