Skip to content

Commit

Permalink
2.1.10 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
LOOHP committed May 6, 2020
1 parent b71430c commit 422554c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/com/loohp/interactivechat/Modules/PlayernameDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.loohp.interactivechat.InteractiveChat;
import com.loohp.interactivechat.ObjectHolders.ReplaceTextBundle;
import com.loohp.interactivechat.Utils.ChatColorUtils;
import com.loohp.interactivechat.Utils.ChatComponentUtils;
import com.loohp.interactivechat.Utils.CustomStringUtils;

import me.clip.placeholderapi.PlaceholderAPI;
Expand Down Expand Up @@ -53,7 +54,7 @@ public static BaseComponent processPlayer(String placeholder, Player player, Str
List<BaseComponent> newlist = new ArrayList<BaseComponent>();

for (BaseComponent base : basecomponentlist) {
if (matched.contains(base)) {
if (matched.stream().anyMatch(each -> ChatComponentUtils.areSimilar(each, base))) {
newlist.add(base);
} else if (!(base instanceof TextComponent)) {
newlist.add(base);
Expand Down
25 changes: 25 additions & 0 deletions src/com/loohp/interactivechat/Utils/ChatComponentUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,31 @@

public class ChatComponentUtils {

public static boolean areSimilar(BaseComponent base1, BaseComponent base2) {
if (!areEventsSimilar(base1, base2)) {
return false;
}
if (!base1.getColor().equals(base2.getColor())) {
return false;
}
if (base1.isBold() != base2.isBold()) {
return false;
}
if (base1.isItalic() != base2.isItalic()) {
return false;
}
if (base1.isObfuscated() != base2.isObfuscated()) {
return false;
}
if (base1.isStrikethrough() != base2.isStrikethrough()) {
return false;
}
if (base1.isUnderlined() != base2.isUnderlined()) {
return false;
}
return true;
}

public static boolean areEventsSimilar(BaseComponent base1, BaseComponent base2) {
boolean clickSim = false;
boolean hoverSim = false;
Expand Down
2 changes: 1 addition & 1 deletion src/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: InteractiveChat
author: loohp
version: 2.1.9
version: 2.1.10
main: com.loohp.interactivechat.InteractiveChat
api-version: 1.13
description: Make the chat interactive
Expand Down

0 comments on commit 422554c

Please sign in to comment.