Search in sources :

Example 6 with CraftPlayer

use of org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer in project Denizen-For-Bukkit by DenizenScript.

the class PlayerHelper_v1_9_R2 method showEndCredits.

@Override
public void showEndCredits(Player player) {
    ((CraftPlayer) player).getHandle().viewingCredits = true;
    ((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutGameStateChange(4, 0.0F));
}
Also used : CraftPlayer(org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer) PacketPlayOutGameStateChange(net.minecraft.server.v1_9_R2.PacketPlayOutGameStateChange)

Example 7 with CraftPlayer

use of org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer in project Denizen-For-Bukkit by DenizenScript.

the class ProfileEditor_v1_9_R2 method updatePlayer.

@Override
protected void updatePlayer(Player player, final boolean isSkinChanging) {
    final EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
    final UUID uuid = player.getUniqueId();
    PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(entityPlayer.getId());
    for (Player p : Bukkit.getServer().getOnlinePlayers()) {
        if (!p.getUniqueId().equals(uuid)) {
            PacketHelper_v1_9_R2.sendPacket(p, destroyPacket);
        }
    }
    new BukkitRunnable() {

        @Override
        public void run() {
            PacketPlayOutPlayerInfo playerInfo = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, entityPlayer);
            PacketPlayOutNamedEntitySpawn spawnPacket = new PacketPlayOutNamedEntitySpawn(entityPlayer);
            for (Player player : Bukkit.getServer().getOnlinePlayers()) {
                PacketHelper_v1_9_R2.sendPacket(player, playerInfo);
                if (!player.getUniqueId().equals(uuid)) {
                    PacketHelper_v1_9_R2.sendPacket(player, spawnPacket);
                } else {
                    if (isSkinChanging) {
                        boolean isFlying = player.isFlying();
                        PacketHelper_v1_9_R2.sendPacket(player, new PacketPlayOutRespawn(player.getWorld().getEnvironment().getId(), entityPlayer.getWorld().getDifficulty(), entityPlayer.getWorld().worldData.getType(), entityPlayer.playerInteractManager.getGameMode()));
                        player.teleport(player.getLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN);
                        player.setFlying(isFlying);
                    }
                    player.updateInventory();
                }
            }
        }
    }.runTaskLater(NMSHandler.getJavaPlugin(), 5);
}
Also used : Player(org.bukkit.entity.Player) EntityPlayer(net.minecraft.server.v1_9_R2.EntityPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer) PacketPlayOutNamedEntitySpawn(net.minecraft.server.v1_9_R2.PacketPlayOutNamedEntitySpawn) PacketPlayOutEntityDestroy(net.minecraft.server.v1_9_R2.PacketPlayOutEntityDestroy) EntityPlayer(net.minecraft.server.v1_9_R2.EntityPlayer) BukkitRunnable(org.bukkit.scheduler.BukkitRunnable) CraftPlayer(org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer) PacketPlayOutPlayerInfo(net.minecraft.server.v1_9_R2.PacketPlayOutPlayerInfo) PacketPlayOutRespawn(net.minecraft.server.v1_9_R2.PacketPlayOutRespawn) UUID(java.util.UUID)

Example 8 with CraftPlayer

use of org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer in project Denizen-For-Bukkit by DenizenScript.

the class EntityHelper_v1_11_R1 method hideEntity.

@Override
public void hideEntity(Player player, Entity entity, boolean keepInTabList) {
    // Use Bukkit API for Player entities
    if (entity instanceof Player) {
        player.hidePlayer((Player) entity);
        return;
    }
    CraftPlayer craftPlayer = (CraftPlayer) player;
    EntityPlayer entityPlayer = craftPlayer.getHandle();
    UUID playerUUID = player.getUniqueId();
    if (entityPlayer.playerConnection != null && !craftPlayer.equals(entity)) {
        if (!hiddenEntities.containsKey(playerUUID)) {
            hiddenEntities.put(playerUUID, new HashSet<UUID>());
        }
        Set hidden = hiddenEntities.get(playerUUID);
        UUID entityUUID = entity.getUniqueId();
        if (!hidden.contains(entityUUID)) {
            hidden.add(entityUUID);
            EntityTracker tracker = ((WorldServer) craftPlayer.getHandle().world).tracker;
            net.minecraft.server.v1_11_R1.Entity other = ((CraftEntity) entity).getHandle();
            EntityTrackerEntry entry = tracker.trackedEntities.get(other.getId());
            if (entry != null) {
                entry.clear(entityPlayer);
            }
        }
    }
}
Also used : CraftPlayer(org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer) HashSet(java.util.HashSet) Set(java.util.Set) CraftEntity(org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity) CraftPlayer(org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer) CompoundTag_v1_11_R1(net.aufdemrand.denizen.nms.impl.jnbt.CompoundTag_v1_11_R1) net.minecraft.server.v1_11_R1(net.minecraft.server.v1_11_R1) UUID(java.util.UUID)

Example 9 with CraftPlayer

use of org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer in project Denizen-For-Bukkit by DenizenScript.

the class PlayerHelper_v1_11_R1 method setTemporaryOp.

@Override
public void setTemporaryOp(Player player, boolean op) {
    MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
    GameProfile profile = ((CraftPlayer) player).getProfile();
    OpList opList = server.getPlayerList().getOPs();
    if (op) {
        int permLevel = server.q();
        opList.add(new OpListEntry(profile, permLevel, opList.b(profile)));
    } else {
        opList.remove(profile);
    }
    player.recalculatePermissions();
}
Also used : OpList(net.minecraft.server.v1_11_R1.OpList) GameProfile(com.mojang.authlib.GameProfile) CraftPlayer(org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer) CraftServer(org.bukkit.craftbukkit.v1_11_R1.CraftServer) OpListEntry(net.minecraft.server.v1_11_R1.OpListEntry) MinecraftServer(net.minecraft.server.v1_11_R1.MinecraftServer)

Example 10 with CraftPlayer

use of org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer in project Denizen-For-Bukkit by DenizenScript.

the class PlayerHelper_v1_11_R1 method showEndCredits.

@Override
public void showEndCredits(Player player) {
    ((CraftPlayer) player).getHandle().viewingCredits = true;
    ((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutGameStateChange(4, 0.0F));
}
Also used : CraftPlayer(org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer) PacketPlayOutGameStateChange(net.minecraft.server.v1_11_R1.PacketPlayOutGameStateChange)

Aggregations

Player (org.bukkit.entity.Player)85 CraftPlayer (org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer)36 CraftPlayer (org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer)27 CraftPlayer (org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer)26 CraftPlayer (org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer)26 MyPetPlayer (de.Keyle.MyPet.api.player.MyPetPlayer)24 CraftPlayer (org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer)23 Behavior (de.Keyle.MyPet.api.skill.skills.Behavior)21 CraftPlayer (org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer)18 CraftPlayer (org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer)18 BukkitRunnable (org.bukkit.scheduler.BukkitRunnable)18 UUID (java.util.UUID)15 ServerPlayer (net.minecraft.server.level.ServerPlayer)15 CraftPlayer (org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer)15 GameProfile (com.mojang.authlib.GameProfile)14 CraftPlayer (org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer)14 CraftPlayer (org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer)14 CraftPlayer (org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer)11 PacketPlayOutTitle (net.minecraft.server.v1_12_R1.PacketPlayOutTitle)10 MyPetFeedEvent (de.Keyle.MyPet.api.event.MyPetFeedEvent)8