From 890ded8fd8f131378400cbd06ae2d0b0e2029979 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sat, 14 Jan 2012 17:42:18 +0000 Subject: [PATCH] Player.setPlayerListName no longer counts colors towards the 16-char limit. Thanks to an (unfortunately old) PR by ZachBora. By: Nathan Adams --- .../bukkit/craftbukkit/entity/CraftPlayer.java | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 8d99a64c77..09584520e2 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -25,16 +25,7 @@ import net.minecraft.server.Packet61WorldEvent; import net.minecraft.server.Packet6SpawnPosition; import net.minecraft.server.Packet70Bed; import net.minecraft.server.WorldServer; -import org.bukkit.Achievement; -import org.bukkit.Effect; -import org.bukkit.GameMode; -import org.bukkit.Instrument; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Note; -import org.bukkit.OfflinePlayer; -import org.bukkit.Statistic; -import org.bukkit.World; +import org.bukkit.*; import org.bukkit.configuration.serialization.DelegateDeserialization; import org.bukkit.craftbukkit.CraftOfflinePlayer; import org.bukkit.craftbukkit.CraftServer; @@ -156,8 +147,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return; } - if (name.length() > 16) { - throw new IllegalArgumentException("Player list names can only be a maximum of 16 characters long"); + if (ChatColor.stripColor(name).length() > 16) { + throw new IllegalArgumentException("Player list names can only be a maximum of 16 characters long without colour codes"); } // Collisions will make for invisible people