This commit is contained in:
Norbi Peti 2017-11-04 02:04:34 +01:00
parent cee69dc55b
commit 9057ab9f15
3 changed files with 7 additions and 7 deletions

View file

@ -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<TIntArrayList> NameColorLocations() { // No byte[]
public PlayerData<ArrayList<Integer>> NameColorLocations() { // No byte[], no TIntArrayList
return data(null);
}

View file

@ -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

View file

@ -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;
}
}