Add server platform identification
This commit is contained in:
parent
34ef25e69d
commit
0f3517742d
@ -69,10 +69,33 @@ public class MinecraftServer {
|
||||
*/
|
||||
@NonNull private final String name;
|
||||
|
||||
/**
|
||||
* The identified platform of the server, null if unknown.
|
||||
*/
|
||||
private String platform;
|
||||
|
||||
/**
|
||||
* The protocol version of the server.
|
||||
*/
|
||||
private final int protocol;
|
||||
|
||||
/**
|
||||
* Create a more detailed
|
||||
* copy of this object.
|
||||
*
|
||||
* @return the detailed copy
|
||||
*/
|
||||
@NonNull
|
||||
public Version detailedCopy() {
|
||||
String platform = null;
|
||||
if (name.contains(" ")) { // Parse the server platform
|
||||
String[] split = name.split(" ");
|
||||
if (split.length == 2) {
|
||||
platform = split[0];
|
||||
}
|
||||
}
|
||||
return new Version(name, platform, protocol);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -33,8 +33,8 @@ public final class JavaMinecraftServer extends MinecraftServer {
|
||||
if (motdString == null) { // Not a string motd, convert from Json
|
||||
motdString = new TextComponent(ComponentSerializer.parse(RESTfulMC.GSON.toJson(token.getDescription()))).toLegacyText();
|
||||
}
|
||||
return new JavaMinecraftServer(hostname, ip, port, token.getVersion(), token.getPlayers(),
|
||||
MOTD.create(motdString), token.getFavicon(), false
|
||||
return new JavaMinecraftServer(hostname, ip, port, token.getVersion().detailedCopy(),
|
||||
token.getPlayers(), MOTD.create(motdString), token.getFavicon(), false
|
||||
);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user