From ac13715cb0502d857ba591030cd952ca93ab93be Mon Sep 17 00:00:00 2001 From: nickreesdev Date: Fri, 19 Feb 2021 22:48:25 -0600 Subject: [PATCH] Added emotes to chat. --- .../zone/themcgamer/core/chat/ChatManager.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/zone/themcgamer/core/chat/ChatManager.java b/core/src/main/java/zone/themcgamer/core/chat/ChatManager.java index 9743975..a094a34 100644 --- a/core/src/main/java/zone/themcgamer/core/chat/ChatManager.java +++ b/core/src/main/java/zone/themcgamer/core/chat/ChatManager.java @@ -19,10 +19,7 @@ import zone.themcgamer.core.common.Style; import zone.themcgamer.core.module.Module; import zone.themcgamer.core.module.ModuleInfo; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Optional; +import java.util.*; /** * @author Braydon @@ -31,6 +28,13 @@ import java.util.Optional; public class ChatManager extends Module { private final BadSportSystem badSportSystem; private final IChatComponent[] chatComponents; + private final Map emotes = new HashMap<>(); + + { + emotes.put("shrug", "¯\\_(ツ)_/¯"); + emotes.put("tableflip", "(╯°□°)╯︵ ┻━┻"); + emotes.put("unflip", "┬─┬ ノ( ゜-゜ノ)"); + } public ChatManager(JavaPlugin plugin, BadSportSystem badSportSystem, IChatComponent[] chatComponents) { super(plugin); @@ -74,6 +78,8 @@ public class ChatManager extends Module { player.sendMessage(Style.error("Chat", "§cCannot format chat message")); return; } + for (Map.Entry emote : emotes.entrySet()) + message = message.replace(":" + emote.getKey() + ":", emote.getValue()); List components = new ArrayList<>(); for (IChatComponent chatComponent : chatComponents) { BaseComponent component = chatComponent.getComponent(player);