Made super ugly change to how prefix/suffix works by not splitting them at all because MC doesn't look to care about char limits

This commit is contained in:
libraryaddict 2020-07-05 10:38:44 +12:00
parent 6e456e4702
commit ce884cc8ac
3 changed files with 12 additions and 6 deletions

View File

@ -111,10 +111,15 @@ public class DisguiseUtilities {
team.setOption(Option.NAME_TAG_VISIBILITY, nameVisible ? OptionStatus.ALWAYS : OptionStatus.NEVER);
}
if (NmsVersion.v1_13.isSupported()) {
team.setPrefix("Colorize");
team.setSuffix("Colorize");
} else {
team.setPrefix(getPrefix());
team.setSuffix(getSuffix());
}
}
}
@Getter
public static final Random random = new Random();
@ -1601,7 +1606,7 @@ public class DisguiseUtilities {
throw new IllegalStateException("This can only be used for names longer than 16 characters!");
}
int limit = NmsVersion.v1_13.isSupported() ? 64 : 16;
int limit = NmsVersion.v1_13.isSupported() ? 1024 : 16;
if (name.length() > (16 + (limit * 2))) {
name = name.substring(0, (16 + (limit * 2)));

View File

@ -169,7 +169,7 @@ public class PacketsManager {
ProtocolLibrary.getProtocolManager().addPacketListener(mainListener);
ProtocolLibrary.getProtocolManager().addPacketListener(destroyListener);
if (NmsVersion.v1_16.isSupported()) {
if (NmsVersion.v1_13.isSupported()) {
scoreboardTeamListener = new PacketListenerScoreboardTeam();
ProtocolLibrary.getProtocolManager().addPacketListener(scoreboardTeamListener);
}

View File

@ -13,7 +13,7 @@ import me.libraryaddict.disguise.disguisetypes.TargetedDisguise;
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.chat.ComponentSerializer;
import org.bukkit.plugin.Plugin;
import org.apache.commons.lang.StringUtils;
import java.util.Set;
@ -30,7 +30,7 @@ public class PacketListenerScoreboardTeam extends PacketAdapter {
PacketContainer packet = event.getPacket();
String name = packet.getStrings().read(0);
if (!name.startsWith("LD_")) {
if (!name.startsWith("LD_") || name.equals("LD_NoName") || name.equals("LD_Pushing")) {
return;
}
@ -53,6 +53,7 @@ public class PacketListenerScoreboardTeam extends PacketAdapter {
}
StructureModifier<WrappedChatComponent> chats = packet.getChatComponents();
BaseComponent[] prefix = DisguiseUtilities.getColoredChat(team.getPrefix());
BaseComponent[] suffix = DisguiseUtilities.getColoredChat(team.getSuffix());