3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 16:12:46 +01:00

Replace ; with : in motd/submotd (#3389)

Dieser Commit ist enthalten in:
Konicai 2022-11-09 11:12:12 -05:00 committet von GitHub
Ursprung 592b48dbf5
Commit b1d832dded
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -125,13 +125,9 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler {
pong.setSubMotd(config.getBedrock().secondaryMotd()); pong.setSubMotd(config.getBedrock().secondaryMotd());
} }
if (config.isPassthroughPlayerCounts() && pingInfo != null) { // https://github.com/GeyserMC/Geyser/issues/3388
pong.setPlayerCount(pingInfo.getPlayers().getOnline()); pong.setMotd(pong.getMotd().replace(';', ':'));
pong.setMaximumPlayerCount(pingInfo.getPlayers().getMax()); pong.setSubMotd(pong.getSubMotd().replace(';', ':'));
} else {
pong.setPlayerCount(geyser.getSessionManager().getSessions().size());
pong.setMaximumPlayerCount(config.getMaxPlayers());
}
// Fallbacks to prevent errors and allow Bedrock to see the server // Fallbacks to prevent errors and allow Bedrock to see the server
if (pong.getMotd() == null || pong.getMotd().isBlank()) { if (pong.getMotd() == null || pong.getMotd().isBlank()) {
@ -160,6 +156,14 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler {
} }
} }
if (config.isPassthroughPlayerCounts() && pingInfo != null) {
pong.setPlayerCount(pingInfo.getPlayers().getOnline());
pong.setMaximumPlayerCount(pingInfo.getPlayers().getMax());
} else {
pong.setPlayerCount(geyser.getSessionManager().getSessions().size());
pong.setMaximumPlayerCount(config.getMaxPlayers());
}
//Bedrock will not even attempt a connection if the client thinks the server is full //Bedrock will not even attempt a connection if the client thinks the server is full
//so we have to fake it not being full //so we have to fake it not being full
if (pong.getPlayerCount() >= pong.getMaximumPlayerCount()) { if (pong.getPlayerCount() >= pong.getMaximumPlayerCount()) {