Search in sources :

Example 21 with PacketPlayOutPlayerListHeaderFooter

use of net.minecraft.server.v1_13_R1.PacketPlayOutPlayerListHeaderFooter in project PowerBoard by Xitee1.

the class version_1_10 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);
}
Also used : Field(java.lang.reflect.Field) PacketPlayOutPlayerListHeaderFooter(net.minecraft.server.v1_10_R1.PacketPlayOutPlayerListHeaderFooter) ChatMessage(net.minecraft.server.v1_10_R1.ChatMessage) IChatBaseComponent(net.minecraft.server.v1_10_R1.IChatBaseComponent) CraftPlayer(org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer)

Example 22 with PacketPlayOutPlayerListHeaderFooter

use of net.minecraft.server.v1_13_R1.PacketPlayOutPlayerListHeaderFooter in project PowerBoard by Xitee1.

the class version_1_12 method sendTab.

@SuppressWarnings("deprecation")
public static void sendTab(Player p, String header, String footer) {
    IChatBaseComponent tabheader = ChatSerializer.a("{\"text\": \"" + header + "\"}");
    IChatBaseComponent tabfooter = ChatSerializer.a("{\"text\": \"" + footer + "\"}");
    PacketPlayOutPlayerListHeaderFooter tablist = new PacketPlayOutPlayerListHeaderFooter();
    try {
        Field headerField = tablist.getClass().getDeclaredField("a");
        headerField.setAccessible(true);
        headerField.set(tablist, tabheader);
        headerField.setAccessible(!headerField.isAccessible());
        Field footerField = tablist.getClass().getDeclaredField("b");
        footerField.setAccessible(true);
        footerField.set(tablist, tabfooter);
        footerField.setAccessible(!footerField.isAccessible());
    } catch (Exception var11) {
        var11.printStackTrace();
    } finally {
        ((CraftPlayer) p).getHandle().playerConnection.sendPacket(tablist);
    }
}
Also used : Field(java.lang.reflect.Field) PacketPlayOutPlayerListHeaderFooter(net.minecraft.server.v1_12_R1.PacketPlayOutPlayerListHeaderFooter) IChatBaseComponent(net.minecraft.server.v1_12_R1.IChatBaseComponent) CraftPlayer(org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer)

Example 23 with PacketPlayOutPlayerListHeaderFooter

use of net.minecraft.server.v1_13_R1.PacketPlayOutPlayerListHeaderFooter in project PowerBoard by Xitee1.

the class version_1_14 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);
}
Also used : PacketPlayOutPlayerListHeaderFooter(net.minecraft.server.v1_14_R1.PacketPlayOutPlayerListHeaderFooter) CraftPlayer(org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer)

Example 24 with PacketPlayOutPlayerListHeaderFooter

use of net.minecraft.server.v1_13_R1.PacketPlayOutPlayerListHeaderFooter in project PowerBoard by Xitee1.

the class version_1_15 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);
}
Also used : PacketPlayOutPlayerListHeaderFooter(net.minecraft.server.v1_15_R1.PacketPlayOutPlayerListHeaderFooter) CraftPlayer(org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer)

Example 25 with PacketPlayOutPlayerListHeaderFooter

use of net.minecraft.server.v1_13_R1.PacketPlayOutPlayerListHeaderFooter in project PowerBoard by Xitee1.

the class version_1_16 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);
}
Also used : PacketPlayOutPlayerListHeaderFooter(net.minecraft.server.v1_16_R3.PacketPlayOutPlayerListHeaderFooter) CraftPlayer(org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer)

Aggregations

GameProfile (com.mojang.authlib.GameProfile)18 SkinTexture (net.dzikoysk.funnyguilds.nms.api.playerlist.SkinTexture)9 PacketPlayOutPlayerListHeaderFooter (net.minecraft.server.v1_12_R1.PacketPlayOutPlayerListHeaderFooter)5 PacketPlayOutPlayerListHeaderFooter (net.minecraft.server.v1_10_R1.PacketPlayOutPlayerListHeaderFooter)4 PacketPlayOutPlayerListHeaderFooter (net.minecraft.server.v1_11_R1.PacketPlayOutPlayerListHeaderFooter)4 IChatBaseComponent (net.minecraft.server.v1_12_R1.IChatBaseComponent)4 PacketPlayOutPlayerListHeaderFooter (net.minecraft.server.v1_13_R2.PacketPlayOutPlayerListHeaderFooter)4 PacketPlayOutPlayerListHeaderFooter (net.minecraft.server.v1_14_R1.PacketPlayOutPlayerListHeaderFooter)4 PacketPlayOutPlayerListHeaderFooter (net.minecraft.server.v1_15_R1.PacketPlayOutPlayerListHeaderFooter)4 PacketPlayOutPlayerListHeaderFooter (net.minecraft.server.v1_16_R3.PacketPlayOutPlayerListHeaderFooter)4 Field (java.lang.reflect.Field)3 IChatBaseComponent (net.minecraft.server.v1_10_R1.IChatBaseComponent)3 IChatBaseComponent (net.minecraft.server.v1_11_R1.IChatBaseComponent)3 PacketPlayOutPlayerListHeaderFooter (net.minecraft.server.v1_8_R3.PacketPlayOutPlayerListHeaderFooter)3 CraftPlayer (org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer)3 CraftPlayer (org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer)3 CraftPlayer (org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer)3 CraftPlayer (org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer)3 Packet (net.minecraft.server.v1_10_R1.Packet)2 PacketPlayOutPlayerInfo (net.minecraft.server.v1_10_R1.PacketPlayOutPlayerInfo)2