From aff7d576873a7cf21bc3573c0d63c6f265972c12 Mon Sep 17 00:00:00 2001 From: Aizistral Date: Thu, 18 Aug 2022 01:01:34 +0200 Subject: Relocate config classes into own package --- .../com/aizistral/nochatreports/NoChatReports.java | 2 +- .../nochatreports/NoChatReportsClient.java | 2 +- .../nochatreports/config/ModMenuIntegration.java | 174 +++++++++++++ .../nochatreports/config/NoReportsConfig.java | 284 +++++++++++++++++++++ .../nochatreports/core/ModMenuIntegration.java | 170 ------------ .../nochatreports/core/NoReportsConfig.java | 283 -------------------- .../nochatreports/core/ServerSafetyLevel.java | 1 + .../nochatreports/gui/UnsafeServerScreen.java | 2 +- .../mixins/client/MixinChatListener.java | 2 +- .../mixins/client/MixinChatScreen.java | 2 +- .../mixins/client/MixinClientTelemetryManager.java | 2 +- .../mixins/client/MixinConnectScreen.java | 2 +- .../mixins/client/MixinGuiMessageTag.java | 2 +- .../mixins/client/MixinJoinMultiplayerScreen.java | 2 +- .../mixins/client/MixinLocalPlayer.java | 2 +- .../mixins/client/MixinPlayerEntry.java | 2 +- .../mixins/client/MixinToastComponent.java | 2 +- .../server/MixinServerGamePacketListenerImpl.java | 4 +- .../mixins/server/MixinServerStatus.java | 2 +- .../mixins/server/MixinServerboundChatPacket.java | 2 +- 20 files changed, 475 insertions(+), 469 deletions(-) create mode 100644 src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java create mode 100644 src/main/java/com/aizistral/nochatreports/config/NoReportsConfig.java delete mode 100644 src/main/java/com/aizistral/nochatreports/core/ModMenuIntegration.java delete mode 100644 src/main/java/com/aizistral/nochatreports/core/NoReportsConfig.java (limited to 'src/main') diff --git a/src/main/java/com/aizistral/nochatreports/NoChatReports.java b/src/main/java/com/aizistral/nochatreports/NoChatReports.java index 7ea17d2..42a3159 100644 --- a/src/main/java/com/aizistral/nochatreports/NoChatReports.java +++ b/src/main/java/com/aizistral/nochatreports/NoChatReports.java @@ -3,7 +3,7 @@ package com.aizistral.nochatreports; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import com.aizistral.nochatreports.core.NoReportsConfig; +import com.aizistral.nochatreports.config.NoReportsConfig; import com.aizistral.nochatreports.network.ServerChannelHandler; import com.mojang.authlib.minecraft.UserApiService; import com.mojang.patchy.MojangBlockListSupplier; diff --git a/src/main/java/com/aizistral/nochatreports/NoChatReportsClient.java b/src/main/java/com/aizistral/nochatreports/NoChatReportsClient.java index e94e9b1..7cd88e3 100644 --- a/src/main/java/com/aizistral/nochatreports/NoChatReportsClient.java +++ b/src/main/java/com/aizistral/nochatreports/NoChatReportsClient.java @@ -2,8 +2,8 @@ package com.aizistral.nochatreports; import java.util.List; -import com.aizistral.nochatreports.core.NoReportsConfig; import com.aizistral.nochatreports.core.ServerSafetyState; +import com.aizistral.nochatreports.config.NoReportsConfig; import com.aizistral.nochatreports.core.ServerSafetyLevel; import com.aizistral.nochatreports.gui.UnsafeServerScreen; import com.aizistral.nochatreports.mixins.client.AccessorDisconnectedScreen; diff --git a/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java b/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java new file mode 100644 index 0000000..b2948c1 --- /dev/null +++ b/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java @@ -0,0 +1,174 @@ +package com.aizistral.nochatreports.config; + +import java.util.List; + +import com.aizistral.nochatreports.gui.FontHelper; +import com.terraformersmc.modmenu.api.ConfigScreenFactory; +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 net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Font; +import net.minecraft.client.resources.language.I18n; +import net.minecraft.locale.Language; +import net.minecraft.network.chat.ClickEvent; +import net.minecraft.network.chat.HoverEvent; +import net.minecraft.network.chat.Style; +import net.minecraft.util.FormattedCharSequence; +import net.minecraft.network.chat.Component; + +/** + * Implementation of ModMenu and ClothConfig support for the mod. + * + * @author MODKILLER1001 + */ + +@Environment(EnvType.CLIENT) +public class ModMenuIntegration implements ModMenuApi { + + private Component[] makeTooltip(String key) { + String localized = Language.getInstance().getOrDefault(key); + List list = FontHelper.wrap(Minecraft.getInstance().font, localized, 250); + Component[] tooltip = new Component[list.size()]; + + for (int i = 0; i < list.size(); i++) { + tooltip[i] = Component.literal(list.get(i)); + } + + return tooltip; + } + + @Override + public ConfigScreenFactory getModConfigScreenFactory() { + return screen -> { + + // Get the previous screen + ConfigBuilder builder = ConfigBuilder.create() + .setParentScreen(Minecraft.getInstance().screen) + .setTitle(Component.translatable("configuration.NoChatReports.config")); + + // Set category + ConfigCategory visual = builder.getOrCreateCategory(Component.translatable("configuration.NoChatReports.category.visual")); + ConfigCategory technical = builder.getOrCreateCategory(Component.translatable("configuration.NoChatReports.category.technical")); + ConfigCategory whitelistedServers = builder.getOrCreateCategory(Component.translatable("configuration.NoChatReports.category.whitelistedServers")); + + ConfigEntryBuilder entryBuilder = builder.entryBuilder(); + + // Set an option for showServerSafety + visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.showServerSafety"), NoReportsConfig.getInstance().showServerSafety) + .setDefaultValue(true) + .setTooltip(this.makeTooltip("option.NoChatReports.showServerSafety.tooltip")) + .setSaveConsumer(newValue -> NoReportsConfig.getInstance().showServerSafety = newValue) + .build()); + + // Add link for documentation for showServerSafety + visual.addEntry(entryBuilder.startTextDescription(Component.translatable("option.NoChatReports.showServerSafety.moreInfo") + .withStyle(s -> s + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.translatable("https://github.com/Aizistral-Studios/No-Chat-Reports/wiki/Configuration-Files/#option-showserversafety"))).withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://github.com/Aizistral-Studios/No-Chat-Reports/wiki/Configuration-Files/#option-showserversafety")))) + .build()); + + // Set an option for hideRedChatIndicators + visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.hideRedChatIndicators"), NoReportsConfig.getInstance().hideRedChatIndicators) + .setDefaultValue(true) + .setTooltip(this.makeTooltip("option.NoChatReports.hideRedChatIndicators.tooltip")) + .setSaveConsumer(newValue -> NoReportsConfig.getInstance().hideRedChatIndicators = newValue) + .build()); + + // Set an option for hideYellowChatIndicators + visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.hideYellowChatIndicators"), NoReportsConfig.getInstance().hideYellowChatIndicators) + .setDefaultValue(true) + .setTooltip(this.makeTooltip("option.NoChatReports.hideYellowChatIndicators.tooltip")) + .setSaveConsumer(newValue -> NoReportsConfig.getInstance().hideYellowChatIndicators = newValue) + .build()); + + // Set an option for hideGrayChatIndicators + visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.hideGrayChatIndicators"), NoReportsConfig.getInstance().hideGrayChatIndicators) + .setDefaultValue(true) + .setTooltip(this.makeTooltip("option.NoChatReports.hideGrayChatIndicators.tooltip")) + .setSaveConsumer(newValue -> NoReportsConfig.getInstance().hideGrayChatIndicators = newValue) + .build()); + + // Set an option for hideWarningToast + visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.hideWarningToast"), NoReportsConfig.getInstance().hideWarningToast) + .setDefaultValue(true) + .setTooltip(this.makeTooltip("option.NoChatReports.hideWarningToast.tooltip")) + .setSaveConsumer(newValue -> NoReportsConfig.getInstance().hideWarningToast = newValue) + .build()); + + // Set an option for alwaysHideReportButton + visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.alwaysHideReportButton"), NoReportsConfig.getInstance().alwaysHideReportButton) + .setDefaultValue(false) + .setTooltip(this.makeTooltip("option.NoChatReports.alwaysHideReportButton.tooltip")) + .setSaveConsumer(newValue -> NoReportsConfig.getInstance().alwaysHideReportButton = newValue) + .build()); + + // Set an option for demandOnServer + technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.demandOnServer"), NoReportsConfig.getInstance().demandOnServer) + .setDefaultValue(false) + .setTooltip(this.makeTooltip("option.NoChatReports.demandOnServer.tooltip")) + .setSaveConsumer(newValue -> NoReportsConfig.getInstance().demandOnServer = newValue) + .build()); + + // Set an option for enableDebugLog + technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.enableDebugLog"), NoReportsConfig.getInstance().enableDebugLog) + .setDefaultValue(false) + .setTooltip(this.makeTooltip("option.NoChatReports.enableDebugLog.tooltip")) + .setSaveConsumer(newValue -> NoReportsConfig.getInstance().enableDebugLog = newValue) + .build()); + + // Set an option for convertToGameMessage + technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.convertToGameMessage"), NoReportsConfig.getInstance().convertToGameMessage) + .setDefaultValue(false) + .setTooltip(this.makeTooltip("option.NoChatReports.convertToGameMessage.tooltip")) + .setSaveConsumer(newValue -> NoReportsConfig.getInstance().convertToGameMessage = newValue) + .build()); + + // Set an option for disableTelemetry + technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.disableTelemetry"), NoReportsConfig.getInstance().disableTelemetry) + .setDefaultValue(true) + .setTooltip(this.makeTooltip("option.NoChatReports.disableTelemetry.tooltip")) + .setSaveConsumer(newValue -> NoReportsConfig.getInstance().disableTelemetry = newValue) + .build()); + + // Set an option for showReloadButton + technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.showReloadButton"), NoReportsConfig.getInstance().showReloadButton) + .setDefaultValue(true) + .setTooltip(this.makeTooltip("option.NoChatReports.showReloadButton.tooltip")) + .setSaveConsumer(newValue -> NoReportsConfig.getInstance().showReloadButton = newValue) + .build()); + + // Set an option for whitelistAllServers + technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.whitelistAllServers"), NoReportsConfig.getInstance().whitelistAllServers) + .setDefaultValue(false) + .setTooltip(this.makeTooltip("option.NoChatReports.whitelistAllServers.tooltip")) + .setSaveConsumer(newValue -> NoReportsConfig.getInstance().whitelistAllServers = newValue) + .build()); + + // Instructions for adding servers + whitelistedServers.addEntry(entryBuilder.startTextDescription(Component.translatable("option.NoChatReports.whitelistedServers.instructions")) + .build()); + + // Add or remove whitelisted servers + whitelistedServers.addEntry(entryBuilder.startStrList(Component.translatable("option.NoChatReports.whitelistedServers"), NoReportsConfig.getInstance().whitelistedServers) + .setExpanded(true) + .setInsertInFront(true) + .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) + .build()); + + // Save config + builder.setSavingRunnable(() -> { + NoReportsConfig.saveConfig(); + NoReportsConfig.loadConfig(); + }); + return builder.build(); + }; + } + +} diff --git a/src/main/java/com/aizistral/nochatreports/config/NoReportsConfig.java b/src/main/java/com/aizistral/nochatreports/config/NoReportsConfig.java new file mode 100644 index 0000000..90059c1 --- /dev/null +++ b/src/main/java/com/aizistral/nochatreports/config/NoReportsConfig.java @@ -0,0 +1,284 @@ +package com.aizistral.nochatreports.config; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import javax.annotation.Nullable; + +import com.aizistral.nochatreports.NoChatReports; +import com.aizistral.nochatreports.core.ServerSafetyLevel; +import com.aizistral.nochatreports.gui.UnsafeServerScreen; +import com.aizistral.nochatreports.mixins.client.MixinChatListener; +import com.aizistral.nochatreports.mixins.client.MixinToastComponent; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; +import com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService; + +import net.fabricmc.loader.api.FabricLoader; +import net.minecraft.client.multiplayer.chat.ChatTrustLevel; +import net.minecraft.client.multiplayer.resolver.ServerAddress; +import net.minecraft.util.Tuple; + +/** + * Simple implementation of JSON-config for the mod. Can be loaded at any time and does not depend + * on modloader-specific API. The only disadvantage is that we don't get to comment options.

+ * + * For now, the config file is called NoChatReports.json and is located in default config + * folder. In the future this should be separated into client and server configs. + * + * @author Aizistral + */ + +public class NoReportsConfig { + private static final Path CONFIG_FILE = FabricLoader.getInstance().getConfigDir().resolve("NoChatReports.json"); + private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create(); + private static NoReportsConfig INSTANCE; + protected boolean demandOnClient = true, demandOnServer = false, enableDebugLog = false, + convertToGameMessage = false, showServerSafety = true, hideRedChatIndicators = true, + hideYellowChatIndicators = true, hideGrayChatIndicators = true, hideWarningToast = true, + alwaysHideReportButton = false, disableTelemetry = true, showReloadButton = true, + whitelistAllServers = false; + protected List whitelistedServers; + + protected static NoReportsConfig getInstance() { + if (INSTANCE == null) { + loadConfig(); + } + + return INSTANCE; + } + + /** + * Loads (or reloads) the config from local file, or creates default one if that fails. + * Re-searializes validated {@link #INSTANCE} object back into the file. + */ + + public static void loadConfig() { + NoChatReports.LOGGER.info(INSTANCE == null ? "Loading config..." : "Reloading config..."); + + INSTANCE = readFile(); + + if (INSTANCE == null) { + INSTANCE = new NoReportsConfig(); + } + + if (INSTANCE.whitelistedServers == null) { + INSTANCE.whitelistedServers = new ArrayList<>(); + } + + writeFile(INSTANCE); + } + + /** + * Writes current config instance into local file. + */ + + public static void saveConfig() { + if (INSTANCE != null) { + writeFile(INSTANCE); + } + } + + @Nullable + private static NoReportsConfig readFile() { + if (!Files.isRegularFile(CONFIG_FILE)) + return null; + + try (BufferedReader reader = Files.newBufferedReader(CONFIG_FILE)) { + return GSON.fromJson(reader, NoReportsConfig.class); + } catch (IOException ex) { + throw new RuntimeException(ex); + } + } + + private static void writeFile(NoReportsConfig instance) { + try (BufferedWriter writer = Files.newBufferedWriter(CONFIG_FILE)) { + GSON.toJson(instance, writer); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } + + /** + * @return True if server with No Chat Reports installed should demand that mod is present on + * every client that tries to join. Mod's installation on client is optional otherwise.

+ * + * This is false by default. + */ + + public static boolean demandsOnClient() { + return getInstance().demandOnClient; + } + + /** + * @return True if client with No Chat Reports installed should demand that mod is present on + * every server that it tries to join. In that case client will not be able to join servers that + * don't have the mod installed. Servers without the mod can still provide varying degrees of + * safety, which {@link ServerSafetyLevel} and respective icon in bottom-right corner of the chat + * screen is designed to indicate.

+ * + * This is false by default. + */ + + public static boolean demandsOnServer() { + return getInstance().demandOnServer; + } + + /** + * @return True if server should convert all player messages to system messages. System messages + * do not feature signatures and look completely identical in the chat, with exception of gray line + * next to them added in pre-release 3. They are also unselectable for chat reporting.

+ * + * This is false by default. + */ + + public static boolean convertToGameMessage() { + return getInstance().convertToGameMessage; + } + + /** + * @return True if current {@link ServerSafetyLevel} should be indicated on client by an icon in + * the bottom-right corner of chat screen.

+ * + * This is true by default. + */ + + public static boolean showServerSafety() { + return getInstance().showServerSafety; + } + + /** + * @return Current list of whitelisted unsafe servers. Used on client to remember which servers + * user disabled unsafety warnings for.

+ * + * This is empty by default. + * + * @see UnsafeServerScreen + */ + + public static List getWhitelistedServers() { + return getInstance().whitelistedServers; + } + + /** + * @param address Address of the server to be check. + * @return Whether this server is in the whitelist of unsafe servers, as returned by + * {@link #getWhitelistedServers()}. + * @see UnsafeServerScreen + */ + + public static boolean isWhitelistedServer(ServerAddress address) { + return getWhitelistedServers().contains(address.getHost() + ":" + address.getPort()); + } + + /** + * @return True if vanilla's unsigned messages trust indicator should be removed.

+ * + * This is true by default. + * + * @see MixinChatListener#onEvaluateTrustLevel + */ + + public static boolean hideRedChatIndicators() { + return getInstance().hideRedChatIndicators; + } + + /** + * @return True if vanilla's modified/hidden messages trust indicator should be removed.

+ * + * This is true by default. + * + * @see MixinChatListener#onEvaluateTrustLevel + */ + + public static boolean hideYellowChatIndicators() { + return getInstance().hideYellowChatIndicators; + } + + /** + * @return True if vanilla's system messages trust indicator should be removed.

+ * + * This is true by default. + * + * @see com.aizistral.nochatreports.mixins.client.MixinGuiMessageTag#onSystem + */ + + public static boolean hideGrayChatIndicators() { + return getInstance().hideGrayChatIndicators; + } + + /** + * @return True if "Chat messages can't be verified" toast should be removed.

+ * + * This is true by default. + * + * @see MixinToastComponent#onAddToast + */ + + public static boolean hideWarningToast() { + return getInstance().hideWarningToast; + } + + /** + * @return True if mod should log some additional information about its activity and message + * signatures. Generally only useful for debugging.

+ * + * This is false by default. + */ + + public static boolean isDebugLogEnabled() { + return getInstance().enableDebugLog; + } + + /** + * @return True if reporting buttons should always be hidden from social interactions screen, + * instead of simply being disabled.

+ * + * This is false by default. + */ + + public static boolean alwaysHideReportButton() { + return getInstance().alwaysHideReportButton; + } + + /** + * @return True if sending telemetry to Mojang should be disabled.

+ * + * This is true by default. + */ + + public static boolean disableTelemetry() { + return getInstance().disableTelemetry; + } + + /** + * @return True if the configuration reload button should be displayed in multiplayer screen. + *

+ * + * This is true by default. + */ + + public static boolean showReloadButton() { + return getInstance().showReloadButton; + } + + /** + * @return True if the full-screen warning should be skipped for servers that require chat signing, + * letting users simply join the server. Because of that, servers will no longer be added to the whitelist. + *

+ * + * This is false by default. + */ + + public static boolean whitelistAllServers() { + return getInstance().whitelistAllServers; + } + +} diff --git a/src/main/java/com/aizistral/nochatreports/core/ModMenuIntegration.java b/src/main/java/com/aizistral/nochatreports/core/ModMenuIntegration.java deleted file mode 100644 index c7724bb..0000000 --- a/src/main/java/com/aizistral/nochatreports/core/ModMenuIntegration.java +++ /dev/null @@ -1,170 +0,0 @@ -package com.aizistral.nochatreports.core; - -import java.util.List; - -import com.aizistral.nochatreports.gui.FontHelper; -import com.terraformersmc.modmenu.api.ConfigScreenFactory; -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 net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Font; -import net.minecraft.client.resources.language.I18n; -import net.minecraft.locale.Language; -import net.minecraft.network.chat.ClickEvent; -import net.minecraft.network.chat.HoverEvent; -import net.minecraft.network.chat.Style; -import net.minecraft.util.FormattedCharSequence; -import net.minecraft.network.chat.Component; - -/** - * Implementation of ModMenu and ClothConfig support for the mod. - * - * @author MODKILLER1001 - */ - -public class ModMenuIntegration implements ModMenuApi { - - private Component[] makeTooltip(String key) { - String localized = Language.getInstance().getOrDefault(key); - List list = FontHelper.wrap(Minecraft.getInstance().font, localized, 250); - Component[] tooltip = new Component[list.size()]; - - for (int i = 0; i < list.size(); i++) { - tooltip[i] = Component.literal(list.get(i)); - } - - return tooltip; - } - - @Override - public ConfigScreenFactory getModConfigScreenFactory() { - return screen -> { - - // Get the previous screen - ConfigBuilder builder = ConfigBuilder.create() - .setParentScreen(Minecraft.getInstance().screen) - .setTitle(Component.translatable("configuration.NoChatReports.config")); - - // Set category - ConfigCategory visual = builder.getOrCreateCategory(Component.translatable("configuration.NoChatReports.category.visual")); - ConfigCategory technical = builder.getOrCreateCategory(Component.translatable("configuration.NoChatReports.category.technical")); - ConfigCategory whitelistedServers = builder.getOrCreateCategory(Component.translatable("configuration.NoChatReports.category.whitelistedServers")); - - ConfigEntryBuilder entryBuilder = builder.entryBuilder(); - - // Set an option for showServerSafety - visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.showServerSafety"), NoReportsConfig.getInstance().showServerSafety) - .setDefaultValue(true) - .setTooltip(this.makeTooltip("option.NoChatReports.showServerSafety.tooltip")) - .setSaveConsumer(newValue -> NoReportsConfig.getInstance().showServerSafety = newValue) - .build()); - - // Add link for documentation for showServerSafety - visual.addEntry(entryBuilder.startTextDescription(Component.translatable("option.NoChatReports.showServerSafety.moreInfo") - .withStyle(s -> s - .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.translatable("https://github.com/Aizistral-Studios/No-Chat-Reports/wiki/Configuration-Files/#option-showserversafety"))).withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://github.com/Aizistral-Studios/No-Chat-Reports/wiki/Configuration-Files/#option-showserversafety")))) - .build()); - - // Set an option for hideRedChatIndicators - visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.hideRedChatIndicators"), NoReportsConfig.getInstance().hideRedChatIndicators) - .setDefaultValue(true) - .setTooltip(this.makeTooltip("option.NoChatReports.hideRedChatIndicators.tooltip")) - .setSaveConsumer(newValue -> NoReportsConfig.getInstance().hideRedChatIndicators = newValue) - .build()); - - // Set an option for hideYellowChatIndicators - visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.hideYellowChatIndicators"), NoReportsConfig.getInstance().hideYellowChatIndicators) - .setDefaultValue(true) - .setTooltip(this.makeTooltip("option.NoChatReports.hideYellowChatIndicators.tooltip")) - .setSaveConsumer(newValue -> NoReportsConfig.getInstance().hideYellowChatIndicators = newValue) - .build()); - - // Set an option for hideGrayChatIndicators - visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.hideGrayChatIndicators"), NoReportsConfig.getInstance().hideGrayChatIndicators) - .setDefaultValue(true) - .setTooltip(this.makeTooltip("option.NoChatReports.hideGrayChatIndicators.tooltip")) - .setSaveConsumer(newValue -> NoReportsConfig.getInstance().hideGrayChatIndicators = newValue) - .build()); - - // Set an option for hideWarningToast - visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.hideWarningToast"), NoReportsConfig.getInstance().hideWarningToast) - .setDefaultValue(true) - .setTooltip(this.makeTooltip("option.NoChatReports.hideWarningToast.tooltip")) - .setSaveConsumer(newValue -> NoReportsConfig.getInstance().hideWarningToast = newValue) - .build()); - - // Set an option for alwaysHideReportButton - visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.alwaysHideReportButton"), NoReportsConfig.getInstance().alwaysHideReportButton) - .setDefaultValue(false) - .setTooltip(this.makeTooltip("option.NoChatReports.alwaysHideReportButton.tooltip")) - .setSaveConsumer(newValue -> NoReportsConfig.getInstance().alwaysHideReportButton = newValue) - .build()); - - // Set an option for demandOnServer - technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.demandOnServer"), NoReportsConfig.getInstance().demandOnServer) - .setDefaultValue(false) - .setTooltip(this.makeTooltip("option.NoChatReports.demandOnServer.tooltip")) - .setSaveConsumer(newValue -> NoReportsConfig.getInstance().demandOnServer = newValue) - .build()); - - // Set an option for enableDebugLog - technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.enableDebugLog"), NoReportsConfig.getInstance().enableDebugLog) - .setDefaultValue(false) - .setTooltip(this.makeTooltip("option.NoChatReports.enableDebugLog.tooltip")) - .setSaveConsumer(newValue -> NoReportsConfig.getInstance().enableDebugLog = newValue) - .build()); - - // Set an option for convertToGameMessage - technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.convertToGameMessage"), NoReportsConfig.getInstance().convertToGameMessage) - .setDefaultValue(false) - .setTooltip(this.makeTooltip("option.NoChatReports.convertToGameMessage.tooltip")) - .setSaveConsumer(newValue -> NoReportsConfig.getInstance().convertToGameMessage = newValue) - .build()); - - // Set an option for disableTelemetry - technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.disableTelemetry"), NoReportsConfig.getInstance().disableTelemetry) - .setDefaultValue(true) - .setTooltip(this.makeTooltip("option.NoChatReports.disableTelemetry.tooltip")) - .setSaveConsumer(newValue -> NoReportsConfig.getInstance().disableTelemetry = newValue) - .build()); - - // Set an option for showReloadButton - technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.showReloadButton"), NoReportsConfig.getInstance().showReloadButton) - .setDefaultValue(true) - .setTooltip(this.makeTooltip("option.NoChatReports.showReloadButton.tooltip")) - .setSaveConsumer(newValue -> NoReportsConfig.getInstance().showReloadButton = newValue) - .build()); - - // Set an option for whitelistAllServers - technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.whitelistAllServers"), NoReportsConfig.getInstance().whitelistAllServers) - .setDefaultValue(false) - .setTooltip(this.makeTooltip("option.NoChatReports.whitelistAllServers.tooltip")) - .setSaveConsumer(newValue -> NoReportsConfig.getInstance().whitelistAllServers = newValue) - .build()); - - // Instructions for adding servers - whitelistedServers.addEntry(entryBuilder.startTextDescription(Component.translatable("option.NoChatReports.whitelistedServers.instructions")) - .build()); - - // Add or remove whitelisted servers - whitelistedServers.addEntry(entryBuilder.startStrList(Component.translatable("option.NoChatReports.whitelistedServers"), NoReportsConfig.getInstance().whitelistedServers) - .setExpanded(true) - .setInsertInFront(true) - .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) - .build()); - - // Save config - builder.setSavingRunnable(() -> { - NoReportsConfig.saveConfig(); - NoReportsConfig.loadConfig(); - }); - return builder.build(); - }; - } -} \ No newline at end of file diff --git a/src/main/java/com/aizistral/nochatreports/core/NoReportsConfig.java b/src/main/java/com/aizistral/nochatreports/core/NoReportsConfig.java deleted file mode 100644 index 97c8ade..0000000 --- a/src/main/java/com/aizistral/nochatreports/core/NoReportsConfig.java +++ /dev/null @@ -1,283 +0,0 @@ -package com.aizistral.nochatreports.core; - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import javax.annotation.Nullable; - -import com.aizistral.nochatreports.NoChatReports; -import com.aizistral.nochatreports.gui.UnsafeServerScreen; -import com.aizistral.nochatreports.mixins.client.MixinChatListener; -import com.aizistral.nochatreports.mixins.client.MixinToastComponent; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; -import com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService; - -import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.client.multiplayer.chat.ChatTrustLevel; -import net.minecraft.client.multiplayer.resolver.ServerAddress; -import net.minecraft.util.Tuple; - -/** - * Simple implementation of JSON-config for the mod. Can be loaded at any time and does not depend - * on modloader-specific API. The only disadvantage is that we don't get to comment options.

- * - * For now, the config file is called NoChatReports.json and is located in default config - * folder. In the future this should be separated into client and server configs. - * - * @author Aizistral - */ - -public class NoReportsConfig { - private static final Path CONFIG_FILE = FabricLoader.getInstance().getConfigDir().resolve("NoChatReports.json"); - private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create(); - private static NoReportsConfig INSTANCE; - protected boolean demandOnClient = true, demandOnServer = false, enableDebugLog = false, - convertToGameMessage = false, showServerSafety = true, hideRedChatIndicators = true, - hideYellowChatIndicators = true, hideGrayChatIndicators = true, hideWarningToast = true, - alwaysHideReportButton = false, disableTelemetry = true, showReloadButton = true, - whitelistAllServers = false; - protected List whitelistedServers; - - protected static NoReportsConfig getInstance() { - if (INSTANCE == null) { - loadConfig(); - } - - return INSTANCE; - } - - /** - * Loads (or reloads) the config from local file, or creates default one if that fails. - * Re-searializes validated {@link #INSTANCE} object back into the file. - */ - - public static void loadConfig() { - NoChatReports.LOGGER.info(INSTANCE == null ? "Loading config..." : "Reloading config..."); - - INSTANCE = readFile(); - - if (INSTANCE == null) { - INSTANCE = new NoReportsConfig(); - } - - if (INSTANCE.whitelistedServers == null) { - INSTANCE.whitelistedServers = new ArrayList<>(); - } - - writeFile(INSTANCE); - } - - /** - * Writes current config instance into local file. - */ - - public static void saveConfig() { - if (INSTANCE != null) { - writeFile(INSTANCE); - } - } - - @Nullable - private static NoReportsConfig readFile() { - if (!Files.isRegularFile(CONFIG_FILE)) - return null; - - try (BufferedReader reader = Files.newBufferedReader(CONFIG_FILE)) { - return GSON.fromJson(reader, NoReportsConfig.class); - } catch (IOException ex) { - throw new RuntimeException(ex); - } - } - - private static void writeFile(NoReportsConfig instance) { - try (BufferedWriter writer = Files.newBufferedWriter(CONFIG_FILE)) { - GSON.toJson(instance, writer); - } catch (Exception ex) { - throw new RuntimeException(ex); - } - } - - /** - * @return True if server with No Chat Reports installed should demand that mod is present on - * every client that tries to join. Mod's installation on client is optional otherwise.

- * - * This is false by default. - */ - - public static boolean demandsOnClient() { - return getInstance().demandOnClient; - } - - /** - * @return True if client with No Chat Reports installed should demand that mod is present on - * every server that it tries to join. In that case client will not be able to join servers that - * don't have the mod installed. Servers without the mod can still provide varying degrees of - * safety, which {@link ServerSafetyLevel} and respective icon in bottom-right corner of the chat - * screen is designed to indicate.

- * - * This is false by default. - */ - - public static boolean demandsOnServer() { - return getInstance().demandOnServer; - } - - /** - * @return True if server should convert all player messages to system messages. System messages - * do not feature signatures and look completely identical in the chat, with exception of gray line - * next to them added in pre-release 3. They are also unselectable for chat reporting.

- * - * This is false by default. - */ - - public static boolean convertToGameMessage() { - return getInstance().convertToGameMessage; - } - - /** - * @return True if current {@link ServerSafetyLevel} should be indicated on client by an icon in - * the bottom-right corner of chat screen.

- * - * This is true by default. - */ - - public static boolean showServerSafety() { - return getInstance().showServerSafety; - } - - /** - * @return Current list of whitelisted unsafe servers. Used on client to remember which servers - * user disabled unsafety warnings for.

- * - * This is empty by default. - * - * @see UnsafeServerScreen - */ - - public static List getWhitelistedServers() { - return getInstance().whitelistedServers; - } - - /** - * @param address Address of the server to be check. - * @return Whether this server is in the whitelist of unsafe servers, as returned by - * {@link #getWhitelistedServers()}. - * @see UnsafeServerScreen - */ - - public static boolean isWhitelistedServer(ServerAddress address) { - return getWhitelistedServers().contains(address.getHost() + ":" + address.getPort()); - } - - /** - * @return True if vanilla's unsigned messages trust indicator should be removed.

- * - * This is true by default. - * - * @see MixinChatListener#onEvaluateTrustLevel - */ - - public static boolean hideRedChatIndicators() { - return getInstance().hideRedChatIndicators; - } - - /** - * @return True if vanilla's modified/hidden messages trust indicator should be removed.

- * - * This is true by default. - * - * @see MixinChatListener#onEvaluateTrustLevel - */ - - public static boolean hideYellowChatIndicators() { - return getInstance().hideYellowChatIndicators; - } - - /** - * @return True if vanilla's system messages trust indicator should be removed.

- * - * This is true by default. - * - * @see com.aizistral.nochatreports.mixins.client.MixinGuiMessageTag#onSystem - */ - - public static boolean hideGrayChatIndicators() { - return getInstance().hideGrayChatIndicators; - } - - /** - * @return True if "Chat messages can't be verified" toast should be removed.

- * - * This is true by default. - * - * @see MixinToastComponent#onAddToast - */ - - public static boolean hideWarningToast() { - return getInstance().hideWarningToast; - } - - /** - * @return True if mod should log some additional information about its activity and message - * signatures. Generally only useful for debugging.

- * - * This is false by default. - */ - - public static boolean isDebugLogEnabled() { - return getInstance().enableDebugLog; - } - - /** - * @return True if reporting buttons should always be hidden from social interactions screen, - * instead of simply being disabled.

- * - * This is false by default. - */ - - public static boolean alwaysHideReportButton() { - return getInstance().alwaysHideReportButton; - } - - /** - * @return True if sending telemetry to Mojang should be disabled.

- * - * This is true by default. - */ - - public static boolean disableTelemetry() { - return getInstance().disableTelemetry; - } - - /** - * @return True if the configuration reload button should be displayed in multiplayer screen. - *

- * - * This is true by default. - */ - - public static boolean showReloadButton() { - return getInstance().showReloadButton; - } - - /** - * @return True if the full-screen warning should be skipped for servers that require chat signing, - * letting users simply join the server. Because of that, servers will no longer be added to the whitelist. - *

- * - * This is false by default. - */ - - public static boolean whitelistAllServers() { - return getInstance().whitelistAllServers; - } - -} diff --git a/src/main/java/com/aizistral/nochatreports/core/ServerSafetyLevel.java b/src/main/java/com/aizistral/nochatreports/core/ServerSafetyLevel.java index 2897c5a..db0485f 100644 --- a/src/main/java/com/aizistral/nochatreports/core/ServerSafetyLevel.java +++ b/src/main/java/com/aizistral/nochatreports/core/ServerSafetyLevel.java @@ -1,6 +1,7 @@ package com.aizistral.nochatreports.core; import com.aizistral.nochatreports.NoChatReports; +import com.aizistral.nochatreports.config.NoReportsConfig; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; diff --git a/src/main/java/com/aizistral/nochatreports/gui/UnsafeServerScreen.java b/src/main/java/com/aizistral/nochatreports/gui/UnsafeServerScreen.java index a7ce28a..bf52fcd 100644 --- a/src/main/java/com/aizistral/nochatreports/gui/UnsafeServerScreen.java +++ b/src/main/java/com/aizistral/nochatreports/gui/UnsafeServerScreen.java @@ -3,7 +3,7 @@ package com.aizistral.nochatreports.gui; import javax.print.attribute.standard.MediaSize.NA; import com.aizistral.nochatreports.NoChatReportsClient; -import com.aizistral.nochatreports.core.NoReportsConfig; +import com.aizistral.nochatreports.config.NoReportsConfig; import com.aizistral.nochatreports.core.ServerSafetyState; import net.fabricmc.api.EnvType; diff --git a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatListener.java b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatListener.java index 654d44a..331c4b5 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatListener.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatListener.java @@ -12,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import com.aizistral.nochatreports.NoChatReports; -import com.aizistral.nochatreports.core.NoReportsConfig; +import com.aizistral.nochatreports.config.NoReportsConfig; import net.minecraft.client.multiplayer.PlayerInfo; import net.minecraft.client.multiplayer.chat.ChatListener; diff --git a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatScreen.java b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatScreen.java index f0b4b34..81ccdab 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatScreen.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatScreen.java @@ -8,8 +8,8 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import com.aizistral.nochatreports.core.NoReportsConfig; import com.aizistral.nochatreports.core.ServerSafetyState; +import com.aizistral.nochatreports.config.NoReportsConfig; import com.aizistral.nochatreports.core.ServerSafetyLevel; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.BufferBuilder; diff --git a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinClientTelemetryManager.java b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinClientTelemetryManager.java index dc6f0e0..f7f7366 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinClientTelemetryManager.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinClientTelemetryManager.java @@ -1,6 +1,6 @@ package com.aizistral.nochatreports.mixins.client; -import com.aizistral.nochatreports.core.NoReportsConfig; +import com.aizistral.nochatreports.config.NoReportsConfig; import com.mojang.authlib.minecraft.TelemetrySession; import com.mojang.authlib.minecraft.UserApiService; diff --git a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinConnectScreen.java b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinConnectScreen.java index 6b3fcf1..fc15928 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinConnectScreen.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinConnectScreen.java @@ -7,7 +7,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import com.aizistral.nochatreports.NoChatReports; -import com.aizistral.nochatreports.core.NoReportsConfig; +import com.aizistral.nochatreports.config.NoReportsConfig; import com.aizistral.nochatreports.core.ServerSafetyLevel; import com.aizistral.nochatreports.core.ServerSafetyState; diff --git a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinGuiMessageTag.java b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinGuiMessageTag.java index 1edcf7e..083d5f6 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinGuiMessageTag.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinGuiMessageTag.java @@ -5,7 +5,7 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import com.aizistral.nochatreports.core.NoReportsConfig; +import com.aizistral.nochatreports.config.NoReportsConfig; import net.minecraft.client.GuiMessageTag; diff --git a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinJoinMultiplayerScreen.java b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinJoinMultiplayerScreen.java index e9f6395..3dd4a66 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinJoinMultiplayerScreen.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinJoinMultiplayerScreen.java @@ -8,7 +8,7 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import com.aizistral.nochatreports.core.NoReportsConfig; +import com.aizistral.nochatreports.config.NoReportsConfig; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.BufferBuilder; import com.mojang.blaze3d.vertex.BufferUploader; diff --git a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinLocalPlayer.java b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinLocalPlayer.java index 57ce4bb..a88c3da 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinLocalPlayer.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinLocalPlayer.java @@ -1,6 +1,6 @@ package com.aizistral.nochatreports.mixins.client; -import com.aizistral.nochatreports.core.NoReportsConfig; +import com.aizistral.nochatreports.config.NoReportsConfig; import com.aizistral.nochatreports.core.ServerSafetyState; import com.mojang.brigadier.ParseResults; diff --git a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinPlayerEntry.java b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinPlayerEntry.java index 4610f4d..ac98ce0 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinPlayerEntry.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinPlayerEntry.java @@ -12,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import com.aizistral.nochatreports.core.NoReportsConfig; +import com.aizistral.nochatreports.config.NoReportsConfig; import com.aizistral.nochatreports.core.ServerSafetyLevel; import com.aizistral.nochatreports.core.ServerSafetyState; import com.mojang.blaze3d.vertex.PoseStack; diff --git a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinToastComponent.java b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinToastComponent.java index 36cfe7e..8e67459 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinToastComponent.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinToastComponent.java @@ -5,7 +5,7 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import com.aizistral.nochatreports.core.NoReportsConfig; +import com.aizistral.nochatreports.config.NoReportsConfig; import net.minecraft.client.gui.components.toasts.SystemToast; import net.minecraft.client.gui.components.toasts.SystemToast.SystemToastIds; diff --git a/src/main/java/com/aizistral/nochatreports/mixins/server/MixinServerGamePacketListenerImpl.java b/src/main/java/com/aizistral/nochatreports/mixins/server/MixinServerGamePacketListenerImpl.java index 2226193..7726c1c 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/server/MixinServerGamePacketListenerImpl.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/server/MixinServerGamePacketListenerImpl.java @@ -1,7 +1,5 @@ package com.aizistral.nochatreports.mixins.server; -import com.aizistral.nochatreports.core.NoReportsConfig; - import net.minecraft.core.Registry; import net.minecraft.network.PacketSendListener; import net.minecraft.network.chat.ChatTypeDecoration; @@ -21,6 +19,8 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import com.aizistral.nochatreports.config.NoReportsConfig; + @Mixin(ServerGamePacketListenerImpl.class) public abstract class MixinServerGamePacketListenerImpl implements ServerPlayerConnection { @Shadow diff --git a/src/main/java/com/aizistral/nochatreports/mixins/server/MixinServerStatus.java b/src/main/java/com/aizistral/nochatreports/mixins/server/MixinServerStatus.java index 3a544d3..125f7ce 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/server/MixinServerStatus.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/server/MixinServerStatus.java @@ -7,7 +7,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import com.aizistral.nochatreports.core.NoReportsConfig; +import com.aizistral.nochatreports.config.NoReportsConfig; import net.minecraft.network.protocol.game.ClientboundServerDataPacket; import net.minecraft.network.protocol.status.ServerStatus; diff --git a/src/main/java/com/aizistral/nochatreports/mixins/server/MixinServerboundChatPacket.java b/src/main/java/com/aizistral/nochatreports/mixins/server/MixinServerboundChatPacket.java index 15cca37..54b297e 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/server/MixinServerboundChatPacket.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/server/MixinServerboundChatPacket.java @@ -10,7 +10,7 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import com.aizistral.nochatreports.core.NoReportsConfig; +import com.aizistral.nochatreports.config.NoReportsConfig; import java.util.UUID; -- cgit v1.2.3