diff options
Diffstat (limited to 'src/main/java/com/aizistral')
20 files changed, 77 insertions, 77 deletions
diff --git a/src/main/java/com/aizistral/nochatreports/NoChatReports.java b/src/main/java/com/aizistral/nochatreports/NoChatReports.java index b361852..c2f83de 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.config.NoReportsConfig; +import com.aizistral.nochatreports.config.NCRConfig; import com.aizistral.nochatreports.network.ServerChannelHandler; import com.mojang.authlib.minecraft.UserApiService; import com.mojang.patchy.MojangBlockListSupplier; @@ -39,12 +39,12 @@ public final class NoChatReports implements ModInitializer { ServerPlayNetworking.registerGlobalReceiver(CHANNEL, ServerChannelHandler.INSTANCE); ServerPlayConnectionEvents.JOIN.register(this::onPlayReady); - NoReportsConfig.loadConfig(); + NCRConfig.loadConfig(); } private void onPlayReady(ServerGamePacketListenerImpl handler, PacketSender sender, MinecraftServer server) { server.execute(() -> { - if (NoReportsConfig.demandsOnClient() && !ServerPlayNetworking.canSend(handler, CHANNEL)) { + if (NCRConfig.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 a3aab8a..a0ed8de 100644 --- a/src/main/java/com/aizistral/nochatreports/NoChatReportsClient.java +++ b/src/main/java/com/aizistral/nochatreports/NoChatReportsClient.java @@ -3,7 +3,7 @@ package com.aizistral.nochatreports; import java.util.List; import com.aizistral.nochatreports.core.ServerSafetyState; -import com.aizistral.nochatreports.config.NoReportsConfig; +import com.aizistral.nochatreports.config.NCRConfig; import com.aizistral.nochatreports.core.ServerSafetyLevel; import com.aizistral.nochatreports.gui.UnsafeServerScreen; import com.aizistral.nochatreports.mixins.client.AccessorDisconnectedScreen; @@ -70,7 +70,7 @@ public final class NoChatReportsClient implements ClientModInitializer { return; } else if (KEY_DISCONNECT_REASONS.contains(contents.getKey())) { if (ServerSafetyState.getLastServerAddress() != null) { - if (!NoReportsConfig.isWhitelistedServer(ServerSafetyState.getLastServerAddress()) && !NoReportsConfig.whitelistAllServers()) { + if (!NCRConfig.isWhitelistedServer(ServerSafetyState.getLastServerAddress()) && !NCRConfig.whitelistAllServers()) { client.setScreen(new UnsafeServerScreen()); } else { if (ServerSafetyState.getReconnectCount() <= 0) { @@ -106,7 +106,7 @@ public final class NoChatReportsClient implements ClientModInitializer { } } - if (NoReportsConfig.demandsOnServer() && !ClientPlayNetworking.canSend(NoChatReports.CHANNEL)) { + if (NCRConfig.demandsOnServer() && !ClientPlayNetworking.canSend(NoChatReports.CHANNEL)) { handler.getConnection().disconnect(Component.translatable("disconnect.nochatreports.client")); } }); diff --git a/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java b/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java index 4862ab9..5445ce4 100644 --- a/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java +++ b/src/main/java/com/aizistral/nochatreports/config/ModMenuIntegration.java @@ -62,10 +62,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"), NoReportsConfig.getInstance().showServerSafety) + visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.showServerSafety"), NCRConfig.getInstance().showServerSafety) .setDefaultValue(true) .setTooltip(this.makeTooltip("option.NoChatReports.showServerSafety.tooltip")) - .setSaveConsumer(newValue -> NoReportsConfig.getInstance().showServerSafety = newValue) + .setSaveConsumer(newValue -> NCRConfig.getInstance().showServerSafety = newValue) .build()); // Add link for documentation for showServerSafety @@ -75,80 +75,80 @@ public final class ModMenuIntegration implements ModMenuApi { .build()); // Set an option for hideRedChatIndicators - visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.hideRedChatIndicators"), NoReportsConfig.getInstance().hideRedChatIndicators) + visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.hideRedChatIndicators"), NCRConfig.getInstance().hideRedChatIndicators) .setDefaultValue(true) .setTooltip(this.makeTooltip("option.NoChatReports.hideRedChatIndicators.tooltip")) - .setSaveConsumer(newValue -> NoReportsConfig.getInstance().hideRedChatIndicators = newValue) + .setSaveConsumer(newValue -> NCRConfig.getInstance().hideRedChatIndicators = newValue) .build()); // Set an option for hideYellowChatIndicators - visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.hideYellowChatIndicators"), NoReportsConfig.getInstance().hideYellowChatIndicators) + visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.hideYellowChatIndicators"), NCRConfig.getInstance().hideYellowChatIndicators) .setDefaultValue(true) .setTooltip(this.makeTooltip("option.NoChatReports.hideYellowChatIndicators.tooltip")) - .setSaveConsumer(newValue -> NoReportsConfig.getInstance().hideYellowChatIndicators = newValue) + .setSaveConsumer(newValue -> NCRConfig.getInstance().hideYellowChatIndicators = newValue) .build()); // Set an option for hideGrayChatIndicators - visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.hideGrayChatIndicators"), NoReportsConfig.getInstance().hideGrayChatIndicators) + visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.hideGrayChatIndicators"), NCRConfig.getInstance().hideGrayChatIndicators) .setDefaultValue(true) .setTooltip(this.makeTooltip("option.NoChatReports.hideGrayChatIndicators.tooltip")) - .setSaveConsumer(newValue -> NoReportsConfig.getInstance().hideGrayChatIndicators = newValue) + .setSaveConsumer(newValue -> NCRConfig.getInstance().hideGrayChatIndicators = newValue) .build()); // Set an option for hideWarningToast - visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.hideWarningToast"), NoReportsConfig.getInstance().hideWarningToast) + visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.hideWarningToast"), NCRConfig.getInstance().hideWarningToast) .setDefaultValue(true) .setTooltip(this.makeTooltip("option.NoChatReports.hideWarningToast.tooltip")) - .setSaveConsumer(newValue -> NoReportsConfig.getInstance().hideWarningToast = newValue) + .setSaveConsumer(newValue -> NCRConfig.getInstance().hideWarningToast = newValue) .build()); // Set an option for alwaysHideReportButton - visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.alwaysHideReportButton"), NoReportsConfig.getInstance().alwaysHideReportButton) + visual.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.alwaysHideReportButton"), NCRConfig.getInstance().alwaysHideReportButton) .setDefaultValue(false) .setTooltip(this.makeTooltip("option.NoChatReports.alwaysHideReportButton.tooltip")) - .setSaveConsumer(newValue -> NoReportsConfig.getInstance().alwaysHideReportButton = newValue) + .setSaveConsumer(newValue -> NCRConfig.getInstance().alwaysHideReportButton = newValue) .build()); // Set an option for demandOnServer - technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.demandOnServer"), NoReportsConfig.getInstance().demandOnServer) + technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.demandOnServer"), NCRConfig.getInstance().demandOnServer) .setDefaultValue(false) .setTooltip(this.makeTooltip("option.NoChatReports.demandOnServer.tooltip")) - .setSaveConsumer(newValue -> NoReportsConfig.getInstance().demandOnServer = newValue) + .setSaveConsumer(newValue -> NCRConfig.getInstance().demandOnServer = newValue) .build()); // Set an option for enableDebugLog - technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.enableDebugLog"), NoReportsConfig.getInstance().enableDebugLog) + technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.enableDebugLog"), NCRConfig.getInstance().enableDebugLog) .setDefaultValue(false) .setTooltip(this.makeTooltip("option.NoChatReports.enableDebugLog.tooltip")) - .setSaveConsumer(newValue -> NoReportsConfig.getInstance().enableDebugLog = newValue) + .setSaveConsumer(newValue -> NCRConfig.getInstance().enableDebugLog = newValue) .build()); // Set an option for convertToGameMessage - technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.convertToGameMessage"), NoReportsConfig.getInstance().convertToGameMessage) + technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.convertToGameMessage"), NCRConfig.getInstance().convertToGameMessage) .setDefaultValue(false) .setTooltip(this.makeTooltip("option.NoChatReports.convertToGameMessage.tooltip")) - .setSaveConsumer(newValue -> NoReportsConfig.getInstance().convertToGameMessage = newValue) + .setSaveConsumer(newValue -> NCRConfig.getInstance().convertToGameMessage = newValue) .build()); // Set an option for disableTelemetry - technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.disableTelemetry"), NoReportsConfig.getInstance().disableTelemetry) + technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.disableTelemetry"), NCRConfig.getInstance().disableTelemetry) .setDefaultValue(true) .setTooltip(this.makeTooltip("option.NoChatReports.disableTelemetry.tooltip")) - .setSaveConsumer(newValue -> NoReportsConfig.getInstance().disableTelemetry = newValue) + .setSaveConsumer(newValue -> NCRConfig.getInstance().disableTelemetry = newValue) .build()); // Set an option for showReloadButton - technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.showReloadButton"), NoReportsConfig.getInstance().showReloadButton) + technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.showReloadButton"), NCRConfig.getInstance().showReloadButton) .setDefaultValue(true) .setTooltip(this.makeTooltip("option.NoChatReports.showReloadButton.tooltip")) - .setSaveConsumer(newValue -> NoReportsConfig.getInstance().showReloadButton = newValue) + .setSaveConsumer(newValue -> NCRConfig.getInstance().showReloadButton = newValue) .build()); // Set an option for whitelistAllServers - technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.whitelistAllServers"), NoReportsConfig.getInstance().whitelistAllServers) + technical.addEntry(entryBuilder.startBooleanToggle(Component.translatable("option.NoChatReports.whitelistAllServers"), NCRConfig.getInstance().whitelistAllServers) .setDefaultValue(false) .setTooltip(this.makeTooltip("option.NoChatReports.whitelistAllServers.tooltip")) - .setSaveConsumer(newValue -> NoReportsConfig.getInstance().whitelistAllServers = newValue) + .setSaveConsumer(newValue -> NCRConfig.getInstance().whitelistAllServers = newValue) .build()); // Instructions for adding servers @@ -156,21 +156,21 @@ public final class ModMenuIntegration implements ModMenuApi { .build()); // Add or remove whitelisted servers - whitelistedServers.addEntry(entryBuilder.startStrList(Component.translatable("option.NoChatReports.whitelistedServers"), NoReportsConfig.getInstance().whitelistedServers) + whitelistedServers.addEntry(entryBuilder.startStrList(Component.translatable("option.NoChatReports.whitelistedServers"), NCRConfig.getInstance().whitelistedServers) .setExpanded(true) .setInsertInFront(true) .setDefaultValue(DEFAULT_WHITELISTED_SERVERS) .setTooltip(this.makeTooltip("option.NoChatReports.whitelistedServers.tooltip")) .setAddButtonTooltip(Component.translatable("option.NoChatReports.whitelistedServers.addButtonTooltip")) .setRemoveButtonTooltip(Component.translatable("option.NoChatReports.whitelistedServers.removeButtonTooltip")) - .setSaveConsumer(newValue -> NoReportsConfig.getInstance().whitelistedServers = newValue) + .setSaveConsumer(newValue -> NCRConfig.getInstance().whitelistedServers = newValue) .setCreateNewInstance(baseListEntry -> new StringListListEntry.StringListCell(Language.getInstance().getOrDefault(("option.NoChatReports.whitelistedServers.serverAddress")), baseListEntry)) .build()); // Save config builder.setSavingRunnable(() -> { - NoReportsConfig.saveConfig(); - NoReportsConfig.loadConfig(); + NCRConfig.saveConfig(); + NCRConfig.loadConfig(); }); return builder.build(); }; diff --git a/src/main/java/com/aizistral/nochatreports/config/NoReportsConfig.java b/src/main/java/com/aizistral/nochatreports/config/NCRConfig.java index 4e903dc..7abf623 100644 --- a/src/main/java/com/aizistral/nochatreports/config/NoReportsConfig.java +++ b/src/main/java/com/aizistral/nochatreports/config/NCRConfig.java @@ -36,10 +36,10 @@ import net.minecraft.util.Tuple; * @author Aizistral */ -public final class NoReportsConfig { +public final class NCRConfig { 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; + private static NCRConfig INSTANCE; protected boolean demandOnClient = true, demandOnServer = false, enableDebugLog = false, convertToGameMessage = false, showServerSafety = true, hideRedChatIndicators = true, hideYellowChatIndicators = true, hideGrayChatIndicators = true, hideWarningToast = true, @@ -47,7 +47,7 @@ public final class NoReportsConfig { whitelistAllServers = false, addQueryData = true; protected List<String> whitelistedServers; - protected static NoReportsConfig getInstance() { + protected static NCRConfig getInstance() { if (INSTANCE == null) { loadConfig(); } @@ -66,7 +66,7 @@ public final class NoReportsConfig { INSTANCE = readFile(); if (INSTANCE == null) { - INSTANCE = new NoReportsConfig(); + INSTANCE = new NCRConfig(); } if (INSTANCE.whitelistedServers == null) { @@ -87,18 +87,18 @@ public final class NoReportsConfig { } @Nullable - private static NoReportsConfig readFile() { + private static NCRConfig readFile() { if (!Files.isRegularFile(CONFIG_FILE)) return null; try (BufferedReader reader = Files.newBufferedReader(CONFIG_FILE)) { - return GSON.fromJson(reader, NoReportsConfig.class); + return GSON.fromJson(reader, NCRConfig.class); } catch (IOException ex) { throw new RuntimeException(ex); } } - private static void writeFile(NoReportsConfig instance) { + private static void writeFile(NCRConfig instance) { try (BufferedWriter writer = Files.newBufferedWriter(CONFIG_FILE)) { GSON.toJson(instance, writer); } catch (Exception ex) { diff --git a/src/main/java/com/aizistral/nochatreports/core/ServerSafetyLevel.java b/src/main/java/com/aizistral/nochatreports/core/ServerSafetyLevel.java index db0485f..11d867f 100644 --- a/src/main/java/com/aizistral/nochatreports/core/ServerSafetyLevel.java +++ b/src/main/java/com/aizistral/nochatreports/core/ServerSafetyLevel.java @@ -1,7 +1,7 @@ package com.aizistral.nochatreports.core; import com.aizistral.nochatreports.NoChatReports; -import com.aizistral.nochatreports.config.NoReportsConfig; +import com.aizistral.nochatreports.config.NCRConfig; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; @@ -48,7 +48,7 @@ public enum ServerSafetyLevel { @Environment(EnvType.CLIENT) public Component getTooltip() { - if(NoReportsConfig.whitelistAllServers() && this.equals(ServerSafetyLevel.INSECURE)) + if(NCRConfig.whitelistAllServers() && this.equals(ServerSafetyLevel.INSECURE)) return Component.translatable("gui.nochatreports.status_insecure_whitelist_all_servers"); return Component.translatable("gui.nochatreports.status_" + this.name().toLowerCase()); } diff --git a/src/main/java/com/aizistral/nochatreports/gui/UnsafeServerScreen.java b/src/main/java/com/aizistral/nochatreports/gui/UnsafeServerScreen.java index 6e58036..a502529 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.config.NoReportsConfig; +import com.aizistral.nochatreports.config.NCRConfig; import com.aizistral.nochatreports.core.ServerSafetyState; import net.fabricmc.api.EnvType; @@ -52,8 +52,8 @@ public final class UnsafeServerScreen extends WarningScreen { if (address != null) { if (this.stopShowing.selected()) { - NoReportsConfig.getWhitelistedServers().add(address.getHost() + ":" + address.getPort()); - NoReportsConfig.saveConfig(); + NCRConfig.getWhitelistedServers().add(address.getHost() + ":" + address.getPort()); + NCRConfig.saveConfig(); } 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 0c767af..d5ac4a4 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.config.NoReportsConfig; +import com.aizistral.nochatreports.config.NCRConfig; import net.minecraft.client.multiplayer.PlayerInfo; import net.minecraft.client.multiplayer.chat.ChatListener; @@ -49,16 +49,16 @@ public class MixinChatListener { return; } - if (evaluate == ChatTrustLevel.NOT_SECURE && NoReportsConfig.hideRedChatIndicators()) { + if (evaluate == ChatTrustLevel.NOT_SECURE && NCRConfig.hideRedChatIndicators()) { info.setReturnValue(ChatTrustLevel.SECURE); } else if ((evaluate == ChatTrustLevel.FILTERED || evaluate == ChatTrustLevel.MODIFIED) - && NoReportsConfig.hideYellowChatIndicators()) { + && NCRConfig.hideYellowChatIndicators()) { info.setReturnValue(ChatTrustLevel.SECURE); } } // Debug never dies - if (NoReportsConfig.enableDebugLog()) { + if (NCRConfig.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/MixinChatScreen.java b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatScreen.java index 81ccdab..5bbf2f1 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatScreen.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinChatScreen.java @@ -9,7 +9,7 @@ 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.NoReportsConfig; +import com.aizistral.nochatreports.config.NCRConfig; import com.aizistral.nochatreports.core.ServerSafetyLevel; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.BufferBuilder; @@ -49,7 +49,7 @@ public abstract class MixinChatScreen extends Screen { @Inject(method = "init", at = @At("HEAD")) private void onInit(CallbackInfo info) { - if (!NoReportsConfig.showServerSafety()) + if (!NCRConfig.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 f7f7366..578478b 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.config.NoReportsConfig; +import com.aizistral.nochatreports.config.NCRConfig; import com.mojang.authlib.minecraft.TelemetrySession; import com.mojang.authlib.minecraft.UserApiService; @@ -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 (NoReportsConfig.disableTelemetry()) + if (NCRConfig.disableTelemetry()) return TelemetrySession.DISABLED; else return service.newTelemetrySession(executor); 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 36cca0b..981bd51 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.NoReportsConfig; +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 (NoReportsConfig.enableDebugLog()) { + if (NCRConfig.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 083d5f6..71671ef 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.NoReportsConfig; +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 (NoReportsConfig.hideGrayChatIndicators()) { + if (NCRConfig.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 3dd4a66..1c3ba06 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.NoReportsConfig; +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 (!NoReportsConfig.showReloadButton()) + if (!NCRConfig.showReloadButton()) return; var button = new ImageButton(this.width/2 + 158, this.height - 52, 20, 20, 0, 0, 20, RELOAD_TEXTURE, - 64, 64, btn -> NoReportsConfig.loadConfig(), (btn, poseStack, i, j) -> + 64, 64, btn -> NCRConfig.loadConfig(), (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 a88c3da..0d7e617 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.config.NoReportsConfig; +import com.aizistral.nochatreports.config.NCRConfig; 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 ac98ce0..6f47163 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.NoReportsConfig; +import com.aizistral.nochatreports.config.NCRConfig; import com.aizistral.nochatreports.core.ServerSafetyLevel; import com.aizistral.nochatreports.core.ServerSafetyState; import com.mojang.blaze3d.vertex.PoseStack; @@ -47,7 +47,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 (NoReportsConfig.alwaysHideReportButton()) { + if (NCRConfig.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/MixinServerStatusPinger$1.java b/src/main/java/com/aizistral/nochatreports/mixins/client/MixinServerStatusPinger$1.java index 69e8251..3552c07 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,7 +1,7 @@ package com.aizistral.nochatreports.mixins.client; import com.aizistral.nochatreports.NoChatReports; -import com.aizistral.nochatreports.config.NoReportsConfig; +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; @@ -31,7 +31,7 @@ public class MixinServerStatusPinger$1 { boolean preventsReports = ((ServerDataExtension) packet.getStatus()).preventsChatReports(); ((ServerDataExtension) this.val$data).setPreventsChatReports(preventsReports); - if (NoReportsConfig.enableDebugLog()) { + if (NCRConfig.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 8e67459..b233e19 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.NoReportsConfig; +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 (NoReportsConfig.hideWarningToast()) + if (NCRConfig.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 98a9d3d..6379fa6 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/common/MixinServerStatus.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/common/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.config.NoReportsConfig; +import com.aizistral.nochatreports.config.NCRConfig; import com.aizistral.nochatreports.core.ServerDataExtension; import net.minecraft.network.protocol.game.ClientboundServerDataPacket; @@ -34,7 +34,7 @@ public class MixinServerStatus implements ServerDataExtension { @Inject(method = "enforcesSecureChat", at = @At("HEAD"), cancellable = true) public void onSecureChatCheck(CallbackInfoReturnable<Boolean> info) { - if (NoReportsConfig.convertToGameMessage()) { + if (NCRConfig.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 acc710f..87c252d 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/common/MixinServerStatusSerializer.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/common/MixinServerStatusSerializer.java @@ -1,6 +1,6 @@ package com.aizistral.nochatreports.mixins.common; -import com.aizistral.nochatreports.config.NoReportsConfig; +import com.aizistral.nochatreports.config.NCRConfig; import com.aizistral.nochatreports.core.ServerDataExtension; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonElement; @@ -30,7 +30,7 @@ public class MixinServerStatusSerializer { at = @At("RETURN")) private void onSerialize(ServerStatus serverStatus, Type type, JsonSerializationContext context, CallbackInfoReturnable<JsonElement> info) { - if (!NoReportsConfig.addQueryData()) + if (!NCRConfig.addQueryData()) return; ((JsonObject) info.getReturnValue()).addProperty("preventsChatReports", true); 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 7726c1c..a6bb8e0 100644 --- a/src/main/java/com/aizistral/nochatreports/mixins/server/MixinServerGamePacketListenerImpl.java +++ b/src/main/java/com/aizistral/nochatreports/mixins/server/MixinServerGamePacketListenerImpl.java @@ -19,7 +19,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.NoReportsConfig; +import com.aizistral.nochatreports.config.NCRConfig; @Mixin(ServerGamePacketListenerImpl.class) public abstract class MixinServerGamePacketListenerImpl implements ServerPlayerConnection { @@ -35,7 +35,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 (NoReportsConfig.convertToGameMessage()) { + if (NCRConfig.convertToGameMessage()) { if (packet instanceof ClientboundPlayerChatHeaderPacket) { info.cancel(); } else if (packet instanceof ClientboundPlayerChatPacket chat) { @@ -57,7 +57,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 (NoReportsConfig.convertToGameMessage()) { + if (NCRConfig.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 54b297e..12d4a01 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.config.NoReportsConfig; +import com.aizistral.nochatreports.config.NCRConfig; import java.util.UUID; @@ -20,7 +20,7 @@ public class MixinServerboundChatPacket { /** * @reason Strip signatures before relaying messages to other clients, if they arrive signed * This is important for mod to be able to operate in server-only mode without - * {@link NoReportsConfig#convertToGameMessage()} enabled. + * {@link NCRConfig#convertToGameMessage()} enabled. * @author Aizistral */ |
