use of net.minecraft.server.v1_16_R2.PacketPlayOutPlayerListHeaderFooter in project L2X9RebootCore by 254nm.
the class TabRunnable method run.
@Override
public void run() {
Bukkit.getOnlinePlayers().forEach(player -> {
try {
String headerStr = String.join("\n", manager.getConfig().getStringList("Header"));
String footerStr = String.join("\n", manager.getConfig().getStringList("Footer"));
IChatBaseComponent header = new ChatComponentText(manager.parsePlaceHolders(headerStr, player));
IChatBaseComponent footer = new ChatComponentText(manager.parsePlaceHolders(footerStr, player));
CraftPlayer craftPlayer = (CraftPlayer) player;
PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter();
headerField.set(packet, header);
footerField.set(packet, footer);
craftPlayer.getHandle().playerConnection.sendPacket(packet);
} catch (Throwable t) {
t.printStackTrace();
}
});
}
use of net.minecraft.server.v1_16_R2.PacketPlayOutPlayerListHeaderFooter in project PowerBoard by Xitee1.
the class version_1_11 method sendTab.
@SuppressWarnings("deprecation")
public static void sendTab(Player player, String head, String foot) {
IChatBaseComponent header = new ChatMessage(head);
IChatBaseComponent footer = new ChatMessage(foot);
PacketPlayOutPlayerListHeaderFooter tablist = new PacketPlayOutPlayerListHeaderFooter();
try {
Field headerField = tablist.getClass().getDeclaredField("a");
headerField.setAccessible(true);
headerField.set(tablist, header);
headerField.setAccessible(!headerField.isAccessible());
Field footerField = tablist.getClass().getDeclaredField("b");
footerField.setAccessible(true);
footerField.set(tablist, footer);
footerField.setAccessible(!footerField.isAccessible());
} catch (Exception e) {
e.printStackTrace();
}
CraftPlayer cp = (CraftPlayer) player;
cp.getHandle().playerConnection.sendPacket(tablist);
}
use of net.minecraft.server.v1_16_R2.PacketPlayOutPlayerListHeaderFooter in project PowerBoard by Xitee1.
the class version_1_13 method sendTab.
public static void sendTab(Player p, String msg1, String msg2) {
PacketPlayOutPlayerListHeaderFooter packetPlayOutPlayerListHeaderFooter = new PacketPlayOutPlayerListHeaderFooter();
packetPlayOutPlayerListHeaderFooter.header = IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + msg1 + "\"}");
packetPlayOutPlayerListHeaderFooter.footer = IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + msg2 + "\"}");
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packetPlayOutPlayerListHeaderFooter);
}
use of net.minecraft.server.v1_16_R2.PacketPlayOutPlayerListHeaderFooter in project TheAPI by TheDevTec.
the class v1_16_R3 method packetPlayerListHeaderFooter.
@Override
public Object packetPlayerListHeaderFooter(String header, String footer) {
PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter();
packet.header = (IChatBaseComponent) toIChatBaseComponent(ComponentAPI.toComponent(header, true));
packet.footer = (IChatBaseComponent) toIChatBaseComponent(ComponentAPI.toComponent(footer, true));
return packet;
}
use of net.minecraft.server.v1_16_R2.PacketPlayOutPlayerListHeaderFooter in project TheAPI by TheDevTec.
the class v1_14_R1 method packetPlayerListHeaderFooter.
@Override
public Object packetPlayerListHeaderFooter(String header, String footer) {
PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter();
packet.header = (IChatBaseComponent) toIChatBaseComponent(ComponentAPI.toComponent(header, true));
packet.footer = (IChatBaseComponent) toIChatBaseComponent(ComponentAPI.toComponent(footer, true));
return packet;
}
Aggregations