Search in sources :

Example 21 with EntityPlayer

use of net.minecraft.server.v1_16_R2.EntityPlayer in project WildChests by BG-Software-LLC.

the class NMSInventory_v1_16_R3 method openPage.

@Override
public void openPage(Player player, com.bgsoftware.wildchests.objects.inventory.CraftWildInventory inventory) {
    EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
    String title = inventory.getTitle();
    Container container = createContainer(entityPlayer.nextContainerCounter(), entityPlayer.inventory, inventory);
    container.setTitle(new ChatComponentText(title));
    entityPlayer.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, container.getType(), container.getTitle()));
    entityPlayer.activeContainer = container;
    entityPlayer.activeContainer.addSlotListener(entityPlayer);
}
Also used : Container(net.minecraft.server.v1_16_R3.Container) TileEntityContainer(com.bgsoftware.wildchests.objects.containers.TileEntityContainer) EntityPlayer(net.minecraft.server.v1_16_R3.EntityPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer) PacketPlayOutOpenWindow(net.minecraft.server.v1_16_R3.PacketPlayOutOpenWindow) ChatComponentText(net.minecraft.server.v1_16_R3.ChatComponentText)

Example 22 with EntityPlayer

use of net.minecraft.server.v1_16_R2.EntityPlayer in project CokesAddon by Cokes86.

the class v1_14_R1 method isChanged.

@Override
public boolean isChanged(Player player) {
    CraftPlayer cp = (CraftPlayer) player;
    boolean skin = false;
    boolean nameTag = false;
    Iterator<Property> iterator = cp.getProfile().getProperties().get("textures").iterator();
    if (iterator.hasNext() && origin.containsKey(player.getUniqueId())) {
        Property property = iterator.next();
        skin = property != origin.get(player.getUniqueId()).getRight();
        EntityPlayer enp = cp.getHandle();
        nameTag = !origin.get(player.getUniqueId()).getLeft().equals(enp.getProfile().getName());
    }
    return skin || nameTag;
}
Also used : EntityPlayer(net.minecraft.server.v1_14_R1.EntityPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer) Property(com.mojang.authlib.properties.Property)

Example 23 with EntityPlayer

use of net.minecraft.server.v1_16_R2.EntityPlayer in project CokesAddon by Cokes86.

the class v1_15_R1 method isChanged.

@Override
public boolean isChanged(Player player) {
    CraftPlayer cp = (CraftPlayer) player;
    boolean skin = false;
    boolean nameTag = false;
    Iterator<Property> iterator = cp.getProfile().getProperties().get("textures").iterator();
    if (iterator.hasNext() && origin.containsKey(player.getUniqueId())) {
        Property property = iterator.next();
        skin = property != origin.get(player.getUniqueId()).getRight();
        EntityPlayer enp = cp.getHandle();
        nameTag = !origin.get(player.getUniqueId()).getLeft().equals(enp.getProfile().getName());
    }
    return skin || nameTag;
}
Also used : EntityPlayer(net.minecraft.server.v1_15_R1.EntityPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer) Property(com.mojang.authlib.properties.Property)

Example 24 with EntityPlayer

use of net.minecraft.server.v1_16_R2.EntityPlayer in project CokesAddon by Cokes86.

the class v1_16_R3 method setPlayerNameTag.

@Override
public void setPlayerNameTag(Player p, UUID uuid) {
    if (origin.containsKey(uuid)) {
        try {
            EntityPlayer enp = ((CraftPlayer) p).getHandle();
            Object obj = enp.getClass().getMethod("getProfile", new Class[0]).invoke(enp);
            Field nameField = obj.getClass().getDeclaredField("name");
            nameField.setAccessible(true);
            nameField.set(obj, origin.get(uuid).getLeft());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
Also used : Field(java.lang.reflect.Field) EntityPlayer(net.minecraft.server.v1_16_R3.EntityPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer)

Example 25 with EntityPlayer

use of net.minecraft.server.v1_16_R2.EntityPlayer in project CokesAddon by Cokes86.

the class v1_16_R3 method isChanged.

@Override
public boolean isChanged(Player player) {
    CraftPlayer cp = (CraftPlayer) player;
    boolean skin = false;
    boolean nameTag = false;
    Iterator<Property> iterator = cp.getProfile().getProperties().get("textures").iterator();
    if (iterator.hasNext() && origin.containsKey(player.getUniqueId())) {
        Property property = iterator.next();
        skin = property != origin.get(player.getUniqueId()).getRight();
        EntityPlayer enp = cp.getHandle();
        nameTag = !origin.get(player.getUniqueId()).getLeft().equals(enp.getProfile().getName());
    }
    return skin || nameTag;
}
Also used : EntityPlayer(net.minecraft.server.v1_16_R3.EntityPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer) Property(com.mojang.authlib.properties.Property)

Aggregations

Player (org.bukkit.entity.Player)65 EntityPlayer (net.minecraft.server.v1_8_R3.EntityPlayer)26 EntityPlayer (net.minecraft.server.v1_12_R1.EntityPlayer)24 EntityPlayer (net.minecraft.server.v1_16_R3.EntityPlayer)23 EntityPlayer (net.minecraft.server.v1_10_R1.EntityPlayer)20 EntityPlayer (net.minecraft.server.v1_11_R1.EntityPlayer)20 NPCHolder (net.citizensnpcs.npc.ai.NPCHolder)19 SkinnableEntity (net.citizensnpcs.npc.skin.SkinnableEntity)19 EntityPlayer (net.minecraft.server.v1_13_R2.EntityPlayer)19 EntityPlayer (net.minecraft.server.v1_15_R1.EntityPlayer)18 CraftPlayer (org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer)17 GameProfile (com.mojang.authlib.GameProfile)16 MyPet (de.Keyle.MyPet.api.entity.MyPet)16 EntityPlayer (net.minecraft.server.v1_14_R1.EntityPlayer)16 OfflinePlayer (org.bukkit.OfflinePlayer)15 CraftPlayer (org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer)15 CraftPlayer (org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer)15 EntityPlayer (net.minecraft.server.v1_9_R2.EntityPlayer)13 CraftPlayer (org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer)13 CraftPlayer (org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer)13