Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-12-26 16:12:50 +01:00
Merge pull request #88 from PurpleIsEverything/master
Allow modifying the ModInfo type.
Dieser Commit ist enthalten in:
Commit
9c05203ce8
@ -74,6 +74,7 @@ public class ServerPing {
|
|||||||
builder.favicon = favicon;
|
builder.favicon = favicon;
|
||||||
builder.nullOutModinfo = modinfo == null;
|
builder.nullOutModinfo = modinfo == null;
|
||||||
if (modinfo != null) {
|
if (modinfo != null) {
|
||||||
|
builder.modType = modinfo.type;
|
||||||
builder.mods.addAll(modinfo.modList);
|
builder.mods.addAll(modinfo.modList);
|
||||||
}
|
}
|
||||||
return builder;
|
return builder;
|
||||||
@ -91,6 +92,7 @@ public class ServerPing {
|
|||||||
private int onlinePlayers;
|
private int onlinePlayers;
|
||||||
private int maximumPlayers;
|
private int maximumPlayers;
|
||||||
private final List<SamplePlayer> samplePlayers = new ArrayList<>();
|
private final List<SamplePlayer> samplePlayers = new ArrayList<>();
|
||||||
|
private String modType;
|
||||||
private final List<Mod> mods = new ArrayList<>();
|
private final List<Mod> mods = new ArrayList<>();
|
||||||
private Component description;
|
private Component description;
|
||||||
private Favicon favicon;
|
private Favicon favicon;
|
||||||
@ -121,6 +123,11 @@ public class ServerPing {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder modType(String modType) {
|
||||||
|
this.modType = Preconditions.checkNotNull(modType, "modType");
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Builder mods(Mod... mods) {
|
public Builder mods(Mod... mods) {
|
||||||
this.mods.addAll(Arrays.asList(mods));
|
this.mods.addAll(Arrays.asList(mods));
|
||||||
return this;
|
return this;
|
||||||
@ -158,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(mods));
|
nullOutModinfo ? null : new Modinfo(modType, mods));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Version getVersion() {
|
public Version getVersion() {
|
||||||
@ -185,6 +192,10 @@ public class ServerPing {
|
|||||||
return favicon;
|
return favicon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getModType() {
|
||||||
|
return modType;
|
||||||
|
}
|
||||||
|
|
||||||
public List<Mod> getMods() {
|
public List<Mod> getMods() {
|
||||||
return mods;
|
return mods;
|
||||||
}
|
}
|
||||||
@ -196,6 +207,7 @@ public class ServerPing {
|
|||||||
", onlinePlayers=" + onlinePlayers +
|
", onlinePlayers=" + onlinePlayers +
|
||||||
", maximumPlayers=" + maximumPlayers +
|
", maximumPlayers=" + maximumPlayers +
|
||||||
", samplePlayers=" + samplePlayers +
|
", samplePlayers=" + samplePlayers +
|
||||||
|
", modType=" + modType +
|
||||||
", mods=" + mods +
|
", mods=" + mods +
|
||||||
", description=" + description +
|
", description=" + description +
|
||||||
", favicon=" + favicon +
|
", favicon=" + favicon +
|
||||||
@ -291,12 +303,13 @@ public class ServerPing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class Modinfo {
|
public static class Modinfo {
|
||||||
public static final Modinfo DEFAULT = new Modinfo(ImmutableList.of());
|
public static final Modinfo DEFAULT = new Modinfo("FML", ImmutableList.of());
|
||||||
|
|
||||||
private final String type = "FML";
|
private final String type;
|
||||||
private final List<Mod> modList;
|
private final List<Mod> modList;
|
||||||
|
|
||||||
public Modinfo(List<Mod> modList) {
|
public Modinfo(String type, List<Mod> modList) {
|
||||||
|
this.type = Preconditions.checkNotNull(type, "type");
|
||||||
this.modList = ImmutableList.copyOf(modList);
|
this.modList = ImmutableList.copyOf(modList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren