aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorLorenz <lo.scherf@gmail.com>2022-09-08 13:52:31 +0200
committerLorenz <lo.scherf@gmail.com>2022-09-08 13:52:31 +0200
commit8fbf31c9905f58d850465024c8f90f36bab1a8d2 (patch)
tree87915aa5f6cbd4a97f7350f352d8169c8e6c1f37 /src/main/java
parent66890532a5d3ac7df1652855a57addfc3555e183 (diff)
downloadskyhanni-8fbf31c9905f58d850465024c8f90f36bab1a8d2.tar.gz
skyhanni-8fbf31c9905f58d850465024c8f90f36bab1a8d2.tar.bz2
skyhanni-8fbf31c9905f58d850465024c8f90f36bab1a8d2.zip
added more minecraft console filters
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/DevData.java18
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt74
4 files changed, 80 insertions, 24 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
index 0d2eac02b..9d62cf4e5 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
@@ -55,8 +55,7 @@ public class SkyHanniMod {
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
- logger = LogManager.getLogger(MODID);
- MinecraftConsoleFilter.initLogging();
+ logger = LogManager.getLogger("SkyHanni");
new BazaarApi();
registerEvent(this);
@@ -125,6 +124,7 @@ public class SkyHanniMod {
configManager = new ConfigManager(this);
configManager.firstLoad();
+ MinecraftConsoleFilter.initLogging();
Runtime.getRuntime().addShutdownHook(new Thread(configManager::saveConfig));
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/DevData.java b/src/main/java/at/hannibal2/skyhanni/config/features/DevData.java
index 807f6ad66..794fb6d8d 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/DevData.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/DevData.java
@@ -87,4 +87,22 @@ public class DevData {
@ConfigEditorBoolean
@ConfigAccordionId(id = 2)
public boolean filterScoreboardErrors = false;
+
+ @Expose
+ @ConfigOption(name = "Filter Particle", desc = "Filter message 'Could not spawn particle effect VILLAGER_HAPPY'")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 2)
+ public boolean filterParticleVillagerHappy = false;
+
+ @Expose
+ @ConfigOption(name = "Filter OptiFine", desc = "Filter OptiFine messages CustomItems and ConnectedTextures during loading")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 2)
+ public boolean filterOptiFine = false;
+
+ @Expose
+ @ConfigOption(name = "Filter AsmHelper Transformer", desc = "Filter messages when AsmHelper is Transforming a class during loading")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 2)
+ public boolean filterAmsHelperTransformer = false;
}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt
index 2e8a7a119..0e6efff26 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt
@@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.data
import at.hannibal2.skyhanni.events.LocationChangeEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.ProfileJoinEvent
-import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzLogger
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.TabListUtils
import net.minecraft.client.Minecraft
@@ -20,6 +20,8 @@ class HypixelData {
var mode: String = ""
}
+ var loggerLocationChange = LorenzLogger("debug/location_change")
+
@SubscribeEvent
fun onConnect(event: FMLNetworkEvent.ClientConnectedToServerEvent) {
hypixel = Minecraft.getMinecraft().runCatching {
@@ -28,8 +30,6 @@ class HypixelData {
}.onFailure { it.printStackTrace() }.getOrDefault(false)
}
- val areaRegex = Regex("§r§b§l(?<area>[\\w]+): §r§7(?<loc>[\\w ]+)§r")
-
@SubscribeEvent
fun onWorldChange(event: WorldEvent.Load) {
skyblock = false
@@ -95,7 +95,7 @@ class HypixelData {
if (mode != location) {
LocationChangeEvent(location, mode).postAndCatch()
- LorenzUtils.consoleLog("SkyHanni location change: '$location'")
+ loggerLocationChange.log(location)
mode = location
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt b/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt
index 5e64999da..cd3530936 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt
@@ -14,15 +14,6 @@ class MinecraftConsoleFilter(private val loggerConfigName: String) : Filter {
val lorenzLogger = LorenzLogger("debug/mc_console_log")
-// var printUnfilteredDebugs = false
-// var printUnfilteredDebugsOutsideSkyBlock = false
-// var printFilteredReason = false
-//
-// var filterChat = false
-// var filterGrowBuffer = false
-// var filterUnknownSound = false
-// var filterScoreboardErrors = false
-
companion object {
@JvmStatic
fun initLogging() {
@@ -36,15 +27,6 @@ class MinecraftConsoleFilter(private val loggerConfigName: String) : Filter {
}
override fun filter(event: LogEvent?): Filter.Result {
-// printUnfilteredDebugs = true
-// printUnfilteredDebugsOutsideSkyBlock = false
-// printFilteredReason = false
-//
-// filterChat = true
-// filterGrowBuffer = true
-// filterUnknownSound = true
-// filterScoreboardErrors = true
-
if (event == null) return Filter.Result.ACCEPT
val loggerName = event.loggerName
@@ -72,6 +54,61 @@ class MinecraftConsoleFilter(private val loggerConfigName: String) : Filter {
return Filter.Result.DENY
}
}
+ //TODO testing
+ if (SkyHanniMod.feature.dev.filterParticleVillagerHappy) {
+ if (formattedMessage == "Could not spawn particle effect VILLAGER_HAPPY") {
+ filterConsole("particle VILLAGER_HAPPY")
+ return Filter.Result.DENY
+ }
+ }
+
+ if (SkyHanniMod.feature.dev.filterOptiFine) {
+ if (formattedMessage.startsWith("[OptiFine] CustomItems: ")) {
+ filterConsole("OptiFine CustomItems")
+ return Filter.Result.DENY
+ }
+ if (formattedMessage.startsWith("[OptiFine] ConnectedTextures: ")) {
+ filterConsole("OptiFine ConnectedTextures")
+ return Filter.Result.DENY
+ }
+ }
+ if (SkyHanniMod.feature.dev.filterAmsHelperTransformer) {
+ if (loggerName == "AsmHelper") {
+ if (formattedMessage.startsWith("Transforming class ")) {
+ filterConsole("AsmHelper Transforming")
+ return Filter.Result.DENY
+ }
+ }
+ }
+ //TODO find a way to load the filter earlier to filter these messages too
+// if (loggerName == "LaunchWrapper") {
+// //The jar file C:\Users\Lorenz\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl\lwjgl\2.9.4-nightly-20150209\lwjgl-2.9.4-nightly-20150209.jar has a security seal for path org.lwjgl.opengl, but that path is defined and not secure
+// if (formattedMessage.startsWith("The jar file ")) {
+// if (formattedMessage.endsWith(
+// ".jar has a security seal for path org.lwjgl.opengl, " +
+// "but that path is defined and not secure"
+// )
+// ) {
+// filterConsole("LaunchWrapper org.lwjgl.opengl security seal")
+// return Filter.Result.DENY
+// }
+// if (formattedMessage.endsWith(
+// ".jar has a security seal for path org.lwjgl, " +
+// "but that path is defined and not secure"
+// )
+// ) {
+// filterConsole("LaunchWrapper org.lwjgl security seal")
+// return Filter.Result.DENY
+// }
+// }
+// }
+// if (loggerName == "mixin") {
+// if (formattedMessage.startsWith("Mixing ") && formattedMessage.contains(" into ")) {
+// filterConsole("Mixing")
+// return Filter.Result.DENY
+// }
+// }
+
if (thrown != null) {
val cause = thrown.cause
if (cause != null) {
@@ -103,6 +140,7 @@ class MinecraftConsoleFilter(private val loggerConfigName: String) : Filter {
if (!SkyHanniMod.feature.dev.printUnfilteredDebugs) return Filter.Result.ACCEPT
if (!SkyHanniMod.feature.dev.printUnfilteredDebugsOutsideSkyBlock && !LorenzUtils.inSkyblock) return Filter.Result.ACCEPT
+ if (formattedMessage == "filtered console: ") return Filter.Result.ACCEPT
println(" ")
println("filter 4/event ('$loggerConfigName'/'$loggerName')")