3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-08 17:20:20 +01:00

Properly remove players from Geyser playerlist (Fixes #421

Dieser Commit ist enthalten in:
RednedEpic 2020-04-25 17:53:35 -05:00
Ursprung 1a53f53d78
Commit 8b487df698
3 geänderte Dateien mit 10 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -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();
} }

Datei anzeigen

@ -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;
} }

Datei anzeigen

@ -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;
} }