From 91f20ae728578f1a39c2a842d21b94ba246f4842 Mon Sep 17 00:00:00 2001 From: syeyoung Date: Sun, 22 Aug 2021 18:16:04 +0900 Subject: - Fix cosmetics not working in private islands when current player is the one who sent message --- .../cosmetics/chatreplacers/ChatReplacerChatByMe.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/main/java/kr/syeyoung') diff --git a/src/main/java/kr/syeyoung/dungeonsguide/cosmetics/chatreplacers/ChatReplacerChatByMe.java b/src/main/java/kr/syeyoung/dungeonsguide/cosmetics/chatreplacers/ChatReplacerChatByMe.java index 28fb861e..5b08aeb2 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/cosmetics/chatreplacers/ChatReplacerChatByMe.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/cosmetics/chatreplacers/ChatReplacerChatByMe.java @@ -57,12 +57,13 @@ public class ChatReplacerChatByMe implements IChatReplacer { ChatStyle origStyle = hasMsg.get(0).getChatStyle(); String name = chatComponents.getFormattedText(); + System.out.println(name); String[] splited = name.split(" "); String actualName = splited[splited.length-1]; List cDatas = cosmeticsManager.getActiveCosmeticByPlayerNameLowerCase().get(TextUtils.stripColor(actualName).toLowerCase()); - if (cDatas == null || splited.length > 2) return; + if (cDatas == null) return; CosmeticData color=null, prefix=null; for (ActiveCosmetic activeCosmetic : cDatas) { CosmeticData cosmeticData = cosmeticsManager.getCosmeticDataMap().get(activeCosmetic.getCosmeticData()); @@ -75,10 +76,12 @@ public class ChatReplacerChatByMe implements IChatReplacer { String building = ""; if (prefix != null) building += prefix.getData().replace("&", "§") + " "; - if (splited.length == 2) building += splited[0] +" "; + for (int i = 0; i < splited.length-1; i++) { + building += splited[i] +" "; + } if (color != null) { - String nick = splited[1]; + String nick = splited[splited.length-1]; building += color.getData().replace("&","§"); boolean foundLegitChar = false; boolean foundColor = false; @@ -93,7 +96,7 @@ public class ChatReplacerChatByMe implements IChatReplacer { } } } else { - building += splited[1] ; + building += splited[splited.length-1] ; } ChatComponentText chatComponents1 = new ChatComponentText(building); -- cgit