From 9057ab9f1516ed2ddfcaeae1dc3f19bc90b10ab6 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Sat, 4 Nov 2017 02:04:34 +0100 Subject: [PATCH] Fix --- src/main/java/buttondevteam/chat/ChatPlayer.java | 3 +-- src/main/java/buttondevteam/chat/ChatProcessing.java | 4 ++-- .../buttondevteam/chat/commands/ucmds/NColorCommand.java | 7 ++++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/buttondevteam/chat/ChatPlayer.java b/src/main/java/buttondevteam/chat/ChatPlayer.java index 71e7b73..b54f75a 100644 --- a/src/main/java/buttondevteam/chat/ChatPlayer.java +++ b/src/main/java/buttondevteam/chat/ChatPlayer.java @@ -11,7 +11,6 @@ import buttondevteam.lib.player.EnumPlayerData; import buttondevteam.lib.player.PlayerClass; import buttondevteam.lib.player.PlayerData; import buttondevteam.lib.player.TBMCPlayerBase; -import gnu.trove.list.array.TIntArrayList; @PlayerClass(pluginname = "Button1Chat") public class ChatPlayer extends TBMCPlayerBase { @@ -43,7 +42,7 @@ public class ChatPlayer extends TBMCPlayerBase { return data(false); } - public PlayerData NameColorLocations() { // No byte[] + public PlayerData> NameColorLocations() { // No byte[], no TIntArrayList return data(null); } diff --git a/src/main/java/buttondevteam/chat/ChatProcessing.java b/src/main/java/buttondevteam/chat/ChatProcessing.java index e861d4a..bb7c977 100644 --- a/src/main/java/buttondevteam/chat/ChatProcessing.java +++ b/src/main/java/buttondevteam/chat/ChatProcessing.java @@ -265,8 +265,8 @@ public class ChatProcessing { + Integer.toHexString(clrs[i].ordinal()) // 'Odds' are the last character is chopped off so we make sure to include all chars at the end + (i + 1 == clrs.length ? name.substring(len * i) : name.substring(len * i, len * i + len)); int len = name.length() / clrs.length; - int[] ncl = ChatPlayer.getPlayer(player.getUniqueId(), ChatPlayer.class).NameColorLocations().get() - .toArray(); + int[] ncl = ChatPlayer.getPlayer(player.getUniqueId(), ChatPlayer.class).NameColorLocations().get().stream() + .mapToInt(Integer::intValue).toArray(); if (Arrays.stream(ncl).sum() != name.length() || ncl.length != clrs.length) { System.out.println("Name length changed: " + Arrays.stream(ncl).sum() + " -> " + name.length()); ncl = null; // Reset if name length changed diff --git a/src/main/java/buttondevteam/chat/commands/ucmds/NColorCommand.java b/src/main/java/buttondevteam/chat/commands/ucmds/NColorCommand.java index 852ecfd..cc6dca4 100644 --- a/src/main/java/buttondevteam/chat/commands/ucmds/NColorCommand.java +++ b/src/main/java/buttondevteam/chat/commands/ucmds/NColorCommand.java @@ -1,6 +1,8 @@ package buttondevteam.chat.commands.ucmds; +import java.util.ArrayList; import java.util.Arrays; +import java.util.stream.Collectors; import org.bukkit.ChatColor; import org.bukkit.entity.Player; @@ -13,7 +15,6 @@ import buttondevteam.chat.PluginMain; import buttondevteam.lib.chat.Color; import buttondevteam.lib.chat.CommandClass; import buttondevteam.lib.chat.OptionallyPlayerCommandClass; -import gnu.trove.list.array.TIntArrayList; @OptionallyPlayerCommandClass(playerOnly = true) @CommandClass @@ -69,8 +70,8 @@ public class NColorCommand extends UCommandBase { return true; } ChatPlayer.getPlayer(player.getUniqueId(), ChatPlayer.class).NameColorLocations() - .set(TIntArrayList.wrap(Arrays.stream(nameparts).mapToInt(np -> np.length()).toArray())); // No byte[] - player.sendMessage("§bName colors set."); // TODO: ArrayList is what it becomes I think + .set(new ArrayList<>(Arrays.stream(nameparts).map(np -> np.length()).collect(Collectors.toList()))); // No byte[], no TIntArrayList + player.sendMessage("§bName colors set."); return true; } }