3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-25 15:50:14 +01:00

Add 'passthrough-protocol-name' config option (#1124)

* Initial version (tested)

* Don't bump config version

* Misc changes

* Add punctuation to config
Dieser Commit ist enthalten in:
James Cahill 2020-08-18 04:36:15 +01:00 committet von GitHub
Ursprung 80a36344eb
Commit e7363b4e9f
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
5 geänderte Dateien mit 24 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -89,6 +89,11 @@ public class GeyserSpongeConfiguration implements GeyserConfiguration {
return node.getNode("passthrough-motd").getBoolean(false);
}
@Override
public boolean isPassthroughProtocolName() {
return node.getNode("passthrough-protocol-name").getBoolean(false);
}
@Override
public boolean isPassthroughPlayerCounts() {
return node.getNode("passthrough-player-counts").getBoolean(false);

Datei anzeigen

@ -49,6 +49,9 @@ public interface GeyserConfiguration {
@JsonIgnore
boolean isPassthroughMotd();
@JsonIgnore
boolean isPassthroughProtocolName();
@JsonIgnore
boolean isPassthroughPlayerCounts();

Datei anzeigen

@ -57,6 +57,9 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration
@JsonProperty("passthrough-player-counts")
private boolean isPassthroughPlayerCounts;
@JsonProperty("passthrough-protocol-name")
private boolean isPassthroughProtocolName;
@JsonProperty("legacy-ping-passthrough")
private boolean isLegacyPingPassthrough;

Datei anzeigen

@ -141,6 +141,7 @@ public class QueryPacketHandler {
String motd;
String currentPlayerCount;
String maxPlayerCount;
String map;
if (connector.getConfig().isPassthroughMotd() || connector.getConfig().isPassthroughPlayerCounts()) {
pingInfo = connector.getBootstrap().getGeyserPingPassthrough().getPingInformation();
@ -162,6 +163,13 @@ public class QueryPacketHandler {
maxPlayerCount = String.valueOf(connector.getConfig().getMaxPlayers());
}
// If passthrough protocol name is enabled let's get the protocol name from the ping response.
if (connector.getConfig().isPassthroughProtocolName() && pingInfo != null) {
map = String.valueOf((pingInfo.getVersion().getName()));
} else {
map = GeyserConnector.NAME;
}
// Create a hashmap of all game data needed in the query
Map<String, String> gameData = new HashMap<String, String>();
gameData.put("hostname", motd);
@ -169,7 +177,7 @@ public class QueryPacketHandler {
gameData.put("game_id", "MINECRAFT");
gameData.put("version", BedrockProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion());
gameData.put("plugins", "");
gameData.put("map", GeyserConnector.NAME);
gameData.put("map", map);
gameData.put("numplayers", currentPlayerCount);
gameData.put("maxplayers", maxPlayerCount);
gameData.put("hostport", String.valueOf(connector.getConfig().getBedrock().getPort()));

Datei anzeigen

@ -53,9 +53,12 @@ floodgate-key-file: public-key.pem
# Disabling this will prevent command suggestions from being sent and solve freezing for Bedrock clients.
command-suggestions: true
# The following two options enable "ping passthrough" - the MOTD and/or player count gets retrieved from the Java server.
# The following three options enable "ping passthrough" -the MOTD, player count and/or protocol name gets retrieved from the Java server.
# Relay the MOTD from the remote server to Bedrock players.
passthrough-motd: false
# Relay the protocol name (e.g. BungeeCord [X.X], Paper 1.X) - only really useful when using a custom protocol name!
# This will also show up on sites like MCSrvStatus. <mcsrvstat.us>
passthrough-protocol-name: false
# Relay the player count and max players from the remote server to Bedrock players.
passthrough-player-counts: false
# Enable LEGACY ping passthrough. There is no need to enable this unless your MOTD or player count does not appear properly.