13
0
geforkt von Mirrors/Velocity

Merge pull request #101 from DoNotSpamPls/query-map

Add an option in the config to change the query map
Dieser Commit ist enthalten in:
Andrew Steinborn 2018-09-24 08:14:34 -04:00 committet von GitHub
Commit e2a188c699
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 15 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -208,6 +208,10 @@ public class VelocityConfiguration extends AnnotatedConfig {
return query.getQueryPort(); return query.getQueryPort();
} }
public String getQueryMap() {
return query.getQueryMap();
}
public String getMotd() { public String getMotd() {
return motd; return motd;
} }
@ -482,6 +486,9 @@ public class VelocityConfiguration extends AnnotatedConfig {
@Comment("If query responding is enabled, on what port should query response listener listen on?") @Comment("If query responding is enabled, on what port should query response listener listen on?")
@ConfigKey("port") @ConfigKey("port")
private int queryPort = 25577; private int queryPort = 25577;
@Comment("This is the map name that is reported to the query services.")
@ConfigKey("map")
private String queryMap = "Velocity";
private Query() { private Query() {
} }
@ -489,12 +496,14 @@ public class VelocityConfiguration extends AnnotatedConfig {
private Query(boolean queryEnabled, int queryPort) { private Query(boolean queryEnabled, int queryPort) {
this.queryEnabled = queryEnabled; this.queryEnabled = queryEnabled;
this.queryPort = queryPort; this.queryPort = queryPort;
this.queryMap = queryMap;
} }
private Query(Toml toml) { private Query(Toml toml) {
if (toml != null) { if (toml != null) {
this.queryEnabled = toml.getBoolean("enabled", false); this.queryEnabled = toml.getBoolean("enabled", false);
this.queryPort = toml.getLong("port", 25577L).intValue(); this.queryPort = toml.getLong("port", 25577L).intValue();
this.queryMap = toml.getString("map", "Velocity");
} }
} }
@ -506,11 +515,16 @@ public class VelocityConfiguration extends AnnotatedConfig {
return queryPort; return queryPort;
} }
public String getQueryMap() {
return queryMap;
}
@Override @Override
public String toString() { public String toString() {
return "Query{" return "Query{"
+ "queryEnabled=" + queryEnabled + "queryEnabled=" + queryEnabled
+ ", queryPort=" + queryPort + ", queryPort=" + queryPort
+ ", queryMap=" + queryMap
+ '}'; + '}';
} }
} }

Datei anzeigen

@ -110,7 +110,7 @@ public class GS4QueryHandler extends SimpleChannelInboundHandler<DatagramPacket>
responseWriter.write("version", ProtocolConstants.SUPPORTED_GENERIC_VERSION_STRING); responseWriter.write("version", ProtocolConstants.SUPPORTED_GENERIC_VERSION_STRING);
responseWriter.write("plugins", ""); responseWriter.write("plugins", "");
responseWriter.write("map", "Velocity"); responseWriter.write("map", server.getConfiguration().getQueryMap());
responseWriter.write("numplayers", server.getPlayerCount()); responseWriter.write("numplayers", server.getPlayerCount());
responseWriter.write("maxplayers", server.getConfiguration().getShowMaxPlayers()); responseWriter.write("maxplayers", server.getConfiguration().getShowMaxPlayers());
responseWriter.write("hostport", server.getConfiguration().getBind().getPort()); responseWriter.write("hostport", server.getConfiguration().getBind().getPort());