pls gimme regex
This commit is contained in:
parent
0d1ecb5341
commit
4fff71b2ac
|
@ -3,6 +3,9 @@ plugins {
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_17
|
||||||
|
targetCompatibility = JavaVersion.VERSION_17
|
||||||
|
|
||||||
version = project.mod_version
|
version = project.mod_version
|
||||||
group = project.maven_group
|
group = project.maven_group
|
||||||
|
|
||||||
|
@ -29,8 +32,6 @@ loom {
|
||||||
sourceSet sourceSets.client
|
sourceSet sourceSets.client
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
accessWidenerPath = file("src/main/resources/.accesswidener")
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
package de.cscherr.mcpht.config;
|
package de.cscherr.mcpht.config;
|
||||||
|
|
||||||
import de.cscherr.mcpht.MCPHTClient;
|
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.ConfigData;
|
||||||
import me.shedaniel.autoconfig.annotation.Config;
|
import me.shedaniel.autoconfig.annotation.Config;
|
||||||
import me.shedaniel.autoconfig.annotation.ConfigEntry;
|
import me.shedaniel.autoconfig.annotation.ConfigEntry;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.regex.Matcher;
|
|
||||||
|
|
||||||
@Config(name = "mcphtconf")
|
@Config(name = "mcphtconf")
|
||||||
public class MCPHTConfig implements ConfigData {
|
public class MCPHTConfig implements ConfigData {
|
||||||
|
@ -25,7 +24,12 @@ public class MCPHTConfig implements ConfigData {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void compileFilter() {
|
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 {
|
public static class NetworkLoggingScheme {
|
||||||
|
@ -38,6 +42,6 @@ public class MCPHTConfig implements ConfigData {
|
||||||
NAME
|
NAME
|
||||||
}
|
}
|
||||||
@ConfigEntry.Gui.Excluded
|
@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.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
|
|
||||||
@Mixin(ClientConnection.class)
|
@Mixin(ClientConnection.class)
|
||||||
public class NetworkPacketLogMixin {
|
public class NetworkPacketLogMixin {
|
||||||
|
|
||||||
@Unique
|
@Unique
|
||||||
private static final Logger LOGGER = MCPHTClient.LOGGER;
|
private static final Logger LOGGER = MCPHTClient.LOGGER;
|
||||||
/**
|
/**
|
||||||
|
@ -30,9 +26,8 @@ public class NetworkPacketLogMixin {
|
||||||
* @param ci magical fabric mixin stuff
|
* @param ci magical fabric mixin stuff
|
||||||
*/
|
*/
|
||||||
@Inject(method = "sendImmediately", at = @At("HEAD"))
|
@Inject(method = "sendImmediately", at = @At("HEAD"))
|
||||||
private void logSentPacket(Packet<?> packet, @Nullable PacketCallbacks callbacks, CallbackInfo ci) {
|
public void logSentPacket(Packet<?> packet, @Nullable PacketCallbacks callbacks, CallbackInfo ci) {
|
||||||
if (MCPHTClient.CONFIG.networkLogging.TX &&
|
if (MCPHTClient.CONFIG.networkLogging.TX) {
|
||||||
MCPHTClient.CONFIG.networkLogging.filter.matcher(packet.getClass().getSimpleName()).matches()) {
|
|
||||||
String information = null;
|
String information = null;
|
||||||
switch (MCPHTClient.CONFIG.networkLogging.verbosity) {
|
switch (MCPHTClient.CONFIG.networkLogging.verbosity) {
|
||||||
case NAME -> {
|
case NAME -> {
|
||||||
|
@ -41,7 +36,8 @@ public class NetworkPacketLogMixin {
|
||||||
}
|
}
|
||||||
case ALL -> {
|
case ALL -> {
|
||||||
information = String.format("%s:\n" +
|
information = String.format("%s:\n" +
|
||||||
" %s", packet.getClass().getSimpleName(), packet.toString());
|
" %s\n" +
|
||||||
|
"ALL INFO", packet.getClass().getSimpleName(), packet.toString());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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": {
|
"modmenu": {
|
||||||
"update_checker": true
|
"update_checker": true
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"accessWidener": "mcpht.accesswidener"
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue