From dcc0b84f0cb1f5e98efddeb04dc3e75c6b96ebb2 Mon Sep 17 00:00:00 2001 From: CuteStar <78346594+MX233@users.noreply.github.com> Date: Tue, 31 Aug 2021 14:47:51 +0800 Subject: [PATCH] Add files via upload --- src/tax/cute/mcpingplugin/util/Util.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/tax/cute/mcpingplugin/util/Util.java b/src/tax/cute/mcpingplugin/util/Util.java index 063001a..939a282 100644 --- a/src/tax/cute/mcpingplugin/util/Util.java +++ b/src/tax/cute/mcpingplugin/util/Util.java @@ -51,13 +51,18 @@ public static int random(int Max, int Min) { } public static String clearColorCode(String text) { - if(text == null) return null; - if(!text.contains("¡ì")) return text; + if (text == null) return null; + if (!text.contains("¡ì")) return text; while (text.contains("¡ì")) { int index = text.indexOf("¡ì"); - text = text.replace(text.substring(index,index + 2),""); + if (index + 2 > text.length()) { + break; + } + text = text.replace(text.substring(index, index + 2), ""); } + text = text.replace("¡ì",""); return text; } + }