summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAizistral2022-08-26 13:48:39 +0200
committerGitHub2022-08-26 13:48:39 +0200
commit9b7badb0b0e567afe8a45e0fcc802424ba6b8217 (patch)
treed6f8040a42184a64d78191ca833b707dd55279be
parentcc429cd123721a63e41d450bdd6350600e2d1cf6 (diff)
parent9e48894bc1060117b0e6565e559a18068496df0a (diff)
Merge pull request #162 from MODKILLER1001/1.19.2-Fabric-Other
Add default whitelisted server and adding reset button to whitelistedServers
-rw-r--r--src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java6
-rw-r--r--src/main/resources/assets/nochatreports/lang/en_us.json3
2 files changed, 8 insertions, 1 deletions
diff --git a/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java b/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java
index b2948c1..124b64e 100644
--- a/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java
+++ b/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java
@@ -1,5 +1,6 @@
package com.aizistral.nochatreports.config;
+import java.util.ArrayList;
import java.util.List;
import com.aizistral.nochatreports.gui.FontHelper;
@@ -9,6 +10,7 @@ import com.terraformersmc.modmenu.api.ModMenuApi;
import me.shedaniel.clothconfig2.api.ConfigBuilder;
import me.shedaniel.clothconfig2.api.ConfigCategory;
import me.shedaniel.clothconfig2.api.ConfigEntryBuilder;
+import me.shedaniel.clothconfig2.gui.entries.StringListListEntry;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.Minecraft;
@@ -42,6 +44,8 @@ public class ModMenuIntegration implements ModMenuApi {
return tooltip;
}
+ private static final ArrayList<String> DEFAULT_WHITELISTED_SERVERS = new ArrayList<>(List.of());
+
@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
return screen -> {
@@ -156,10 +160,12 @@ public class ModMenuIntegration implements ModMenuApi {
whitelistedServers.addEntry(entryBuilder.startStrList(Component.translatable("option.NoChatReports.whitelistedServers"), NoReportsConfig.getInstance().whitelistedServers)
.setExpanded(true)
.setInsertInFront(true)
+ .setDefaultValue(DEFAULT_WHITELISTED_SERVERS)
.setTooltip(this.makeTooltip("option.NoChatReports.whitelistedServers.tooltip"))
.setAddButtonTooltip(Component.translatable("option.NoChatReports.whitelistedServers.addButtonTooltip"))
.setRemoveButtonTooltip(Component.translatable("option.NoChatReports.whitelistedServers.removeButtonTooltip"))
.setSaveConsumer(newValue -> NoReportsConfig.getInstance().whitelistedServers = newValue)
+ .setCreateNewInstance(baseListEntry -> new StringListListEntry.StringListCell(Language.getInstance().getOrDefault(("option.NoChatReports.whitelistedServers.serverAddress")), (StringListListEntry) baseListEntry))
.build());
// Save config
diff --git a/src/main/resources/assets/nochatreports/lang/en_us.json b/src/main/resources/assets/nochatreports/lang/en_us.json
index e5e54db..2dac977 100644
--- a/src/main/resources/assets/nochatreports/lang/en_us.json
+++ b/src/main/resources/assets/nochatreports/lang/en_us.json
@@ -46,5 +46,6 @@
"option.NoChatReports.whitelistedServers.tooltip": "Contains servers for which \"Unsafe Server\" warning screen should never display. Servers are added to this list automatically when you check \"Do not show again for this server\" box in that screen.\nEach entry is a string that is formatted as §l<server-ip>:<port>§r.",
"option.NoChatReports.whitelistedServers.addButtonTooltip": "Add server",
"option.NoChatReports.whitelistedServers.removeButtonTooltip": "Remove server",
- "option.NoChatReports.whitelistedServers.instructions": "When adding a server click below Whitelisted Servers to type in the field."
+ "option.NoChatReports.whitelistedServers.instructions": "Click the + to add a server. Click the - to remove the selected server.",
+ "option.NoChatReports.whitelistedServers.serverAddress": "Click here to edit server address"
} \ No newline at end of file