pls gimme regex
This commit is contained in:
parent
0d1ecb5341
commit
4fff71b2ac
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
|
@ -51,6 +51,5 @@
|
|||
"modmenu": {
|
||||
"update_checker": true
|
||||
}
|
||||
},
|
||||
"accessWidener": "mcpht.accesswidener"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue