Search in sources :

Example 1 with CraftPlayer

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

the class Handler_v1_10_R1 method getPlayerProfile.

@Override
public PlayerProfile getPlayerProfile(Player player) {
    GameProfile gameProfile = ((CraftPlayer) player).getProfile();
    Property property = Iterables.getFirst(gameProfile.getProperties().get("textures"), null);
    return new PlayerProfile(gameProfile.getName(), gameProfile.getId(), property != null ? property.getValue() : null, property != null ? property.getSignature() : null);
}
Also used : GameProfile(com.mojang.authlib.GameProfile) PlayerProfile(net.aufdemrand.denizen.nms.util.PlayerProfile) CraftPlayer(org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer) Property(com.mojang.authlib.properties.Property)

Example 2 with CraftPlayer

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

the class EntityHelper_v1_10_R1 method forceInteraction.

/*
        General Entity Methods
     */
@Override
public void forceInteraction(Player player, Location location) {
    CraftPlayer craftPlayer = (CraftPlayer) player;
    BlockPosition pos = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
    Block.getById(location.getBlock().getType().getId()).interact(((CraftWorld) location.getWorld()).getHandle(), pos, ((CraftWorld) location.getWorld()).getHandle().getType(pos), craftPlayer != null ? craftPlayer.getHandle() : null, EnumHand.MAIN_HAND, null, EnumDirection.NORTH, 0f, 0f, 0f);
}
Also used : CraftPlayer(org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer) CraftWorld(org.bukkit.craftbukkit.v1_10_R1.CraftWorld)

Example 3 with CraftPlayer

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

the class EntityHelper_v1_10_R1 method unhideEntity.

@Override
public void unhideEntity(Player player, Entity entity) {
    // Use Bukkit API for Player entities
    if (entity instanceof Player) {
        player.showPlayer((Player) entity);
        return;
    }
    CraftPlayer craftPlayer = (CraftPlayer) player;
    EntityPlayer entityPlayer = craftPlayer.getHandle();
    UUID playerUUID = player.getUniqueId();
    if (entityPlayer.playerConnection != null && !craftPlayer.equals(entity) && hiddenEntities.containsKey(playerUUID)) {
        Set hidden = hiddenEntities.get(playerUUID);
        UUID entityUUID = entity.getUniqueId();
        if (hidden.contains(entityUUID)) {
            hidden.remove(entityUUID);
            EntityTracker tracker = ((WorldServer) craftPlayer.getHandle().world).tracker;
            net.minecraft.server.v1_10_R1.Entity other = ((CraftEntity) entity).getHandle();
            EntityTrackerEntry entry = tracker.trackedEntities.get(other.getId());
            if (entry != null && !entry.trackedPlayers.contains(entityPlayer)) {
                entry.updatePlayer(entityPlayer);
            }
        }
    }
}
Also used : CraftPlayer(org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer) HashSet(java.util.HashSet) Set(java.util.Set) CraftEntity(org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity) net.minecraft.server.v1_10_R1(net.minecraft.server.v1_10_R1) CompoundTag_v1_10_R1(net.aufdemrand.denizen.nms.impl.jnbt.CompoundTag_v1_10_R1) CraftPlayer(org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer) UUID(java.util.UUID)

Example 4 with CraftPlayer

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

the class EntityHelper_v1_9_R2 method forceInteraction.

/*
        General Entity Methods
     */
@Override
public void forceInteraction(Player player, Location location) {
    CraftPlayer craftPlayer = (CraftPlayer) player;
    BlockPosition pos = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
    Block.getById(location.getBlock().getType().getId()).interact(((CraftWorld) location.getWorld()).getHandle(), pos, ((CraftWorld) location.getWorld()).getHandle().getType(pos), craftPlayer != null ? craftPlayer.getHandle() : null, EnumHand.MAIN_HAND, null, EnumDirection.NORTH, 0f, 0f, 0f);
}
Also used : CraftPlayer(org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer) CraftWorld(org.bukkit.craftbukkit.v1_9_R2.CraftWorld)

Example 5 with CraftPlayer

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

the class EntityHelper_v1_9_R2 method unhideEntity.

@Override
public void unhideEntity(Player player, Entity entity) {
    // Use Bukkit API for Player entities
    if (entity instanceof Player) {
        player.showPlayer((Player) entity);
        return;
    }
    CraftPlayer craftPlayer = (CraftPlayer) player;
    EntityPlayer entityPlayer = craftPlayer.getHandle();
    UUID playerUUID = player.getUniqueId();
    if (entityPlayer.playerConnection != null && !craftPlayer.equals(entity) && hiddenEntities.containsKey(playerUUID)) {
        Set hidden = hiddenEntities.get(playerUUID);
        UUID entityUUID = entity.getUniqueId();
        if (hidden.contains(entityUUID)) {
            hidden.remove(entityUUID);
            EntityTracker tracker = ((WorldServer) craftPlayer.getHandle().world).tracker;
            net.minecraft.server.v1_9_R2.Entity other = ((CraftEntity) entity).getHandle();
            EntityTrackerEntry entry = tracker.trackedEntities.get(other.getId());
            if (entry != null && !entry.trackedPlayers.contains(entityPlayer)) {
                entry.updatePlayer(entityPlayer);
            }
        }
    }
}
Also used : CraftPlayer(org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer) HashSet(java.util.HashSet) Set(java.util.Set) net.minecraft.server.v1_9_R2(net.minecraft.server.v1_9_R2) CompoundTag_v1_9_R2(net.aufdemrand.denizen.nms.impl.jnbt.CompoundTag_v1_9_R2) CraftEntity(org.bukkit.craftbukkit.v1_9_R2.entity.CraftEntity) CraftPlayer(org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer) UUID(java.util.UUID)

Aggregations

Player (org.bukkit.entity.Player)224 ServerPlayer (net.minecraft.server.level.ServerPlayer)126 CraftPlayer (org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer)101 CraftPlayer (org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer)74 Location (org.bukkit.Location)68 CraftPlayer (org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer)62 CraftPlayer (org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer)60 BukkitRunnable (org.bukkit.scheduler.BukkitRunnable)57 CraftPlayer (org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer)50 CraftPlayer (org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer)49 CraftPlayer (org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer)47 CraftPlayer (org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer)41 CraftPlayer (org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer)41 CraftPlayer (org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer)41 Property (com.mojang.authlib.properties.Property)40 GameProfile (com.mojang.authlib.GameProfile)37 CraftPlayer (org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer)36 CraftPlayer (org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer)35 MyPetPlayer (de.Keyle.MyPet.api.player.MyPetPlayer)24 EntityPlayer (net.minecraft.server.level.EntityPlayer)24