From 8d3d2ebd50dcd5ad510975f7628f9500134ea72b Mon Sep 17 00:00:00 2001 From: Ali Moghnieh Date: Thu, 7 Jul 2016 04:59:09 +0100 Subject: [PATCH] Enable longer display names/player list-names feature For 1.8 servers and above. --- Essentials/src/com/earth2me/essentials/User.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index d8d8e09fd..0695b90b7 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -13,6 +13,8 @@ import net.ess3.api.MaxMoneyException; import net.ess3.api.events.AfkStatusChangeEvent; import net.ess3.api.events.JailStatusChangeEvent; import net.ess3.api.events.UserBalanceUpdateEvent; +import net.ess3.nms.refl.ReflUtil; + import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -305,7 +307,10 @@ public class User extends UserData implements Comparable, IMessageRecipien if (base.isOnline() && ess.getSettings().changeDisplayName()) { this.getBase().setDisplayName(getNick(true)); if (ess.getSettings().changePlayerListName()) { - String name = getNick(false); + // 1.8 enabled player list-names longer than 16 characters. + // If the server is on 1.8 or higher, provide that functionality. Otherwise, keep prior functionality. + boolean higherOrEqualTo1_8 = ReflUtil.getNmsVersionObject().isHigherThanOrEqualTo(ReflUtil.V1_8_R1); + String name = getNick(higherOrEqualTo1_8); try { this.getBase().setPlayerListName(name); } catch (IllegalArgumentException e) {