Package org.kingdoms.utils
Class XComponentBuilder
java.lang.Object
org.kingdoms.utils.XComponentBuilder
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe maximum bytes that theClientboundSystemChatPacket(which has the packet ID of 0x64 = 100) can send which is defined by thevoid method(PacketDataSerializer packetdataserializer)static final intWhen should we start using a new packet? This will of course fail in rare cases. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappend(net.md_5.bungee.api.chat.BaseComponent component) append(net.md_5.bungee.api.chat.BaseComponent component, net.md_5.bungee.api.chat.ComponentBuilder.FormatRetention retention) net.md_5.bungee.api.chat.TextComponentstatic voidcopyFormatting(net.md_5.bungee.api.chat.BaseComponent to, net.md_5.bungee.api.chat.BaseComponent from, net.md_5.bungee.api.chat.ComponentBuilder.FormatRetention retention) Because 1.12 doesn't have it.net.md_5.bungee.api.chat.BaseComponent[][]create()net.md_5.bungee.api.chat.BaseComponent[]static net.md_5.bungee.api.chat.TextComponentduplicate(net.md_5.bungee.api.chat.TextComponent component) static net.md_5.bungee.api.chat.BaseComponent[]fromLegacyText(String message) Deprecated.This is here just for the sake of research.voidstatic voidresetFormats(net.md_5.bungee.api.chat.BaseComponent component)
-
Field Details
-
MAXIMUM_JSON_CHAT_PACKET_SIZE
public static final int MAXIMUM_JSON_CHAT_PACKET_SIZEThe maximum bytes that theClientboundSystemChatPacket(which has the packet ID of 0x64 = 100) can send which is defined by thevoid method(PacketDataSerializer packetdataserializer)The client will not try to split
BaseComponent[] array into separate packets, internally, it just:new ClientboundSystemChatPacket(ComponentSerializer.toString(new TextComponent(BaseComponent[])))In 1.16 and below the limit seems to be 32767. https://discord.com/channels/429132410748141579/1157040462176202792
- See Also:
-
SUGGESTED_JSON_CHAT_PACKET_SIZE_RENEWAL
public static final int SUGGESTED_JSON_CHAT_PACKET_SIZE_RENEWALWhen should we start using a new packet? This will of course fail in rare cases.- See Also:
-
-
Constructor Details
-
XComponentBuilder
-
XComponentBuilder
public XComponentBuilder()
-
-
Method Details
-
duplicate
public static net.md_5.bungee.api.chat.TextComponent duplicate(net.md_5.bungee.api.chat.TextComponent component) -
copyFormatting
public static void copyFormatting(net.md_5.bungee.api.chat.BaseComponent to, net.md_5.bungee.api.chat.BaseComponent from, net.md_5.bungee.api.chat.ComponentBuilder.FormatRetention retention) Because 1.12 doesn't have it. -
append
-
append
public XComponentBuilder append(net.md_5.bungee.api.chat.BaseComponent component, net.md_5.bungee.api.chat.ComponentBuilder.FormatRetention retention) -
newPacket
public void newPacket() -
append
-
append
public XComponentBuilder append(String text, net.md_5.bungee.api.chat.ComponentBuilder.FormatRetention retention) -
createSingular
public net.md_5.bungee.api.chat.BaseComponent[] createSingular() -
create
public net.md_5.bungee.api.chat.BaseComponent[][] create() -
buildTextComponent
public net.md_5.bungee.api.chat.TextComponent buildTextComponent() -
fromLegacyText
Deprecated.This is here just for the sake of research.A modified version of the original methodTextComponent.fromLegacyText(String, ChatColor)to avoid the stupid auto URL converter.Converts the old formatting system that used
ChatColor.COLOR_CHARinto the new json based system.- Parameters:
message- the text to convert- Returns:
- the components needed to print the message to the client
-
resetFormats
public static void resetFormats(net.md_5.bungee.api.chat.BaseComponent component)
-