Skip to content
This repository has been archived by the owner on Dec 5, 2020. It is now read-only.

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Arasple committed Oct 12, 2019
1 parent 42203c9 commit 81c3639
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/main/java/me/arasple/mc/litechat/utils/MessageColors.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -18,20 +19,19 @@ public class MessageColors {

private static final String COLOR_PERMISSION_NODE = "litechat.color";

public static List<String> replaceWithPermission(Player player, List<String> message) {
for (int i = 0; i < message.size(); i++) {
message.set(i, replaceWithPermission(player, message.get(i)));
}
return message;
public static List<String> replaceWithPermission(Player player, List<String> strings) {
List<String> 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;
}

}

0 comments on commit 81c3639

Please sign in to comment.