use of org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer in project Denizen-For-Bukkit by DenizenScript.
the class EntityHelper_v1_11_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, 0f, 0f, 0f);
}
use of org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer in project Denizen-For-Bukkit by DenizenScript.
the class PlayerHelper_v1_9_R2 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();
}
use of org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer in project Denizen-For-Bukkit by DenizenScript.
the class EntityHelper_v1_9_R2 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_9_R2.Entity other = ((CraftEntity) entity).getHandle();
EntityTrackerEntry entry = tracker.trackedEntities.get(other.getId());
if (entry != null) {
entry.clear(entityPlayer);
}
}
}
}
use of org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer in project Denizen-For-Bukkit by DenizenScript.
the class EntityHelper_v1_10_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_10_R1.Entity other = ((CraftEntity) entity).getHandle();
EntityTrackerEntry entry = tracker.trackedEntities.get(other.getId());
if (entry != null) {
entry.clear(entityPlayer);
}
}
}
}
use of org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer in project SpaciousLib by anhcraft.
the class Title_1_9_R1 method sendSubTitle.
@Override
public void sendSubTitle(World world, String text) {
for (Player player : world.getPlayers()) {
PacketPlayOutTitle title = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.SUBTITLE, IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', text) + "\"}"));
((CraftPlayer) player).getHandle().playerConnection.sendPacket(title);
}
}
Aggregations