diff options
author | NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> | 2022-10-21 02:40:16 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-20 21:40:16 -0500 |
commit | 218e8048e345f4792cc1b696570fae29ac532ef8 (patch) | |
tree | 6852a5c630a3f6d66c536c183afafbfe08592193 /src/main | |
parent | 42264cc4f41096801074227d82ab8fec2907461c (diff) | |
download | NotEnoughUpdates-218e8048e345f4792cc1b696570fae29ac532ef8.tar.gz NotEnoughUpdates-218e8048e345f4792cc1b696570fae29ac532ef8.tar.bz2 NotEnoughUpdates-218e8048e345f4792cc1b696570fae29ac532ef8.zip |
Remove messages in chat if they are under a set skyblock level (#322)
* Remove messages in chat if they are under a set skyblock level
* 🤓 "not future proof. what if someone gets sb level 1000"
* 2.1.1.md
* Update Update Notes/2.1.1.md
Co-authored-by: Roman / Linnea Gräf <roman.graef@gmail.com>
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java | 8 | ||||
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java | 12 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java index 3473124c..e3a3edad 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java @@ -53,6 +53,8 @@ public class ChatListener { private final NotEnoughUpdates neu; private static final Pattern SLAYER_XP = Pattern.compile( " (Spider|Zombie|Wolf|Enderman|Blaze) Slayer LVL (\\d) - (?:Next LVL in ([\\d,]+) XP!|LVL MAXED OUT!)"); + + private static final Pattern SKYBLOCK_LVL_MESSAGE = Pattern.compile("\\[(\\d{1,4})\\] .*"); AtomicBoolean missingRecipe = new AtomicBoolean(false); public ChatListener(NotEnoughUpdates neu) { @@ -254,5 +256,11 @@ public class ChatListener { unformatted.startsWith(" ") || unformatted.startsWith("✦") || unformatted.equals( " You've earned a Crystal Loot Bundle!")) OverlayManager.crystalHollowOverlay.message(unformatted); + Matcher LvlMatcher = SKYBLOCK_LVL_MESSAGE.matcher(unformatted); + if (LvlMatcher.matches()) { + if (Integer.parseInt(LvlMatcher.group(1)) < NotEnoughUpdates.INSTANCE.config.misc.filterChatLevel && NotEnoughUpdates.INSTANCE.config.misc.filterChatLevel != 0) { + e.setCanceled(true); + } + } } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java index 86c4c5dd..568f852e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java @@ -239,6 +239,18 @@ public class Misc { @Expose @ConfigOption( + name = "Filter Skyblock Levels in Chat", + desc = "Requires the \"SkyBlock Levels in Chat\" skyblock setting to be on" + ) + @ConfigEditorSlider( + minValue = 0, + maxValue = 300, + minStep = 10 + ) + public int filterChatLevel = 0; + + @Expose + @ConfigOption( name = "Enable text field tweaks", desc = "Allows the use of ctrl + z, ctrl + y and ctrl + Lshift + z in text fields" ) |