Skip to content

Commit

Permalink
Added search for server software
Browse files Browse the repository at this point in the history
  • Loading branch information
DAMcraft committed Aug 2, 2023
1 parent 4875945 commit 2e00b82
Showing 1 changed file with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ public enum version {
Custom
}

public enum software {
Any,
Vanilla,
Paper,
Spigot,
Bukkit
}

public enum NumRangeType {
Any,
Equals,
Expand Down Expand Up @@ -135,6 +143,13 @@ public enum NumRangeType {
.build()
);

private final Setting<software> softwareSetting = sg.add(new EnumSetting.Builder<software>()
.name("software")
.description("The software the servers should have")
.defaultValue(software.Any)
.build()
);

private final Setting<version> versionSetting = sg.add(new EnumSetting.Builder<version>()
.name("version")
.description("The protocol version the servers should have")
Expand All @@ -152,7 +167,7 @@ public enum NumRangeType {
.build()
);

private final Setting<Boolean> online_only = sg.add(new BoolSetting.Builder()
private final Setting<Boolean> onlineOnly = sg.add(new BoolSetting.Builder()
.name("online-only")
.description("Whether to only show servers that are online")
.defaultValue(true)
Expand Down Expand Up @@ -233,12 +248,15 @@ public void initWidgets() {
if (!descriptionSetting.get().isEmpty()) {
jsonObject.addProperty("description", descriptionSetting.get());
}
if (softwareSetting.get() != software.Any) {
jsonObject.addProperty("software", softwareSetting.get().toString().toLowerCase());
}
if (versionSetting.get() == version.Custom) {
jsonObject.addProperty("protocol", customProtocolSetting.get());
} else if (versionSetting.get() == version.Current) {
jsonObject.addProperty("protocol", SharedConstants.getProtocolVersion());
}
if (!online_only.get()) {
if (!onlineOnly.get()) {
jsonObject.addProperty("online_after", 0);
}
this.locked = true;
Expand Down

0 comments on commit 2e00b82

Please sign in to comment.