diff options
author | syeyoung <cyong06@naver.com> | 2021-01-08 11:57:47 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-01-08 11:57:47 +0900 |
commit | 0b364456085c0ae48797aa5b7b2864f47735f509 (patch) | |
tree | 1b269e6adae28a565182b56bb43a7923b00f5c8d | |
parent | a85cde380c6aa6447f8abfb105d2cc55cf7dc149 (diff) | |
download | Skyblock-Dungeons-Guide-0b364456085c0ae48797aa5b7b2864f47735f509.tar.gz Skyblock-Dungeons-Guide-0b364456085c0ae48797aa5b7b2864f47735f509.tar.bz2 Skyblock-Dungeons-Guide-0b364456085c0ae48797aa5b7b2864f47735f509.zip |
MESSAGE disables and colors
4 files changed, 72 insertions, 1 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCAColor.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCAColor.java index e3db0d12..bce13c26 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCAColor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCAColor.java @@ -8,7 +8,7 @@ import java.awt.*; public class TCAColor implements TypeConverter<Color> { @Override public String getTypeString() { - return "color"; + return "acolor"; } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TypeConverterRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TypeConverterRegistry.java index 5f4947a1..7417feae 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TypeConverterRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TypeConverterRegistry.java @@ -25,5 +25,6 @@ public class TypeConverterRegistry { register(new TCRectangle()); register(new TCString()); register(new TCColor()); + register(new TCAColor()); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java index ea0c05c0..71c9eb49 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java @@ -50,6 +50,8 @@ public class FeatureRegistry { public static final FeatureCooldownCounter ETC_COOLDOWN = register(new FeatureCooldownCounter()); public static final SimpleFeature FIX_SPIRIT_BOOTS = register(new SimpleFeature("fixes", "Spirit Boots Fixer", "Fix Spirit boots messing up with inventory", "fixes.spirit", true)); + public static final FeatureDisableMessage FIX_MESSAGES = register(new FeatureDisableMessage()); + public static final SimpleFeature BOSSFIGHT_CHESTPRICE = register(new FeatureChestPrice()); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDisableMessage.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDisableMessage.java new file mode 100644 index 00000000..e4ac78c7 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDisableMessage.java @@ -0,0 +1,68 @@ +package kr.syeyoung.dungeonsguide.features.impl; + +import kr.syeyoung.dungeonsguide.SkyblockStatus; +import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.features.GuiFeature; +import kr.syeyoung.dungeonsguide.features.SimpleFeature; +import kr.syeyoung.dungeonsguide.features.listener.ChatListener; +import kr.syeyoung.dungeonsguide.utils.TextUtils; +import lombok.AllArgsConstructor; +import lombok.Data; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.util.regex.Pattern; + +public class FeatureDisableMessage extends SimpleFeature implements ChatListener { + @Data + @AllArgsConstructor + public static class MessageData { + private Pattern pattern; + private String name; + private String description; + private String key; + } + + private static final MessageData[] PRE_DEFINED = new MessageData[] { + new MessageData(Pattern.compile("§r§cThere are blocks in the way!§r"), "Aote block message", "\"There are blocks in the way!\"", "aote"), + new MessageData(Pattern.compile("§r§cThis ability is currently on cooldown for .+ more seconds\\.§r"), "Ability cooldown message", "\"This ability is currently on cooldown for 3 more seconds.\"", "cooldown"), + new MessageData(Pattern.compile("§r§cWhow! Slow down there!§r"), "Grappling hook cooldown", "\"Whow! Slow down there!\"", "grappling"), + new MessageData(Pattern.compile("§r§cNo more charges, next one in §r§e.+§r§cs!§r"), "Zombie Sword Charging", "\"No more charges, next one in 3s!\"", "zombie"), + new MessageData(Pattern.compile("§r§7Your .+ hit §r§c.+ §r§7enem(?:y|ies) for §r§c.+ §r§7damage\\.§r"), "Ability Damage", "\"Your blahblah hit 42 enemy for a lots of damage\"", "ability"), + new MessageData(Pattern.compile("§r§cYou do not have enough mana to do this!§r"), "Not enough mana", "\"You do not have enough mana to do this!\"", "mana"), + new MessageData(Pattern.compile("§r§aUsed §r.+§r§a!§r"), "Dungeon Ability Usage", "\"Used Guided Sheep!\" and such", "dungeonability"), + new MessageData(Pattern.compile("D§r.+§r§a is ready to use! Press §r.+§r§a to activate it!§r"), "Ready to use message", "\"Blah is ready to use! Press F to activate it!", "readytouse"), + new MessageData(Pattern.compile("§r.+ §r§ais now available!§r"), "Ability Available","\"blah is now available!\"", "available"), + new MessageData(Pattern.compile("§r§cThe Stone doesn't seem to do anything here\\.§r"), "Stone Message", "\"The Stone doesn't seem to do anything here\"", "stone") + }; + + public FeatureDisableMessage() { + super("Fixes", "Disable ability messages", "Do not let ability messages show up in chatbox\nclick on Edit for more precise settings", "fixes.messagedisable", true); + for (MessageData messageData : PRE_DEFINED) { + this.parameters.put(messageData.key, new FeatureParameter<Boolean>(messageData.key, messageData.name, messageData.description, true, "boolean")); + } + } + + SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + + @Override + public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { + if (clientChatReceivedEvent.type == 2) return; + if (!isEnabled()) return; + if (!skyblockStatus.isOnSkyblock()) return; + String msg = clientChatReceivedEvent.message.getFormattedText(); + System.out.println(msg); + for (MessageData md:PRE_DEFINED) { + if (this.<Boolean>getParameter(md.key).getValue() && md.pattern.matcher(msg).matches()) { + clientChatReceivedEvent.setCanceled(true); + return; + } + } + } +} |