forked from GeyserMC/Geyser
Add 'passthrough-protocol-name' config option (#1124)
* Initial version (tested) * Don't bump config version * Misc changes * Add punctuation to config
This commit is contained in:
parent
80a36344eb
commit
e7363b4e9f
5 changed files with 24 additions and 2 deletions
|
@ -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);
|
||||
|
|
|
@ -49,6 +49,9 @@ public interface GeyserConfiguration {
|
|||
@JsonIgnore
|
||||
boolean isPassthroughMotd();
|
||||
|
||||
@JsonIgnore
|
||||
boolean isPassthroughProtocolName();
|
||||
|
||||
@JsonIgnore
|
||||
boolean isPassthroughPlayerCounts();
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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()));
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue