Change version in query to use a more informative string (#1635)

* Change version in query to use a more informative string

* Fix removal of string

* Cleaner implementation of version

* Fix build

* Make more explicit what we're replacing

Co-authored-by: Camotoy <20743703+DoctorMacc@users.noreply.github.com>
This commit is contained in:
rtm516 2020-12-09 20:14:12 +00:00 committed by GitHub
parent 2a44874458
commit 91cdda95db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 5 deletions

View file

@ -230,8 +230,12 @@
</includes> </includes>
<replacements> <replacements>
<replacement> <replacement>
<token>VERSION = ".*"</token> <token>String VERSION = ".*"</token>
<value>VERSION = "${project.version} (git-${git.branch}-${git.commit.id.abbrev})"</value> <value>String VERSION = "${project.version} (" + GIT_VERSION + ")"</value>
</replacement>
<replacement>
<token>String GIT_VERSION = ".*"</token>
<value>String GIT_VERSION = "git-${git.branch}-${git.commit.id.abbrev}"</value>
</replacement> </replacement>
</replacements> </replacements>
</configuration> </configuration>
@ -249,8 +253,12 @@
</includes> </includes>
<replacements> <replacements>
<replacement> <replacement>
<token>VERSION = ".*"</token> <token>String VERSION = ".*"</token>
<value>VERSION = "DEV"</value> <value>String VERSION = "DEV"</value>
</replacement>
<replacement>
<token>String GIT_VERSION = ".*"</token>
<value>String GIT_VERSION = "DEV"</value>
</replacement> </replacement>
</replacements> </replacements>
</configuration> </configuration>

View file

@ -86,6 +86,7 @@ public class GeyserConnector {
.enable(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES); .enable(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES);
public static final String NAME = "Geyser"; public static final String NAME = "Geyser";
public static final String GIT_VERSION = "DEV"; // A fallback for running in IDEs
public static final String VERSION = "DEV"; // A fallback for running in IDEs public static final String VERSION = "DEV"; // A fallback for running in IDEs
private static final String IP_REGEX = "\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b"; private static final String IP_REGEX = "\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b";

View file

@ -174,7 +174,7 @@ public class QueryPacketHandler {
gameData.put("hostname", motd); gameData.put("hostname", motd);
gameData.put("gametype", "SMP"); gameData.put("gametype", "SMP");
gameData.put("game_id", "MINECRAFT"); gameData.put("game_id", "MINECRAFT");
gameData.put("version", BedrockProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion()); gameData.put("version", GeyserConnector.NAME + " (" + GeyserConnector.GIT_VERSION + ") " + BedrockProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion());
gameData.put("plugins", ""); gameData.put("plugins", "");
gameData.put("map", map); gameData.put("map", map);
gameData.put("numplayers", currentPlayerCount); gameData.put("numplayers", currentPlayerCount);