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

This commit is contained in:
Konicai 2022-11-09 11:12:12 -05:00 committed by GitHub
parent 592b48dbf5
commit b1d832dded
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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()) {