Scoreboard max lenght 128

This commit is contained in:
Fabrizio La Rosa 2020-07-13 13:33:36 +02:00
parent 9b46a0d0dc
commit a58782cb0a

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.scoreboard;
import com.songoda.core.compatibility.ServerVersion;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.island.Island;
import com.songoda.skyblock.island.IslandLevel;
@ -70,7 +71,14 @@ public class Scoreboard {
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
String formattedDisplayName = ChatColor.translateAlternateColorCodes('&', replaceDisplayName(displayName));
int max = NMSUtil.getVersionNumber() > 8 ? 32 : 16;
int max;
if(ServerVersion.isServerVersion(ServerVersion.V1_8)) {
max = 16;
} else if(ServerVersion.isServerVersionBelow(ServerVersion.V1_13)) {
max = 32;
} else {
max = 128;
}
if (formattedDisplayName.length() > max) {
obj.setDisplayName(ChatColor.RED + "Too long...");
} else {