3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-12-25 15:50:19 +01:00

Merge pull request #96 from lucko/fix/ping

Add missing getters to ServerPing and rename Modinfo --> ModInfo
Dieser Commit ist enthalten in:
Andrew Steinborn 2018-09-20 16:06:49 -04:00 committet von GitHub
Commit d328951112
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -16,13 +16,13 @@ public class ServerPing {
private final Players players; private final Players players;
private final Component description; private final Component description;
private final @Nullable Favicon favicon; private final @Nullable Favicon favicon;
private final Modinfo modinfo; private final ModInfo modinfo;
public ServerPing(Version version, @Nullable Players players, Component description, @Nullable Favicon favicon) { public ServerPing(Version version, @Nullable Players players, Component description, @Nullable Favicon favicon) {
this(version, players, description, favicon, Modinfo.DEFAULT); this(version, players, description, favicon, ModInfo.DEFAULT);
} }
public ServerPing(Version version, @Nullable Players players, Component description, @Nullable Favicon favicon, @Nullable Modinfo modinfo) { public ServerPing(Version version, @Nullable Players players, Component description, @Nullable Favicon favicon, ServerPing.@Nullable ModInfo modinfo) {
this.version = Preconditions.checkNotNull(version, "version"); this.version = Preconditions.checkNotNull(version, "version");
this.players = players; this.players = players;
this.description = Preconditions.checkNotNull(description, "description"); this.description = Preconditions.checkNotNull(description, "description");
@ -46,7 +46,7 @@ public class ServerPing {
return Optional.ofNullable(favicon); return Optional.ofNullable(favicon);
} }
public Optional<Modinfo> getModinfo() { public Optional<ModInfo> getModinfo() {
return Optional.ofNullable(modinfo); return Optional.ofNullable(modinfo);
} }
@ -165,7 +165,7 @@ public class ServerPing {
public ServerPing build() { public ServerPing build() {
return new ServerPing(version, nullOutPlayers ? null : new Players(onlinePlayers, maximumPlayers, samplePlayers), description, favicon, return new ServerPing(version, nullOutPlayers ? null : new Players(onlinePlayers, maximumPlayers, samplePlayers), description, favicon,
nullOutModinfo ? null : new Modinfo(modType, mods)); nullOutModinfo ? null : new ModInfo(modType, mods));
} }
public Version getVersion() { public Version getVersion() {
@ -302,13 +302,13 @@ public class ServerPing {
} }
} }
public static class Modinfo { public static class ModInfo {
public static final Modinfo DEFAULT = new Modinfo("FML", ImmutableList.of()); public static final ModInfo DEFAULT = new ModInfo("FML", ImmutableList.of());
private final String type; private final String type;
private final List<Mod> modList; private final List<Mod> modList;
public Modinfo(String type, List<Mod> modList) { public ModInfo(String type, List<Mod> modList) {
this.type = Preconditions.checkNotNull(type, "type"); this.type = Preconditions.checkNotNull(type, "type");
this.modList = ImmutableList.copyOf(modList); this.modList = ImmutableList.copyOf(modList);
} }
@ -330,5 +330,13 @@ public class ServerPing {
this.id = Preconditions.checkNotNull(id, "id"); this.id = Preconditions.checkNotNull(id, "id");
this.version = Preconditions.checkNotNull(version, "version"); this.version = Preconditions.checkNotNull(version, "version");
} }
public String getId() {
return id;
}
public String getVersion() {
return version;
}
} }
} }