From 4fff71b2acf6d02f0c6cdc96c6e73cf482246e74 Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Fri, 10 Nov 2023 14:44:41 +0100 Subject: [PATCH] pls gimme regex --- build.gradle | 5 +++-- .../java/de/cscherr/mcpht/config/MCPHTConfig.java | 12 ++++++++---- .../mcpht/mixin/client/NetworkPacketLogMixin.java | 14 +++++--------- src/main/resources/.accesswidener | 4 ---- src/main/resources/fabric.mod.json | 3 +-- 5 files changed, 17 insertions(+), 21 deletions(-) delete mode 100644 src/main/resources/.accesswidener diff --git a/build.gradle b/build.gradle index 0a14e1c..65d76fd 100644 --- a/build.gradle +++ b/build.gradle @@ -3,6 +3,9 @@ plugins { id 'maven-publish' } +sourceCompatibility = JavaVersion.VERSION_17 +targetCompatibility = JavaVersion.VERSION_17 + version = project.mod_version group = project.maven_group @@ -29,8 +32,6 @@ loom { sourceSet sourceSets.client } } - accessWidenerPath = file("src/main/resources/.accesswidener") - } dependencies { diff --git a/src/client/java/de/cscherr/mcpht/config/MCPHTConfig.java b/src/client/java/de/cscherr/mcpht/config/MCPHTConfig.java index 404009c..79ef046 100644 --- a/src/client/java/de/cscherr/mcpht/config/MCPHTConfig.java +++ b/src/client/java/de/cscherr/mcpht/config/MCPHTConfig.java @@ -1,12 +1,11 @@ package de.cscherr.mcpht.config; import de.cscherr.mcpht.MCPHTClient; -import joptsimple.util.RegexMatcher; +import de.cscherr.mcpht.mixin.client.NetworkPacketLogMixin; import me.shedaniel.autoconfig.ConfigData; import me.shedaniel.autoconfig.annotation.Config; import me.shedaniel.autoconfig.annotation.ConfigEntry; import java.util.regex.Pattern; -import java.util.regex.Matcher; @Config(name = "mcphtconf") public class MCPHTConfig implements ConfigData { @@ -25,7 +24,12 @@ public class MCPHTConfig implements ConfigData { } private void compileFilter() { - this.networkLogging.filter = Pattern.compile(this.networkLogging.regex); + try { + this.networkLogging.pattern = Pattern.compile(".*"); + } + catch (Exception e) { + MCPHTClient.LOGGER.error(e.getMessage()); + } } public static class NetworkLoggingScheme { @@ -38,6 +42,6 @@ public class MCPHTConfig implements ConfigData { NAME } @ConfigEntry.Gui.Excluded - public Pattern filter; + public Pattern pattern; } } diff --git a/src/client/java/de/cscherr/mcpht/mixin/client/NetworkPacketLogMixin.java b/src/client/java/de/cscherr/mcpht/mixin/client/NetworkPacketLogMixin.java index 80a0f6a..91d5332 100644 --- a/src/client/java/de/cscherr/mcpht/mixin/client/NetworkPacketLogMixin.java +++ b/src/client/java/de/cscherr/mcpht/mixin/client/NetworkPacketLogMixin.java @@ -13,13 +13,9 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.jetbrains.annotations.Nullable; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - @Mixin(ClientConnection.class) public class NetworkPacketLogMixin { - @Unique private static final Logger LOGGER = MCPHTClient.LOGGER; /** @@ -30,9 +26,8 @@ public class NetworkPacketLogMixin { * @param ci magical fabric mixin stuff */ @Inject(method = "sendImmediately", at = @At("HEAD")) - private void logSentPacket(Packet packet, @Nullable PacketCallbacks callbacks, CallbackInfo ci) { - if (MCPHTClient.CONFIG.networkLogging.TX && - MCPHTClient.CONFIG.networkLogging.filter.matcher(packet.getClass().getSimpleName()).matches()) { + public void logSentPacket(Packet packet, @Nullable PacketCallbacks callbacks, CallbackInfo ci) { + if (MCPHTClient.CONFIG.networkLogging.TX) { String information = null; switch (MCPHTClient.CONFIG.networkLogging.verbosity) { case NAME -> { @@ -41,7 +36,8 @@ public class NetworkPacketLogMixin { } case ALL -> { information = String.format("%s:\n" + - " %s", packet.getClass().getSimpleName(), packet.toString()); + " %s\n" + + "ALL INFO", packet.getClass().getSimpleName(), packet.toString()); break; } } @@ -68,4 +64,4 @@ public class NetworkPacketLogMixin { } } -} \ No newline at end of file +} diff --git a/src/main/resources/.accesswidener b/src/main/resources/.accesswidener deleted file mode 100644 index 3072332..0000000 --- a/src/main/resources/.accesswidener +++ /dev/null @@ -1,4 +0,0 @@ -accessWidener v2 named -# I just need some damn regex, come on -accessible class java/utils/regex/Pattern -accessible class java/utils/regex/Matcher \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 55cf5f9..b79686e 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -51,6 +51,5 @@ "modmenu": { "update_checker": true } - }, - "accessWidener": "mcpht.accesswidener" + } }