From 655e34ff6d13514b50edc90746062487de98b59c Mon Sep 17 00:00:00 2001 From: LOOHP Date: Sat, 4 Jul 2020 20:59:03 +0800 Subject: [PATCH] 2.5.2 Update --- .../loohp/interactivechat/Utils/ChatColorUtils.java | 10 +++++++--- src/plugin.yml | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/com/loohp/interactivechat/Utils/ChatColorUtils.java b/src/com/loohp/interactivechat/Utils/ChatColorUtils.java index eae78193..c2e6babb 100644 --- a/src/com/loohp/interactivechat/Utils/ChatColorUtils.java +++ b/src/com/loohp/interactivechat/Utils/ChatColorUtils.java @@ -166,13 +166,17 @@ public static String addColorToEachWord(String text, String leadingColor) { } public static String translateAlternateColorCodes(char code, String text) { - if (text.length() < 2) { - return ""; + if (text == null) { + return text; + } + + if (text.length() < 2) { + return text; } for (int i = 0; i < text.length() - 1; i++) { if (text.charAt(i) == code) { - if (text.charAt(i + 1) == 'x') { + if (text.charAt(i + 1) == 'x' && text.length() > (i + 14)) { String section = text.substring(i, i + 14); String translated = section.replace(code, '§'); text = text.replace(section, translated); diff --git a/src/plugin.yml b/src/plugin.yml index cfc723f5..7f0c491c 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: InteractiveChat author: loohp -version: 2.5.1 +version: 2.5.2 main: com.loohp.interactivechat.InteractiveChat api-version: 1.13 description: Make the chat interactive