aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
authorLorenz <lo.scherf@gmail.com>2022-09-08 12:13:43 +0200
committerLorenz <lo.scherf@gmail.com>2022-09-08 12:13:43 +0200
commit1ba5d8b7369387f1fbd3949ada31cb005ce90967 (patch)
tree2081f131c10df6b6c121a1352074e41ee61e5aa9 /src/main/java/at/hannibal2/skyhanni
parent93a56487f0bb2b7d5dcfc816808386ef34a8986e (diff)
downloadskyhanni-1ba5d8b7369387f1fbd3949ada31cb005ce90967.tar.gz
skyhanni-1ba5d8b7369387f1fbd3949ada31cb005ce90967.tar.bz2
skyhanni-1ba5d8b7369387f1fbd3949ada31cb005ce90967.zip
added minecraft console filter logic into config
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/DevData.java60
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt33
2 files changed, 77 insertions, 16 deletions
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 5e66e9e8f..126f67d18 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/DevData.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/DevData.java
@@ -27,4 +27,64 @@ public class DevData {
@ConfigEditorButton(runnableId = "debugPos", buttonText = "Edit")
@ConfigAccordionId(id = 0)
public Position debugPos = new Position(10, 10, false, true);
+
+ @Expose
+ @ConfigOption(name = "Minecraft Console", desc = "")
+ @ConfigEditorAccordion(id = 1)
+ public boolean minecraftConsole = false;
+
+ @Expose
+ @ConfigOption(name = "Unfiltered Debug", desc = "Print the debug information for unfiltered console messages")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 1)
+ public boolean printUnfilteredDebugs = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Outside SkyBlock",
+ desc = "Print the debug information for unfiltered console messages outside SkyBlock too"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 1)
+ public boolean printUnfilteredDebugsOutsideSkyBlock = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Log Filtered",
+ desc = "Log the filtered messages into the console"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 1)
+ public boolean printFilteredReason = true;
+
+ @Expose
+ @ConfigOption(name = "Console Filters", desc = "")
+ @ConfigAccordionId(id = 1)
+ @ConfigEditorAccordion(id = 2)
+ public boolean consoleFilters = false;
+
+ @Expose
+ @ConfigOption(name = "Filter Chat", desc = "Filter chat messages")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 2)
+ public boolean filterChat = true;
+
+ @Expose
+ @ConfigOption(name = "Filter Grow Buffer", desc = "Filter 'Needed to grow BufferBuilder buffer:'")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 2)
+ public boolean filterGrowBuffer = true;
+
+ @Expose
+ @ConfigOption(name = "Filter Chat", desc = "Filter 'Unable to play unknown soundEvent'")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 2)
+ public boolean filterUnknownSound = true;
+
+ @Expose
+ @ConfigOption(name = "Filter Scoreboard Errors", desc = "Filter error messages with Scoreboard: removeTeam, createTeam, " +
+ "removeObjective and 'scoreboard team already exists'")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 2)
+ public boolean filterScoreboardErrors = true;
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt b/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt
index 0159b4809..5e64999da 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt
@@ -1,5 +1,6 @@
package at.hannibal2.skyhanni.utils
+import at.hannibal2.skyhanni.SkyHanniMod
import org.apache.logging.log4j.Level
import org.apache.logging.log4j.LogManager
import org.apache.logging.log4j.Marker
@@ -13,14 +14,14 @@ 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
+// var printUnfilteredDebugs = false
+// var printUnfilteredDebugsOutsideSkyBlock = false
+// var printFilteredReason = false
+//
+// var filterChat = false
+// var filterGrowBuffer = false
+// var filterUnknownSound = false
+// var filterScoreboardErrors = false
companion object {
@JvmStatic
@@ -53,19 +54,19 @@ class MinecraftConsoleFilter(private val loggerConfigName: String) : Filter {
val formattedMessage = message.formattedMessage
val thrown = event.thrown
- if (filterChat) {
+ if (SkyHanniMod.feature.dev.filterChat) {
if (formattedMessage.startsWith("[CHAT] ")) {
filterConsole("chat")
return Filter.Result.DENY
}
}
- if (filterGrowBuffer) {
+ if (SkyHanniMod.feature.dev.filterGrowBuffer) {
if (formattedMessage.startsWith("Needed to grow BufferBuilder buffer: Old size ")) {
filterConsole("Grow BufferBuilder buffer")
return Filter.Result.DENY
}
}
- if (filterUnknownSound) {
+ if (SkyHanniMod.feature.dev.filterUnknownSound) {
if (formattedMessage == "Unable to play unknown soundEvent: minecraft:") {
filterConsole("Unknown soundEvent (minecraft:)")
return Filter.Result.DENY
@@ -76,7 +77,7 @@ class MinecraftConsoleFilter(private val loggerConfigName: String) : Filter {
if (cause != null) {
if (cause.stackTrace.isNotEmpty()) {
val first = cause.stackTrace[0]
- if (filterScoreboardErrors) {
+ if (SkyHanniMod.feature.dev.filterScoreboardErrors) {
if (first.toString() == "net.minecraft.scoreboard.Scoreboard.removeTeam(Scoreboard.java:229)") {
filterConsole("NullPointerException at Scoreboard.removeTeam")
return Filter.Result.DENY
@@ -92,7 +93,7 @@ class MinecraftConsoleFilter(private val loggerConfigName: String) : Filter {
}
}
}
- if (filterScoreboardErrors) {
+ if (SkyHanniMod.feature.dev.filterScoreboardErrors) {
if (thrown.toString() == "java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: A team with the name '") {
filterConsole("IllegalArgumentException because scoreboard team already exists")
return Filter.Result.DENY
@@ -100,8 +101,8 @@ class MinecraftConsoleFilter(private val loggerConfigName: String) : Filter {
}
}
- if (!printUnfilteredDebugs) return Filter.Result.ACCEPT
- if (!printUnfilteredDebugsOutsideSkyBlock && !LorenzUtils.inSkyblock) return Filter.Result.ACCEPT
+ if (!SkyHanniMod.feature.dev.printUnfilteredDebugs) return Filter.Result.ACCEPT
+ if (!SkyHanniMod.feature.dev.printUnfilteredDebugsOutsideSkyBlock && !LorenzUtils.inSkyblock) return Filter.Result.ACCEPT
println(" ")
println("filter 4/event ('$loggerConfigName'/'$loggerName')")
@@ -137,7 +138,7 @@ class MinecraftConsoleFilter(private val loggerConfigName: String) : Filter {
private fun filterConsole(message: String) {
lorenzLogger.log(message)
- if (printFilteredReason) {
+ if (SkyHanniMod.feature.dev.printFilteredReason) {
LorenzUtils.consoleLog("filtered console: $message")
}
}