Skip to content

Commit

Permalink
2.1.15 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
LOOHP committed May 11, 2020
1 parent 929194b commit de7e85f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/com/loohp/interactivechat/Utils/ChatColorUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ public static String addColorToEachWord(String text, String leadingColor) {
StringBuilder sb = new StringBuilder();
text = leadingColor + text;
do {
leadingColor = getFirstColors(text);
int pos = text.indexOf(" ") + 1;
pos = pos <= 0 ? text.length() : pos;
String before = text.substring(0, pos);
//Bukkit.getConsoleSender().sendMessage(color.replace("§", "&") + " " + text.replace("§", "&") + " " + before.replace("§", "&"));
String before = leadingColor + text.substring(0, pos);
//Bukkit.getConsoleSender().sendMessage(leadingColor.replace("§", "&") + " " + text.replace("§", "&") + " " + before.replace("§", "&"));
sb.append(before);
text = leadingColor + text.substring(pos);
text = text.substring(pos);
leadingColor = getLastColors(before);
} while (text.length() > 0 && !text.equals(leadingColor));
return ChatColorFilter.removeUselessColorCodes(sb.toString());
}
Expand Down
3 changes: 2 additions & 1 deletion src/com/loohp/interactivechat/Utils/CustomStringUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ public static List<BaseComponent> loadExtras(List<BaseComponent> baseComp) {
extraNoExtra.getExtra().clear();
}
text.setText(text.getText() + ChatColorUtils.addColorToEachWord(extraNoExtra.toLegacyText(), ChatColorUtils.getLastColors(text.getText())));
//Bukkit.getConsoleSender().sendMessage(text.getText().replace("§", "&"));
} else if (!(extra instanceof TextComponent)) {
if (text != null) {
list.add(text);
Expand All @@ -163,7 +164,7 @@ public static List<BaseComponent> loadExtras(List<BaseComponent> baseComp) {
if (extraNoExtra.getExtra() != null) {
extraNoExtra.getExtra().clear();
}
text = new TextComponent(extraNoExtra.toLegacyText());
text = new TextComponent(ChatColorUtils.addColorToEachWord(extraNoExtra.toLegacyText(), extra.getColor() != null ? extra.getColor().toString() : ""));
if (InteractiveChat.version.contains("legacy") && !InteractiveChat.version.equals("1.12") && !InteractiveChat.version.equals("1.11")) {
text = (TextComponent) copyFormatting(text, extraNoExtra);
} else {
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.14
version: 2.1.15
main: com.loohp.interactivechat.InteractiveChat
api-version: 1.13
description: Make the chat interactive
Expand Down

0 comments on commit de7e85f

Please sign in to comment.