use of net.minecraft.server.v1_16_R2.PacketPlayOutRespawn 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);
}
use of net.minecraft.server.v1_16_R2.PacketPlayOutRespawn in project Denizen-For-Bukkit by DenizenScript.
the class ProfileEditor_v1_11_R1 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_11_R1.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_11_R1.sendPacket(player, playerInfo);
if (!player.getUniqueId().equals(uuid)) {
PacketHelper_v1_11_R1.sendPacket(player, spawnPacket);
} else {
if (isSkinChanging) {
boolean isFlying = player.isFlying();
PacketHelper_v1_11_R1.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);
}
use of net.minecraft.server.v1_16_R2.PacketPlayOutRespawn in project TheAPI by TheDevTec.
the class v1_10_R1 method packetRespawn.
@Override
public Object packetRespawn(Player player) {
EntityPlayer entityPlayer = (EntityPlayer) getPlayer(player);
WorldServer worldserver = entityPlayer.x();
byte actualDimension = (byte) worldserver.getWorld().getEnvironment().getId();
return new PacketPlayOutRespawn((byte) ((actualDimension >= 0) ? -1 : 0), worldserver.getDifficulty(), worldserver.getWorldData().getType(), entityPlayer.playerInteractManager.getGameMode());
}
use of net.minecraft.server.v1_16_R2.PacketPlayOutRespawn in project TheAPI by TheDevTec.
the class v1_13_R1 method packetRespawn.
@Override
public Object packetRespawn(Player player) {
EntityPlayer entityPlayer = (EntityPlayer) getPlayer(player);
WorldServer worldserver = entityPlayer.getWorldServer();
byte actualDimension = (byte) worldserver.getWorld().getEnvironment().getId();
return new PacketPlayOutRespawn((byte) ((actualDimension >= 0) ? -1 : 0), worldserver.getDifficulty(), worldserver.getWorldData().getType(), entityPlayer.playerInteractManager.getGameMode());
}
use of net.minecraft.server.v1_16_R2.PacketPlayOutRespawn in project TheAPI by TheDevTec.
the class v1_16_R2 method packetRespawn.
@Override
public Object packetRespawn(Player player) {
EntityPlayer entityPlayer = (EntityPlayer) getPlayer(player);
WorldServer worldserver = entityPlayer.getWorldServer();
return new PacketPlayOutRespawn(worldserver.getDimensionManager(), worldserver.getDimensionKey(), BiomeManager.a(worldserver.getSeed()), entityPlayer.playerInteractManager.getGameMode(), entityPlayer.playerInteractManager.c(), worldserver.isDebugWorld(), worldserver.isFlatWorld(), true);
}
Aggregations