diff options
| author | Aizistral | 2022-08-26 19:59:07 +0200 |
|---|---|---|
| committer | Aizistral | 2022-08-26 19:59:07 +0200 |
| commit | 860c6640453c3a54b3c100a6e7c6793441049489 (patch) | |
| tree | 8c98cae8a9ec9321ca61597cc7b7054126e097c0 /src | |
| parent | bcff920cccfe3cfc800790fe14b0dc9ef96a61bc (diff) | |
Switch to new config
Diffstat (limited to 'src')
36 files changed, 144 insertions, 527 deletions
diff --git a/src/main/java/com/aizistral/nochatreports/NoChatReports.java b/src/main/java/com/aizistral/nochatreports/NoChatReports.java index d9f8daa..d716171 100644 --- a/src/main/java/com/aizistral/nochatreports/NoChatReports.java +++ b/src/main/java/com/aizistral/nochatreports/NoChatReports.java @@ -4,23 +4,13 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import com.aizistral.nochatreports.config.NCRConfig; -import com.aizistral.nochatreports.config.NCRConfigLegacy; import com.aizistral.nochatreports.network.ServerChannelHandler; -import com.mojang.authlib.minecraft.UserApiService; -import com.mojang.patchy.MojangBlockListSupplier; -import net.fabricmc.api.ClientModInitializer; -import net.fabricmc.api.EnvType; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.networking.v1.PacketSender; import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents; import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; -import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.DetectedVersion; -import net.minecraft.client.gui.screens.TitleScreen; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.PlayerChatMessage; -import net.minecraft.network.protocol.login.ServerboundHelloPacket; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; import net.minecraft.server.network.ServerGamePacketListenerImpl; @@ -40,13 +30,12 @@ public final class NoChatReports implements ModInitializer { ServerPlayNetworking.registerGlobalReceiver(CHANNEL, ServerChannelHandler.INSTANCE); ServerPlayConnectionEvents.JOIN.register(this::onPlayReady); - NCRConfigLegacy.loadConfig(); NCRConfig.load(); } private void onPlayReady(ServerGamePacketListenerImpl handler, PacketSender sender, MinecraftServer server) { server.execute(() -> { - if (NCRConfigLegacy.demandsOnClient() && !ServerPlayNetworking.canSend(handler, CHANNEL)) { + if (NCRConfig.getCommon().demandsOnClient() && !ServerPlayNetworking.canSend(handler, CHANNEL)) { handler.disconnect(Component.literal("You do not have No Chat Reports, and this server is configured to require it on client!")); } diff --git a/src/main/java/com/aizistral/nochatreports/NoChatReportsClient.java b/src/main/java/com/aizistral/nochatreports/NoChatReportsClient.java index c8f8e4e..4c69153 100644 --- a/src/main/java/com/aizistral/nochatreports/NoChatReportsClient.java +++ b/src/main/java/com/aizistral/nochatreports/NoChatReportsClient.java @@ -2,13 +2,12 @@ package com.aizistral.nochatreports; import java.util.List; -import com.aizistral.nochatreports.core.ServerSafetyState; -import com.aizistral.nochatreports.config.NCRConfigLegacy; +import com.aizistral.nochatreports.config.NCRConfig; import com.aizistral.nochatreports.core.ServerSafetyLevel; +import com.aizistral.nochatreports.core.ServerSafetyState; import com.aizistral.nochatreports.gui.UnsafeServerScreen; import com.aizistral.nochatreports.mixins.client.AccessorDisconnectedScreen; import com.aizistral.nochatreports.network.ClientChannelHandler; -import com.aizistral.nochatreports.network.ServerChannelHandler; import com.google.common.collect.ImmutableList; import net.fabricmc.api.ClientModInitializer; @@ -18,7 +17,6 @@ import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents; import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents; import net.fabricmc.fabric.api.networking.v1.PacketSender; -import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.ConnectScreen; import net.minecraft.client.gui.screens.DisconnectedScreen; @@ -29,8 +27,6 @@ import net.minecraft.client.multiplayer.ClientPacketListener; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.contents.TranslatableContents; -import net.minecraft.realms.RealmsConnect; -import net.minecraft.realms.RealmsScreen; /** * Client initializer for the mod. Some networking setup here, as well as few screen-related events. @@ -70,7 +66,7 @@ public final class NoChatReportsClient implements ClientModInitializer { return; } else if (KEY_DISCONNECT_REASONS.contains(contents.getKey())) { if (ServerSafetyState.getLastServerAddress() != null) { - if (!NCRConfigLegacy.isWhitelistedServer(ServerSafetyState.getLastServerAddress()) && !NCRConfigLegacy.whitelistAllServers()) { + if (!NCRConfig.getClient().isWhitelistedServer(ServerSafetyState.getLastServerAddress()) && !NCRConfig.getClient().whitelistAllServers()) { client.setScreen(new UnsafeServerScreen()); } else { if (ServerSafetyState.getReconnectCount() <= 0) { @@ -106,7 +102,7 @@ public final class NoChatReportsClient implements ClientModInitializer { } } - if (NCRConfigLegacy.demandsOnServer() && !ClientPlayNetworking.canSend(NoChatReports.CHANNEL)) { + if (NCRConfig.getClient().demandsOnServer() && !ClientPlayNetworking.canSend(NoChatReports.CHANNEL)) { handler.getConnection().disconnect(Component.translatable("disconnect.nochatreports.client")); } }); diff --git a/src/main/java/com/aizistral/nochatreports/config/JSONConfig.java b/src/main/java/com/aizistral/nochatreports/config/JSONConfig.java index 07d0b9a..eddc6e4 100644 --- a/src/main/java/com/aizistral/nochatreports/config/JSONConfig.java +++ b/src/main/java/com/aizistral/nochatreports/config/JSONConfig.java @@ -5,12 +5,9 @@ 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.Optional; import java.util.function.Supplier; -import javax.annotation.Nullable; - import com.aizistral.nochatreports.NoChatReports; import com.google.gson.ExclusionStrategy; import com.google.gson.FieldAttributes; diff --git a/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java b/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java index ffdee5c..a3abcfd 100644 --- a/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java +++ b/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java @@ -14,14 +14,10 @@ import me.shedaniel.clothconfig2.gui.entries.StringListListEntry; 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; +import net.minecraft.network.chat.HoverEvent; /** * Implementation of ModMenu and ClothConfig support for the mod. @@ -49,6 +45,8 @@ public final class ModMenuIntegration implements ModMenuApi { public ConfigScreenFactory<?> getModConfigScreenFactory() { return screen -> { + // TODO Sort config options into client and common instead of visual and technical + // Get the previous screen ConfigBuilder builder = ConfigBuilder.create() .setParentScreen(Minecraft.getInstance().screen) @@ -62,10 +60,10 @@ public final class ModMenuIntegration implements ModMenuApi { ConfigEntryBuilder entryBuilder = builder.entryBuilder(); // Set an option for showServerSafety - visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.showServerSafety"), NCRConfigLegacy.getInstance().showServerSafety) + visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.showServerSafety"), NCRConfig.getClient().showServerSafety) .setDefaultValue(true) .setTooltip(this.makeTooltip("option.NoChatReports.showServerSafety.tooltip")) - .setSaveConsumer(newValue -> NCRConfigLegacy.getInstance().showServerSafety = newValue) + .setSaveConsumer(newValue -> NCRConfig.getClient().showServerSafety = newValue) .build()); // Add link for documentation for showServerSafety @@ -75,80 +73,82 @@ public final class ModMenuIntegration implements ModMenuApi { .build()); // Set an option for hideRedChatIndicators - visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.hideRedChatIndicators"), NCRConfigLegacy.getInstance().hideRedChatIndicators) + visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.hideRedChatIndicators"), NCRConfig.getClient().hideRedChatIndicators) .setDefaultValue(true) .setTooltip(this.makeTooltip("option.NoChatReports.hideRedChatIndicators.tooltip")) - .setSaveConsumer(newValue -> NCRConfigLegacy.getInstance().hideRedChatIndicators = newValue) + .setSaveConsumer(newValue -> NCRConfig.getClient().hideRedChatIndicators = newValue) .build()); // Set an option for hideYellowChatIndicators - visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.hideYellowChatIndicators"), NCRConfigLegacy.getInstance().hideYellowChatIndicators) + visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.hideYellowChatIndicators"), NCRConfig.getClient().hideYellowChatIndicators) .setDefaultValue(true) .setTooltip(this.makeTooltip("option.NoChatReports.hideYellowChatIndicators.tooltip")) - .setSaveConsumer(newValue -> NCRConfigLegacy.getInstance().hideYellowChatIndicators = newValue) + .setSaveConsumer(newValue -> NCRConfig.getClient().hideYellowChatIndicators = newValue) .build()); // Set an option for hideGrayChatIndicators - visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.hideGrayChatIndicators"), NCRConfigLegacy.getInstance().hideGrayChatIndicators) + visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.hideGrayChatIndicators"), NCRConfig.getClient().hideGrayChatIndicators) .setDefaultValue(true) .setTooltip(this.makeTooltip("option.NoChatReports.hideGrayChatIndicators.tooltip")) - .setSaveConsumer(newValue -> NCRConfigLegacy.getInstance().hideGrayChatIndicators = newValue) + .setSaveConsumer(newValue -> NCRConfig.getClient().hideGrayChatIndicators = newValue) .build()); // Set an option for hideWarningToast - visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.hideWarningToast"), NCRConfigLegacy.getInstance().hideWarningToast) + visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.hideWarningToast"), NCRConfig.getClient().hideWarningToast) .setDefaultValue(true) .setTooltip(this.makeTooltip("option.NoChatReports.hideWarningToast.tooltip")) - .setSaveConsumer(newValue -> NCRConfigLegacy.getInstance().hideWarningToast = newValue) + .setSaveConsumer(newValue -> NCRConfig.getClient().hideWarningToast = newValue) .build()); // Set an option for alwaysHideReportButton - visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.alwaysHideReportButton"), NCRConfigLegacy.getInstance().alwaysHideReportButton) + visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.alwaysHideReportButton"), NCRConfig.getClient().alwaysHideReportButton) .setDefaultValue(false) .setTooltip(this.makeTooltip("option.NoChatReports.alwaysHideReportButton.tooltip")) - .setSaveConsumer(newValue -> NCRConfigLegacy.getInstance().alwaysHideReportButton = newValue) + .setSaveConsumer(newValue -> NCRConfig.getClient().alwaysHideReportButton = newValue) .build()); // Set an option for demandOnServer - technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.demandOnServer"), NCRConfigLegacy.getInstance().demandOnServer) + technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.demandOnServer"), NCRConfig.getClient().demandOnServer) .setDefaultValue(false) .setTooltip(this.makeTooltip("option.NoChatReports.demandOnServer.tooltip")) - .setSaveConsumer(newValue -> NCRConfigLegacy.getInstance().demandOnServer = newValue) + .setSaveConsumer(newValue -> NCRConfig.getClient().demandOnServer = newValue) .build()); + // TODO Where's the one for demandOnClient? + // Set an option for enableDebugLog - technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.enableDebugLog"), NCRConfigLegacy.getInstance().enableDebugLog) + technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.enableDebugLog"), NCRConfig.getCommon().enableDebugLog) .setDefaultValue(false) .setTooltip(this.makeTooltip("option.NoChatReports.enableDebugLog.tooltip")) - .setSaveConsumer(newValue -> NCRConfigLegacy.getInstance().enableDebugLog = newValue) + .setSaveConsumer(newValue -> NCRConfig.getCommon().enableDebugLog = newValue) .build()); // Set an option for convertToGameMessage - technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.convertToGameMessage"), NCRConfigLegacy.getInstance().convertToGameMessage) + technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.convertToGameMessage"), NCRConfig.getCommon().convertToGameMessage) .setDefaultValue(false) .setTooltip(this.makeTooltip("option.NoChatReports.convertToGameMessage.tooltip")) - .setSaveConsumer(newValue -> NCRConfigLegacy.getInstance().convertToGameMessage = newValue) + .setSaveConsumer(newValue -> NCRConfig.getCommon().convertToGameMessage = newValue) .build()); // Set an option for disableTelemetry - technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.disableTelemetry"), NCRConfigLegacy.getInstance().disableTelemetry) + technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.disableTelemetry"), NCRConfig.getClient().disableTelemetry) .setDefaultValue(true) .setTooltip(this.makeTooltip("option.NoChatReports.disableTelemetry.tooltip")) - .setSaveConsumer(newValue -> NCRConfigLegacy.getInstance().disableTelemetry = newValue) + .setSaveConsumer(newValue -> NCRConfig.getClient().disableTelemetry = newValue) .build()); // Set an option for showReloadButton - technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.showReloadButton"), NCRConfigLegacy.getInstance().showReloadButton) + technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.showReloadButton"), NCRConfig.getClient().showReloadButton) .setDefaultValue(true) .setTooltip(this.makeTooltip("option.NoChatReports.showReloadButton.tooltip")) - .setSaveConsumer(newValue -> NCRConfigLegacy.getInstance().showReloadButton = newValue) + .setSaveConsumer(newValue -> NCRConfig.getClient().showReloadButton = newValue) .build()); // Set an option for whitelistAllServers - technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.whitelistAllServers"), NCRConfigLegacy.getInstance().whitelistAllServers) + technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.whitelistAllServers"), NCRConfig.getClient().whitelistAllServers) .setDefaultValue(false) .setTooltip(this.makeTooltip("option.NoChatReports.whitelistAllServers.tooltip")) - .setSaveConsumer(newValue -> NCRConfigLegacy.getInstance().whitelistAllServers = newValue) + .setSaveConsumer(newValue -> NCRConfig.getClient().whitelistAllServers = newValue) .build()); // Instructions for adding servers @@ -156,22 +156,19 @@ public final class ModMenuIntegration implements ModMenuApi { .build()); // Add or remove whitelisted servers - whitelistedServers.addEntry(entryBuilder.startStrList(Component.translatable("option.NoChatReports.whitelistedServers"), NCRConfigLegacy.getInstance().whitelistedServers) + whitelistedServers.addEntry(entryBuilder.startStrList(Component.translatable("option.NoChatReports.whitelistedServers"), NCRConfig.getClient().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 -> NCRConfigLegacy.getInstance().whitelistedServers = newValue) + .setSaveConsumer(newValue -> NCRConfig.getClient().whitelistedServers = newValue) .setCreateNewInstance(baseListEntry -> new StringListListEntry.StringListCell(Language.getInstance().getOrDefault(("option.NoChatReports.whitelistedServers.serverAddress")), baseListEntry)) .build()); // Save config - builder.setSavingRunnable(() -> { - NCRConfigLegacy.saveConfig(); - NCRConfigLegacy.loadConfig(); - }); + builder.setSavingRunnable(NCRConfig::save); return builder.build(); }; } diff --git a/src/main/java/com/aizistral/nochatreports/config/NCRCommonConfig.java b/src/main/java/com/aizistral/nochatreports/config/NCRCommonConfig.java index cbb724d..d6c3251 100644 --- a/src/main/java/com/aizistral/nochatreports/config/NCRCommonConfig.java +++ b/src/main/java/com/aizistral/nochatreports/config/NCRCommonConfig.java @@ -1,15 +1,5 @@ package com.aizistral.nochatreports.config; -import java.nio.file.Path; -import java.util.List; - -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 net.minecraft.client.multiplayer.resolver.ServerAddress; - public final class NCRCommonConfig extends JSONConfig { protected static final String FILE_NAME = "NoChatReports/NCR-Common.json"; protected boolean demandOnClient = true, enableDebugLog = false, convertToGameMessage = false, diff --git a/src/main/java/com/aizistral/nochatreports/config/NCRConfig.java b/src/main/java/com/aizistral/nochatreports/config/NCRConfig.java index 13ce2a8..b86bef4 100644 --- a/src/main/java/com/aizistral/nochatreports/config/NCRConfig.java +++ b/src/main/java/com/aizistral/nochatreports/config/NCRConfig.java @@ -1,6 +1,5 @@ package com.aizistral.nochatreports.config; -import java.util.ArrayList; import java.util.Objects; import net.fabricmc.api.EnvType; @@ -15,7 +14,7 @@ public final class NCRConfig { throw new IllegalStateException("Can't touch this"); } - public static JSONConfig getCommon() { + public static NCRCommonConfig getCommon() { if (common == null) { load(); } @@ -24,7 +23,7 @@ public final class NCRConfig { } @Environment(EnvType.CLIENT) - public static JSONConfig getClient() { + public static NCRClientConfig getClient() { if (client == null) { load(); } diff --git a/src/main/java/com/aizistral/nochatreports/config/NCRConfigLegacy.java b/src/main/java/com/aizistral/nochatreports/config/NCRConfigLegacy.java deleted file mode 100644 index d0de3ab..0000000 --- a/src/main/java/com/aizistral/nochatreports/config/NCRConfigLegacy.java +++ /dev/null @@ -1,295 +0,0 @@ -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.<br><br> - * - * For now, the config file is called <code>NoChatReports.json</code> and is located in default config - * folder. In the future this should be separated into client and server configs. - * - * @author Aizistral - */ - -public final class NCRConfigLegacy { - private static final Path CONFIG_FILE = FabricLoader.getInstance().getConfigDir().resolve("NoChatReports.json"); - private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create(); - private static NCRConfigLegacy 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, addQueryData = true; - protected List<String> whitelistedServers; - - protected static NCRConfigLegacy 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 NCRConfigLegacy(); - } - - 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 NCRConfigLegacy readFile() { - if (!Files.isRegularFile(CONFIG_FILE)) - return null; - - try (BufferedReader reader = Files.newBufferedReader(CONFIG_FILE)) { - return GSON.fromJson(reader, NCRConfigLegacy.class); - } catch (IOException ex) { - throw new RuntimeException(ex); - } - } - - private static void writeFile(NCRConfigLegacy 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.<br><br> - * - * 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.<br><br> - * - * 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.<br><br> - * - * 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.<br><br> - * - * 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.<br><br> - * - * This is empty by default. - * - * @see UnsafeServerScreen - */ - - public static List<String> 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.<br><br> - * - * 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.<br><br> - * - * 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.<br><br> - * - * 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.<br><br> - * - * 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.<br><br> - * - * This is false by default. - */ - - public static boolean enableDebugLog() { - return getInstance().enableDebugLog; - } - - /** - * @return True if reporting buttons should always be hidden from social interactions screen, - * instead of simply being disabled.<br><br> - * - * This is false by default. - */ - - public static boolean alwaysHideReportButton() { - return getInstance().alwaysHideReportButton; - } - - /** - * @return True if sending telemetry to Mojang should be disabled.<br><br> - * - * 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. - * <br><br> - * - * 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. - * <br><br> - * - * This is false by default. - */ - - public static boolean whitelistAllServers() { - return getInstance().whitelistAllServers; - } - - /** - * @return True if server should include extra query data to help clients know that your server - * is secure.<br><br> - * - * This is true by default. - */ - - public static boolean addQueryData() { - return getInstance().addQueryData; - } - -} diff --git a/src/main/java/com/aizistral/nochatreports/core/ServerSafetyLevel.java b/src/main/java/com/aizistral/nochatreports/core/ServerSafetyLevel.java index 28a9edc..7454c45 100644 --- a/src/main/java/com/aizistral/nochatreports/core/ServerSafetyLevel.java +++ b/src/main/java/com/aizistral/nochatreports/core/ServerSafetyLevel.java @@ -1,12 +1,9 @@ package com.aizistral.nochatreports.core; -import com.aizistral.nochatreports.NoChatReports; -import com.aizistral.nochatreports.config.NCRConfigLegacy; +import com.aizistral.nochatreports.config.NCRConfig; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; -import net.minecraft.client.multiplayer.ClientPacketListener; import net.minecraft.network.chat.Component; /** @@ -48,8 +45,10 @@ public enum ServerSafetyLevel { @Environment(EnvType.CLIENT) public Component getTooltip() { - if(NCRConfigLegacy.whitelistAllServers() && this.equals(ServerSafetyLevel.INSECURE)) + if (NCRConfig.getClient().whitelistAllServers() && this.equals(ServerSafetyLevel.INSECURE)) return Component.translatable("gui.nochatreports.status_insecure_whitelist_all_servers"); - return Component.translatable("gui.nochatreports.status_" + this.name().toLowerCase()); + else + return Component.translatable("gui.nochatreports.status_" + this.name().toLowerCase()); } + } diff --git a/src/main/java/com/aizistral/nochatreports/core/ServerSafetyState.java b/src/main/java/com/aizistral/nochatreports/core/ServerSafetyState.java index 5f8b095..96e91eb 100644 --- a/src/main/java/com/aizistral/nochatreports/core/ServerSafetyState.java +++ b/src/main/java/com/aizistral/nochatreports/core/ServerSafetyState.java @@ -1,15 +1,11 @@ package com.aizistral.nochatreports.core; -import java.util.HashMap; -import java.util.Map; - import javax.annotation.Nullable; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.multiplayer.ServerData; import net.minecraft.client.multiplayer.resolver.ServerAddress; -import net.minecraft.util.Tuple; /** * All this global state is questionable, but we have to... diff --git a/src/main/java/com/aizistral/nochatreports/gui/FontHelper.java b/src/main/java/com/aizistral/nochatreports/gui/FontHelper.java index 838749b..a0a1638 100644 --- a/src/main/java/com/aizistral/nochatreports/gui/FontHelper.java +++ b/src/main/java/com/aizistral/nochatreports/gui/FontHelper.java @@ -5,7 +5,6 @@ import java.util.List; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; import net.minecraft.util.FormattedCharSequence; diff --git a/src/main/java/com/aizistral/nochatreports/gui/UnsafeServerScreen.java b/src/main/java/com/aizistral/nochatreports/gui/UnsafeServerScreen.java index 81af0ca..997ddd3 100644 --- a/src/main/java/com/aizistral/nochatreports/gui/UnsafeServerScreen.java +++ b/src/main/java/com/aizistral/nochatreports/gui/UnsafeServerScreen.java @@ -1,21 +1,17 @@ package com.aizistral.nochatreports.gui; -import javax.print.attribute.standard.MediaSize.NA; - import com.aizistral.nochatreports.NoChatReportsClient; -import com.aizistral.nochatreports.config.NCRConfigLegacy; +import com.aizistral.nochatreports.config.NCRConfig; import com.aizistral.nochatreports.core.ServerSafetyState; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.components.Button; -import net.minecraft.client.gui.screens.ConnectScreen; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.TitleScreen; import net.minecraft.client.gui.screens.multiplayer.JoinMultiplayerScreen; import net.minecraft.client.gui.screens.multiplayer.WarningScreen; -import net.minecraft.client.multiplayer.ServerData; import net.minecraft.client.multiplayer.resolver.ServerAddress; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; @@ -52,8 +48,8 @@ public final class UnsafeServerScreen extends WarningScreen { if (address != null) { if (this.stopShowing.selected()) { - NCRConfigLegacy.getWhitelistedServers().add(address.getHost() + ":" + address.getPort()); - NCRConfigLegacy.saveConfig(); + NCRConfig.getClient().getWhitelistedServers().add(address.getHost() + ":" + address.getPort()); + NCRConfig.getClient().saveFile(); } ServerSafetyState.setAllowsUnsafeServer(true); 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 705718a..05453c7 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatListener.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatListener.java @@ -8,11 +8,10 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; 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.NoChatReports; -import com.aizistral.nochatreports.config.NCRConfigLegacy; +import com.aizistral.nochatreports.config.NCRConfig; import net.minecraft.client.multiplayer.PlayerInfo; import net.minecraft.client.multiplayer.chat.ChatListener; @@ -49,16 +48,16 @@ public class MixinChatListener { return; } - if (evaluate == ChatTrustLevel.NOT_SECURE && NCRConfigLegacy.hideRedChatIndicators()) { + if (evaluate == ChatTrustLevel.NOT_SECURE && NCRConfig.getClient().hideRedChatIndicators()) { info.setReturnValue(ChatTrustLevel.SECURE); } else if ((evaluate == ChatTrustLevel.FILTERED || evaluate == ChatTrustLevel.MODIFIED) - && NCRConfigLegacy.hideYellowChatIndicators()) { + && NCRConfig.getClient().hideYellowChatIndicators()) { info.setReturnValue(ChatTrustLevel.SECURE); } } // Debug never dies - if (NCRConfigLegacy.enableDebugLog()) { + if (NCRConfig.getCommon().enableDebugLog()) { NoChatReports.LOGGER.info("Received message: {}, from: {}, signature: {}", Component.Serializer.toStableJson(playerChatMessage.serverContent()), playerChatMessage.signer().profileId(), diff --git a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatOptionsScreen.java b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatOptionsScreen.java index aecaaec..dab16ad 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatOptionsScreen.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatOptionsScreen.java @@ -1,6 +1,12 @@ package com.aizistral.nochatreports.mixins.client; +import java.util.List; + +import org.jetbrains.annotations.NotNull; +import org.spongepowered.asm.mixin.Mixin; + import com.mojang.blaze3d.vertex.PoseStack; + import net.minecraft.client.Minecraft; import net.minecraft.client.OptionInstance; import net.minecraft.client.Options; @@ -10,10 +16,6 @@ import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.SimpleOptionsSubScreen; import net.minecraft.network.chat.Component; import net.minecraft.util.FormattedCharSequence; -import org.jetbrains.annotations.NotNull; -import org.spongepowered.asm.mixin.Mixin; - -import java.util.List; @Mixin(ChatOptionsScreen.class) public class MixinChatOptionsScreen extends SimpleOptionsSubScreen { 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 5354885..123fb0a 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatScreen.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatScreen.java @@ -8,9 +8,9 @@ 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.ServerSafetyState; -import com.aizistral.nochatreports.config.NCRConfigLegacy; +import com.aizistral.nochatreports.config.NCRConfig; import com.aizistral.nochatreports.core.ServerSafetyLevel; +import com.aizistral.nochatreports.core.ServerSafetyState; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.BufferBuilder; import com.mojang.blaze3d.vertex.BufferUploader; @@ -20,9 +20,6 @@ import com.mojang.blaze3d.vertex.Tesselator; import com.mojang.blaze3d.vertex.VertexFormat; import com.mojang.math.Matrix4f; -import net.minecraft.client.OptionInstance; -import net.minecraft.client.OptionInstance.TooltipSupplierFactory; -import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.ImageButton; import net.minecraft.client.gui.screens.ChatScreen; import net.minecraft.client.gui.screens.Screen; @@ -49,7 +46,7 @@ public abstract class MixinChatScreen extends Screen { @Inject(method = "init", at = @At("HEAD")) private void onInit(CallbackInfo info) { - if (!NCRConfigLegacy.showServerSafety()) + if (!NCRConfig.getClient().showServerSafety()) return; ServerSafetyLevel trust = this.minecraft.isLocalServer() ? ServerSafetyLevel.SECURE : ServerSafetyState.getCurrent(); 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 a00620f..efbd9ed 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinClientTelemetryManager.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinClientTelemetryManager.java @@ -1,17 +1,17 @@ package com.aizistral.nochatreports.mixins.client; -import com.aizistral.nochatreports.config.NCRConfigLegacy; -import com.mojang.authlib.minecraft.TelemetrySession; -import com.mojang.authlib.minecraft.UserApiService; - -import net.minecraft.client.ClientTelemetryManager; - import java.util.concurrent.Executor; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; +import com.aizistral.nochatreports.config.NCRConfig; +import com.mojang.authlib.minecraft.TelemetrySession; +import com.mojang.authlib.minecraft.UserApiService; + +import net.minecraft.client.ClientTelemetryManager; + @Mixin(ClientTelemetryManager.class) public class MixinClientTelemetryManager { @@ -24,7 +24,7 @@ public class MixinClientTelemetryManager { + "newTelemetrySession(Ljava/util/concurrent/Executor;)Lcom/mojang/authlib/minecraft/TelemetrySession;", remap = false)) private TelemetrySession onCreateTelemetrySession(UserApiService service, Executor executor) { - if (NCRConfigLegacy.disableTelemetry()) + if (NCRConfig.getClient().disableTelemetry()) return TelemetrySession.DISABLED; else return service.newTelemetrySession(executor); diff --git a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinClientboundHelloPacket.java b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinClientboundHelloPacket.java index dfb94ad..36989e8 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinClientboundHelloPacket.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinClientboundHelloPacket.java @@ -4,7 +4,6 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; 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.ServerSafetyLevel; import com.aizistral.nochatreports.core.ServerSafetyState; 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 e310bbf..8d0a97c 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.config.NCRConfigLegacy; +import com.aizistral.nochatreports.config.NCRConfig; import com.aizistral.nochatreports.core.ServerSafetyLevel; import com.aizistral.nochatreports.core.ServerSafetyState; @@ -32,7 +32,7 @@ public class MixinConnectScreen { ServerSafetyState.updateCurrent(ServerSafetyLevel.UNKNOWN); // just to be 100% sure ServerSafetyState.setLastConnectedServer(serverAddress, serverData); - if (NCRConfigLegacy.enableDebugLog()) { + if (NCRConfig.getCommon().enableDebugLog()) { NoChatReports.LOGGER.info("Connecting to: {}, will expose public key: {}", serverAddress.getHost() + ":" + serverAddress.getPort(), ServerSafetyState.allowsUnsafeServer()); 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 322ef99..f6baf82 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.config.NCRConfigLegacy; +import com.aizistral.nochatreports.config.NCRConfig; import net.minecraft.client.GuiMessageTag; @@ -21,7 +21,7 @@ public class MixinGuiMessageTag { @Inject(method = "system", at = @At("HEAD"), cancellable = true) private static void onSystem(CallbackInfoReturnable<GuiMessageTag> info) { - if (NCRConfigLegacy.hideGrayChatIndicators()) { + if (NCRConfig.getClient().hideGrayChatIndicators()) { info.setReturnValue(null); } } 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 32de526..cb1122b 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.config.NCRConfigLegacy; +import com.aizistral.nochatreports.config.NCRConfig; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.BufferBuilder; import com.mojang.blaze3d.vertex.BufferUploader; @@ -45,11 +45,11 @@ public abstract class MixinJoinMultiplayerScreen extends Screen { @Inject(method = "init", at = @At("HEAD")) private void onInit(CallbackInfo info) { - if (!NCRConfigLegacy.showReloadButton()) + if (!NCRConfig.getClient().showReloadButton()) return; var button = new ImageButton(this.width/2 + 158, this.height - 52, 20, 20, 0, 0, 20, RELOAD_TEXTURE, - 64, 64, btn -> NCRConfigLegacy.loadConfig(), (btn, poseStack, i, j) -> + 64, 64, btn -> NCRConfig.load(), (btn, poseStack, i, j) -> this.renderTooltipNoGap(poseStack, this.minecraft.font.split(RELOAD_TOOLTIP, 250), i, j), Component.translatable("gui.nochatrepords.reload_config")); button.active = true; 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 61fa8b2..1f7d3be 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinLocalPlayer.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinLocalPlayer.java @@ -1,10 +1,15 @@ package com.aizistral.nochatreports.mixins.client; -import com.aizistral.nochatreports.config.NCRConfigLegacy; +import javax.annotation.Nullable; + +import org.spongepowered.asm.mixin.Mixin; +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.ServerSafetyState; import com.mojang.brigadier.ParseResults; -import net.minecraft.Util; import net.minecraft.client.player.LocalPlayer; import net.minecraft.commands.SharedSuggestionProvider; import net.minecraft.commands.arguments.ArgumentSignatures; @@ -13,17 +18,6 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.LastSeenMessages; import net.minecraft.network.chat.MessageSignature; import net.minecraft.network.chat.MessageSigner; -import net.minecraft.util.Crypt; -import net.minecraft.util.Crypt.SaltSignaturePair; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -import java.time.Instant; - -import javax.annotation.Nullable; @Mixin(LocalPlayer.class) public class MixinLocalPlayer { diff --git a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinOptions.java b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinOptions.java index 3c26b86..b6cde14 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinOptions.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinOptions.java @@ -1,16 +1,18 @@ package com.aizistral.nochatreports.mixins.client; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + import com.google.common.collect.ImmutableList; import com.mojang.serialization.Codec; + import net.minecraft.client.OptionInstance; import net.minecraft.client.Options; import net.minecraft.network.chat.CommonComponents; import net.minecraft.network.chat.Component; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(Options.class) public class MixinOptions { 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 d5e9d6d..03ae009 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.config.NCRConfigLegacy; +import com.aizistral.nochatreports.config.NCRConfig; import com.aizistral.nochatreports.core.ServerSafetyLevel; import com.aizistral.nochatreports.core.ServerSafetyState; import com.mojang.blaze3d.vertex.PoseStack; @@ -20,11 +20,9 @@ import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.ImageButton; -import net.minecraft.client.gui.screens.reporting.ChatReportScreen; import net.minecraft.client.gui.screens.social.PlayerEntry; import net.minecraft.client.gui.screens.social.SocialInteractionsScreen; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.FormattedCharSequence; @@ -47,7 +45,7 @@ public class MixinPlayerEntry { @Inject(method = "<init>", at = @At("RETURN")) private void onConstructed(Minecraft minecraft, SocialInteractionsScreen socialInteractionsScreen, UUID uUID, String string, Supplier<ResourceLocation> supplier, boolean reportable, CallbackInfo info) { - if (NCRConfigLegacy.alwaysHideReportButton()) { + if (NCRConfig.getClient().alwaysHideReportButton()) { this.reportButton = new Button(0, 0, 20, 20, Component.empty(), button -> {}) { @Override public void render(PoseStack poseStack, int i, int j, float f) { diff --git a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinProfileKeyPairManager.java b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinProfileKeyPairManager.java index 74a1f34..29a9383 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinProfileKeyPairManager.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinProfileKeyPairManager.java @@ -1,20 +1,20 @@ package com.aizistral.nochatreports.mixins.client; -import com.aizistral.nochatreports.NoChatReports; -import com.aizistral.nochatreports.core.ServerSafetyState; -import com.mojang.authlib.yggdrasil.response.KeyPairResponse; +import java.util.Optional; -import net.minecraft.client.multiplayer.ClientHandshakePacketListenerImpl; -import net.minecraft.client.multiplayer.ProfileKeyPairManager; -import net.minecraft.util.Signer; -import net.minecraft.world.entity.player.ProfilePublicKey; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Group; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import java.util.Optional; +import com.aizistral.nochatreports.core.ServerSafetyState; +import com.mojang.authlib.yggdrasil.response.KeyPairResponse; + +import net.minecraft.client.multiplayer.ClientHandshakePacketListenerImpl; +import net.minecraft.client.multiplayer.ProfileKeyPairManager; +import net.minecraft.util.Signer; +import net.minecraft.world.entity.player.ProfilePublicKey; @Mixin(ProfileKeyPairManager.class) public class MixinProfileKeyPairManager { diff --git a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinServerData.java b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinServerData.java index 761ba2c..b311e43 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinServerData.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinServerData.java @@ -1,14 +1,16 @@ package com.aizistral.nochatreports.mixins.client; -import com.aizistral.nochatreports.core.ServerDataExtension; -import net.minecraft.client.multiplayer.ServerData; -import net.minecraft.nbt.CompoundTag; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.LocalCapture; +import com.aizistral.nochatreports.core.ServerDataExtension; + +import net.minecraft.client.multiplayer.ServerData; +import net.minecraft.nbt.CompoundTag; + /** * Adds "preventsChatReports" property to {@link ServerData} and handles it during serialization to * and deserialization from NBT-tag. diff --git a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinServerStatusPinger$1.java b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinServerStatusPinger$1.java index e568d70..7da207f 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinServerStatusPinger$1.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinServerStatusPinger$1.java @@ -1,12 +1,5 @@ package com.aizistral.nochatreports.mixins.client; -import com.aizistral.nochatreports.NoChatReports; -import com.aizistral.nochatreports.config.NCRConfigLegacy; -import com.aizistral.nochatreports.core.ServerDataExtension; -import net.minecraft.client.multiplayer.ServerData; -import net.minecraft.network.protocol.status.ClientboundStatusResponsePacket; -import net.minecraft.network.protocol.status.ServerStatus; - import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -14,6 +7,14 @@ 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.NoChatReports; +import com.aizistral.nochatreports.config.NCRConfig; +import com.aizistral.nochatreports.core.ServerDataExtension; + +import net.minecraft.client.multiplayer.ServerData; +import net.minecraft.network.protocol.status.ClientboundStatusResponsePacket; +import net.minecraft.network.protocol.status.ServerStatus; + @Mixin(targets = "net/minecraft/client/multiplayer/ServerStatusPinger$1") public class MixinServerStatusPinger$1 { @Shadow @Final @@ -31,7 +32,7 @@ public class MixinServerStatusPinger$1 { boolean preventsReports = ((ServerDataExtension) packet.getStatus()).preventsChatReports(); ((ServerDataExtension) this.val$data).setPreventsChatReports(preventsReports); - if (NCRConfigLegacy.enableDebugLog()) { + if (NCRConfig.getCommon().enableDebugLog()) { NoChatReports.LOGGER.info("Received status response packet from server, preventsChatReports: {}", preventsReports); } 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 e4a2197..601ccef 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.config.NCRConfigLegacy; +import com.aizistral.nochatreports.config.NCRConfig; import net.minecraft.client.gui.components.toasts.SystemToast; import net.minecraft.client.gui.components.toasts.SystemToast.SystemToastIds; @@ -17,7 +17,7 @@ public class MixinToastComponent { @Inject(method = "addToast", at = @At("HEAD"), cancellable = true) private void onAddToast(Toast toast, CallbackInfo info) { - if (NCRConfigLegacy.hideWarningToast()) + if (NCRConfig.getClient().hideWarningToast()) if (toast instanceof SystemToast sys && sys.getToken() == SystemToastIds.UNSECURE_SERVER_WARNING) { info.cancel(); } diff --git a/src/main/java/com/aizistral/nochatreports/mixins/common/MixinServerStatus.java b/src/main/java/com/aizistral/nochatreports/mixins/common/MixinServerStatus.java index 8a3901c..9268092 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/common/MixinServerStatus.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/common/MixinServerStatus.java @@ -1,19 +1,14 @@ package com.aizistral.nochatreports.mixins.common; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; 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.config.NCRConfigLegacy; +import com.aizistral.nochatreports.config.NCRConfig; import com.aizistral.nochatreports.core.ServerDataExtension; -import net.minecraft.network.protocol.game.ClientboundServerDataPacket; import net.minecraft.network.protocol.status.ServerStatus; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.server.network.ServerGamePacketListenerImpl; @Mixin(ServerStatus.class) public class MixinServerStatus implements ServerDataExtension { @@ -34,7 +29,7 @@ public class MixinServerStatus implements ServerDataExtension { @Inject(method = "enforcesSecureChat", at = @At("HEAD"), cancellable = true) public void onSecureChatCheck(CallbackInfoReturnable<Boolean> info) { - if (NCRConfigLegacy.convertToGameMessage()) { + if (NCRConfig.getCommon().convertToGameMessage()) { info.setReturnValue(true); } } diff --git a/src/main/java/com/aizistral/nochatreports/mixins/common/MixinServerStatusSerializer.java b/src/main/java/com/aizistral/nochatreports/mixins/common/MixinServerStatusSerializer.java index 140c52c..f8a9009 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/common/MixinServerStatusSerializer.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/common/MixinServerStatusSerializer.java @@ -1,19 +1,22 @@ package com.aizistral.nochatreports.mixins.common; -import com.aizistral.nochatreports.config.NCRConfigLegacy; +import java.lang.reflect.Type; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import org.spongepowered.asm.mixin.injection.callback.LocalCapture; + +import com.aizistral.nochatreports.config.NCRConfig; import com.aizistral.nochatreports.core.ServerDataExtension; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonSerializationContext; + import net.minecraft.network.protocol.status.ServerStatus; import net.minecraft.util.GsonHelper; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; -import java.lang.reflect.Type; /** * Handles "preventsChatReports" property during serialization and deserialization of {@link ServerStatus}. @@ -30,7 +33,7 @@ public class MixinServerStatusSerializer { at = @At("RETURN")) private void onSerialize(ServerStatus serverStatus, Type type, JsonSerializationContext context, CallbackInfoReturnable<JsonElement> info) { - if (!NCRConfigLegacy.addQueryData()) + if (!NCRConfig.getCommon().addQueryData()) return; ((JsonObject) info.getReturnValue()).addProperty("preventsChatReports", true); diff --git a/src/main/java/com/aizistral/nochatreports/mixins/server/MixinDedicatedServer.java b/src/main/java/com/aizistral/nochatreports/mixins/server/MixinDedicatedServer.java index 2ec92b7..75a1b7b 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/server/MixinDedicatedServer.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/server/MixinDedicatedServer.java @@ -1,11 +1,12 @@ package com.aizistral.nochatreports.mixins.server; -import net.minecraft.server.dedicated.DedicatedServer; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import net.minecraft.server.dedicated.DedicatedServer; + @Mixin(DedicatedServer.class) public class MixinDedicatedServer { diff --git a/src/main/java/com/aizistral/nochatreports/mixins/server/MixinPlayer.java b/src/main/java/com/aizistral/nochatreports/mixins/server/MixinPlayer.java index 780d93c..1065a5a 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/server/MixinPlayer.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/server/MixinPlayer.java @@ -1,14 +1,13 @@ package com.aizistral.nochatreports.mixins.server; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.entity.player.ProfilePublicKey; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.player.ProfilePublicKey; + @Mixin(Player.class) public class MixinPlayer { 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 099264c..7d9df00 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/server/MixinServerGamePacketListenerImpl.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/server/MixinServerGamePacketListenerImpl.java @@ -1,9 +1,15 @@ package com.aizistral.nochatreports.mixins.server; -import net.minecraft.core.Registry; +import org.jetbrains.annotations.Nullable; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +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.NCRConfig; + import net.minecraft.network.PacketSendListener; -import net.minecraft.network.chat.ChatTypeDecoration; -import net.minecraft.network.chat.Component; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.game.ClientboundPlayerChatHeaderPacket; import net.minecraft.network.protocol.game.ClientboundPlayerChatPacket; @@ -12,15 +18,6 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.network.ServerGamePacketListenerImpl; import net.minecraft.server.network.ServerPlayerConnection; -import org.jetbrains.annotations.Nullable; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -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.NCRConfigLegacy; - @Mixin(ServerGamePacketListenerImpl.class) public abstract class MixinServerGamePacketListenerImpl implements ServerPlayerConnection { @Shadow @@ -35,7 +32,7 @@ public abstract class MixinServerGamePacketListenerImpl implements ServerPlayerC @Inject(method = "send(Lnet/minecraft/network/protocol/Packet;)V", at = @At("HEAD"), cancellable = true) private void onSend(Packet<?> packet, CallbackInfo info) { - if (NCRConfigLegacy.convertToGameMessage()) { + if (NCRConfig.getCommon().convertToGameMessage()) { if (packet instanceof ClientboundPlayerChatHeaderPacket) { info.cancel(); } else if (packet instanceof ClientboundPlayerChatPacket chat) { @@ -57,7 +54,7 @@ public abstract class MixinServerGamePacketListenerImpl implements ServerPlayerC @Inject(method = "send(Lnet/minecraft/network/protocol/Packet;Lnet/minecraft/network/PacketSendListener;)V", at = @At("HEAD"), cancellable = true) private void onSend(Packet<?> packet, @Nullable PacketSendListener packetSendListener, CallbackInfo info) { - if (NCRConfigLegacy.convertToGameMessage()) { + if (NCRConfig.getCommon().convertToGameMessage()) { if (packet instanceof ClientboundPlayerChatHeaderPacket) { info.cancel(); } else if (packet instanceof ClientboundPlayerChatPacket chat && packetSendListener != null) { 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 2b48bb9..d9332c1 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/server/MixinServerboundChatPacket.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/server/MixinServerboundChatPacket.java @@ -1,18 +1,12 @@ package com.aizistral.nochatreports.mixins.server; -import net.minecraft.Util; -import net.minecraft.network.chat.MessageSignature; -import net.minecraft.network.protocol.game.ServerboundChatPacket; -import net.minecraft.util.Crypt.SaltSignaturePair; - import org.spongepowered.asm.mixin.Mixin; 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.config.NCRConfigLegacy; - -import java.util.UUID; +import net.minecraft.network.chat.MessageSignature; +import net.minecraft.network.protocol.game.ServerboundChatPacket; @Mixin(ServerboundChatPacket.class) public class MixinServerboundChatPacket { diff --git a/src/main/java/com/aizistral/nochatreports/network/ClientChannelHandler.java b/src/main/java/com/aizistral/nochatreports/network/ClientChannelHandler.java index 4b3c001..58c4734 100644 --- a/src/main/java/com/aizistral/nochatreports/network/ClientChannelHandler.java +++ b/src/main/java/com/aizistral/nochatreports/network/ClientChannelHandler.java @@ -7,9 +7,6 @@ import net.fabricmc.fabric.api.networking.v1.PacketSender; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientPacketListener; import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.server.network.ServerGamePacketListenerImpl; /** * Mod's client channel handler. So far just passively exists. diff --git a/src/test/java/com/aizistral/nochatreports/debug/NoChatReportsDebug.java b/src/test/java/com/aizistral/nochatreports/debug/NoChatReportsDebug.java index 4922068..ca52aec 100644 --- a/src/test/java/com/aizistral/nochatreports/debug/NoChatReportsDebug.java +++ b/src/test/java/com/aizistral/nochatreports/debug/NoChatReportsDebug.java @@ -2,33 +2,13 @@ package com.aizistral.nochatreports.debug; import java.util.UUID; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - import com.aizistral.nochatreports.NoChatReports; -import com.aizistral.nochatreports.config.NCRConfigLegacy; -import com.aizistral.nochatreports.network.ServerChannelHandler; -import com.mojang.authlib.GameProfile; import com.mojang.authlib.minecraft.BanDetails; -import com.mojang.authlib.minecraft.UserApiService; -import net.fabricmc.api.ClientModInitializer; -import net.fabricmc.api.EnvType; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.networking.v1.PacketSender; import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents; -import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; -import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.screens.TitleScreen; -import net.minecraft.client.gui.screens.reporting.ChatReportScreen; -import net.minecraft.network.chat.Component; -import net.minecraft.network.protocol.game.ClientboundPlayerInfoPacket; -import net.minecraft.network.protocol.game.ClientboundPlayerInfoPacket.Action; -import net.minecraft.network.protocol.game.ClientboundPlayerInfoPacket.PlayerUpdate; -import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; -import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.network.ServerGamePacketListenerImpl; public final class NoChatReportsDebug implements ModInitializer { diff --git a/src/test/java/com/aizistral/nochatreports/debug/ReportWriter.java b/src/test/java/com/aizistral/nochatreports/debug/ReportWriter.java index e532b56..538841b 100644 --- a/src/test/java/com/aizistral/nochatreports/debug/ReportWriter.java +++ b/src/test/java/com/aizistral/nochatreports/debug/ReportWriter.java @@ -1,9 +1,6 @@ package com.aizistral.nochatreports.debug; import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.util.Date; @@ -13,7 +10,6 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.ibm.icu.text.SimpleDateFormat; import com.mojang.authlib.minecraft.client.ObjectMapper; -import com.mojang.authlib.minecraft.report.AbuseReport; import com.mojang.authlib.yggdrasil.request.AbuseReportRequest; import net.fabricmc.loader.api.FabricLoader; diff --git a/src/test/java/com/aizistral/nochatreports/debug/UnrealPlayer.java b/src/test/java/com/aizistral/nochatreports/debug/UnrealPlayer.java index 78c97d4..8f9cf4e 100644 --- a/src/test/java/com/aizistral/nochatreports/debug/UnrealPlayer.java +++ b/src/test/java/com/aizistral/nochatreports/debug/UnrealPlayer.java @@ -9,7 +9,6 @@ import javax.annotation.Nullable; import com.mojang.authlib.GameProfile; import net.minecraft.network.chat.ChatMessageContent; -import net.minecraft.network.chat.ChatSender; import net.minecraft.network.chat.ChatType; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.FilterMask; @@ -24,7 +23,6 @@ import net.minecraft.network.protocol.game.ClientboundPlayerInfoPacket.Action; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.network.ServerGamePacketListenerImpl; -import net.minecraft.util.Crypt; /** * Exists solely to help with testing some of the features of the mod. |
