From 3e9a9e97280164c4273bbf16639ab9cb3cc6609b Mon Sep 17 00:00:00 2001 From: MODKILLER1001 Date: Sat, 20 Aug 2022 07:38:46 -0400 Subject: add default server to whitelisted server menu --- .../java/com/aizistral/nochatreports/config/ModMenuIntegration.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java b/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java index b2948c1..13f4963 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; @@ -42,6 +43,9 @@ public class ModMenuIntegration implements ModMenuApi { return tooltip; } + private static final ArrayList DEFAULT_SERVER_ADD = new ArrayList<>(List.of( + "mc.example.com")); + @Override public ConfigScreenFactory getModConfigScreenFactory() { return screen -> { @@ -155,6 +159,7 @@ public class ModMenuIntegration implements ModMenuApi { // Add or remove whitelisted servers whitelistedServers.addEntry(entryBuilder.startStrList(Component.translatable("option.NoChatReports.whitelistedServers"), NoReportsConfig.getInstance().whitelistedServers) .setExpanded(true) + .setDefaultValue(DEFAULT_SERVER_ADD) .setInsertInFront(true) .setTooltip(this.makeTooltip("option.NoChatReports.whitelistedServers.tooltip")) .setAddButtonTooltip(Component.translatable("option.NoChatReports.whitelistedServers.addButtonTooltip")) -- cgit v1.2.3 From 7e3b12ec23fe25cc900006316a7de586c5d96695 Mon Sep 17 00:00:00 2001 From: MODKILLER1001 Date: Sat, 20 Aug 2022 09:07:08 -0400 Subject: modify whitelisted servers --- .../com/aizistral/nochatreports/config/ModMenuIntegration.java | 7 ++++--- src/main/resources/assets/nochatreports/lang/en_us.json | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java b/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java index 13f4963..364d58b 100644 --- a/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java +++ b/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java @@ -10,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; @@ -43,8 +44,7 @@ public class ModMenuIntegration implements ModMenuApi { return tooltip; } - private static final ArrayList DEFAULT_SERVER_ADD = new ArrayList<>(List.of( - "mc.example.com")); + private static final ArrayList DEFAULT_WHITELISTED_SERVERS = new ArrayList<>(List.of()); @Override public ConfigScreenFactory getModConfigScreenFactory() { @@ -159,12 +159,13 @@ public class ModMenuIntegration implements ModMenuApi { // Add or remove whitelisted servers whitelistedServers.addEntry(entryBuilder.startStrList(Component.translatable("option.NoChatReports.whitelistedServers"), NoReportsConfig.getInstance().whitelistedServers) .setExpanded(true) - .setDefaultValue(DEFAULT_SERVER_ADD) .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("Click here to edit server address", (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..9590581 100644 --- a/src/main/resources/assets/nochatreports/lang/en_us.json +++ b/src/main/resources/assets/nochatreports/lang/en_us.json @@ -46,5 +46,5 @@ "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:§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." } \ No newline at end of file -- cgit v1.2.3 From 9e48894bc1060117b0e6565e559a18068496df0a Mon Sep 17 00:00:00 2001 From: MODKILLER1001 Date: Mon, 22 Aug 2022 13:52:14 -0400 Subject: add localization for server address --- .../java/com/aizistral/nochatreports/config/ModMenuIntegration.java | 2 +- src/main/resources/assets/nochatreports/lang/en_us.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java b/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java index 364d58b..124b64e 100644 --- a/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java +++ b/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java @@ -165,7 +165,7 @@ public class ModMenuIntegration implements ModMenuApi { .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("Click here to edit server address", (StringListListEntry) baseListEntry)) + .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 9590581..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:§r.", "option.NoChatReports.whitelistedServers.addButtonTooltip": "Add server", "option.NoChatReports.whitelistedServers.removeButtonTooltip": "Remove server", - "option.NoChatReports.whitelistedServers.instructions": "Click the + to add a server. Click the - to remove the selected server." + "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 -- cgit v1.2.3