From 81c3639bb9df200e7d961b5ff0df643ae1675bd9 Mon Sep 17 00:00:00 2001 From: Arasple Date: Sat, 12 Oct 2019 23:25:38 +0800 Subject: [PATCH] fixed --- .../arasple/mc/litechat/utils/MessageColors.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/me/arasple/mc/litechat/utils/MessageColors.java b/src/main/java/me/arasple/mc/litechat/utils/MessageColors.java index 122d33a9..a1326c09 100644 --- a/src/main/java/me/arasple/mc/litechat/utils/MessageColors.java +++ b/src/main/java/me/arasple/mc/litechat/utils/MessageColors.java @@ -1,5 +1,6 @@ package me.arasple.mc.litechat.utils; +import com.google.common.collect.Lists; import org.bukkit.entity.Player; import java.util.Arrays; @@ -18,20 +19,19 @@ public class MessageColors { private static final String COLOR_PERMISSION_NODE = "litechat.color"; - public static List replaceWithPermission(Player player, List message) { - for (int i = 0; i < message.size(); i++) { - message.set(i, replaceWithPermission(player, message.get(i))); - } - return message; + public static List replaceWithPermission(Player player, List strings) { + List result = Lists.newArrayList(); + strings.forEach(s -> result.add(replaceWithPermission(player, s))); + return result; } - public static String replaceWithPermission(Player player, String message) { + public static String replaceWithPermission(Player player, String string) { for (Character code : COLOR_CODES) { if (player.hasPermission(COLOR_PERMISSION_NODE + "." + code)) { - message = message.replace("&" + code, "§" + code); + string = string.replace("&" + code, "§" + code); } } - return message; + return string; } } \ No newline at end of file