Search in sources :

Example 1 with ChatMessage

use of net.minecraft.server.v1_16_R3.ChatMessage in project PublicCrafters by BananaPuncher714.

the class ContainerManager_v1_16_R3 method openWorkbench.

@Override
public void openWorkbench(Player player, Location loc, InventoryType type) {
    TileInventory tileEntity = new TileInventory(new CustomTileEntityContainerWorkbench(this, loc), new ChatMessage("container.crafting", new Object[0]));
    ((CraftPlayer) player).getHandle().openContainer(tileEntity);
}
Also used : ChatMessage(net.minecraft.server.v1_16_R3.ChatMessage) TileInventory(net.minecraft.server.v1_16_R3.TileInventory)

Example 2 with ChatMessage

use of net.minecraft.server.v1_16_R3.ChatMessage 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);
}
Also used : Field(java.lang.reflect.Field) PacketPlayOutPlayerListHeaderFooter(net.minecraft.server.v1_11_R1.PacketPlayOutPlayerListHeaderFooter) ChatMessage(net.minecraft.server.v1_11_R1.ChatMessage) IChatBaseComponent(net.minecraft.server.v1_11_R1.IChatBaseComponent) CraftPlayer(org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer)

Example 3 with ChatMessage

use of net.minecraft.server.v1_16_R3.ChatMessage 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 4 with ChatMessage

use of net.minecraft.server.v1_16_R3.ChatMessage in project PublicCrafters by BananaPuncher714.

the class ContainerManager_v1_14_R1 method openWorkbench.

@Override
public void openWorkbench(Player player, Location loc, InventoryType type) {
    TileInventory tileEntity = new TileInventory(new CustomTileEntityContainerWorkbench(this, loc), new ChatMessage("container.crafting", new Object[0]));
    ((CraftPlayer) player).getHandle().openContainer(tileEntity);
}
Also used : ChatMessage(net.minecraft.server.v1_14_R1.ChatMessage) TileInventory(net.minecraft.server.v1_14_R1.TileInventory)

Example 5 with ChatMessage

use of net.minecraft.server.v1_16_R3.ChatMessage in project PublicCrafters by BananaPuncher714.

the class ContainerManager_v1_15_R1 method openWorkbench.

@Override
public void openWorkbench(Player player, Location loc, InventoryType type) {
    TileInventory tileEntity = new TileInventory(new CustomTileEntityContainerWorkbench(this, loc), new ChatMessage("container.crafting", new Object[0]));
    ((CraftPlayer) player).getHandle().openContainer(tileEntity);
}
Also used : ChatMessage(net.minecraft.server.v1_15_R1.ChatMessage) TileInventory(net.minecraft.server.v1_15_R1.TileInventory)

Aggregations

Field (java.lang.reflect.Field)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ChatMessage (net.minecraft.server.v1_10_R1.ChatMessage)1 IChatBaseComponent (net.minecraft.server.v1_10_R1.IChatBaseComponent)1 PacketPlayOutPlayerListHeaderFooter (net.minecraft.server.v1_10_R1.PacketPlayOutPlayerListHeaderFooter)1 ChatMessage (net.minecraft.server.v1_11_R1.ChatMessage)1 IChatBaseComponent (net.minecraft.server.v1_11_R1.IChatBaseComponent)1 PacketPlayOutPlayerListHeaderFooter (net.minecraft.server.v1_11_R1.PacketPlayOutPlayerListHeaderFooter)1 ChatClickable (net.minecraft.server.v1_12_R1.ChatClickable)1 ChatComponentText (net.minecraft.server.v1_12_R1.ChatComponentText)1 ChatMessage (net.minecraft.server.v1_12_R1.ChatMessage)1 ChatModifier (net.minecraft.server.v1_12_R1.ChatModifier)1 IChatBaseComponent (net.minecraft.server.v1_12_R1.IChatBaseComponent)1 ChatMessage (net.minecraft.server.v1_14_R1.ChatMessage)1 TileInventory (net.minecraft.server.v1_14_R1.TileInventory)1 ChatMessage (net.minecraft.server.v1_15_R1.ChatMessage)1 TileInventory (net.minecraft.server.v1_15_R1.TileInventory)1 ChatMessage (net.minecraft.server.v1_16_R1.ChatMessage)1 TileInventory (net.minecraft.server.v1_16_R1.TileInventory)1