use of org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer in project MyPet by xXKeyleXx.
the class PlatformHelper method getPlayerLanguage.
public String getPlayerLanguage(Player player) {
if (!(player instanceof CraftPlayer)) {
return "en_US";
}
EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
Object lang = ReflectionUtil.getFieldValue(EntityPlayer_locale_FIELD, entityPlayer);
if (lang == null) {
return "en_US";
}
return lang.toString();
}
use of org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer in project Denizen-For-Bukkit by DenizenScript.
the class Handler_v1_8_R3 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);
}
use of org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer in project Denizen-For-Bukkit by DenizenScript.
the class Handler_v1_9_R2 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);
}
use of org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer in project Denizen-For-Bukkit by DenizenScript.
the class PlayerHelper_v1_8_R3 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.p();
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 ProfileEditor_v1_8_R3 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_8_R3.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_8_R3.sendPacket(player, playerInfo);
if (!player.getUniqueId().equals(uuid)) {
PacketHelper_v1_8_R3.sendPacket(player, spawnPacket);
} else {
if (isSkinChanging) {
boolean isFlying = player.isFlying();
PacketHelper_v1_8_R3.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);
}
Aggregations