use of net.minecraft.server.level.EntityPlayer in project FunnyGuilds by FunnyGuilds.
the class V1_18PacketAccessor method getOrInstallChannelHandler.
@Override
public FunnyGuildsChannelHandler getOrInstallChannelHandler(Player player) {
final EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
// entityPlayer.playerConnection.networkManager.channel
final Channel channel = entityPlayer.b.a.k;
final ChannelPipeline pipeline = channel.pipeline();
return this.channelHandlerInstaller.installChannelHandlerInPipeline(pipeline);
}
use of net.minecraft.server.level.EntityPlayer in project FunnyGuilds by FunnyGuilds.
the class V1_17PacketAccessor method getOrInstallChannelHandler.
@Override
public FunnyGuildsChannelHandler getOrInstallChannelHandler(Player player) {
final EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
// entityPlayer.playerConnection.networkManager.channel
final Channel channel = entityPlayer.b.a.k;
final ChannelPipeline pipeline = channel.pipeline();
return this.channelHandlerInstaller.installChannelHandlerInPipeline(pipeline);
}
use of net.minecraft.server.level.EntityPlayer in project BedWars1058 by andrei1058.
the class v1_17_R1 method sendPlayerSpawnPackets.
@Override
public void sendPlayerSpawnPackets(Player respawned, IArena arena) {
if (respawned == null)
return;
if (arena == null)
return;
if (!arena.isPlayer(respawned))
return;
// if method was used when the player was still in re-spawning screen
if (arena.getRespawnSessions().containsKey(respawned))
return;
EntityPlayer entityPlayer = ((CraftPlayer) respawned).getHandle();
PacketPlayOutNamedEntitySpawn show = new PacketPlayOutNamedEntitySpawn(entityPlayer);
PacketPlayOutEntityVelocity playerVelocity = new PacketPlayOutEntityVelocity(entityPlayer);
PacketPlayOutEntityHeadRotation head = new PacketPlayOutEntityHeadRotation(entityPlayer, getCompressedAngle(entityPlayer.getBukkitYaw()));
List<Pair<EnumItemSlot, ItemStack>> list = new ArrayList<>();
list.add(new Pair<>(EnumItemSlot.a, entityPlayer.getItemInMainHand()));
list.add(new Pair<>(EnumItemSlot.b, entityPlayer.getItemInOffHand()));
list.add(new Pair<>(EnumItemSlot.f, entityPlayer.getInventory().getArmorContents().get(3)));
list.add(new Pair<>(EnumItemSlot.e, entityPlayer.getInventory().getArmorContents().get(2)));
list.add(new Pair<>(EnumItemSlot.d, entityPlayer.getInventory().getArmorContents().get(1)));
list.add(new Pair<>(EnumItemSlot.c, entityPlayer.getInventory().getArmorContents().get(0)));
for (Player p : arena.getPlayers()) {
if (p == null)
continue;
if (p.equals(respawned))
continue;
// if p is in re-spawning screen continue
if (arena.getRespawnSessions().containsKey(p))
continue;
EntityPlayer boundTo = ((CraftPlayer) p).getHandle();
if (p.getWorld().equals(respawned.getWorld())) {
if (respawned.getLocation().distance(p.getLocation()) <= arena.getRenderDistance()) {
// send respawned player to regular players
boundTo.b.sendPacket(show);
boundTo.b.sendPacket(head);
boundTo.b.sendPacket(playerVelocity);
boundTo.b.sendPacket(new PacketPlayOutEntityEquipment(entityPlayer.getId(), list));
// if the player has invisibility hide armor
if (p.hasPotionEffect(PotionEffectType.INVISIBILITY)) {
hideArmor(p, respawned);
} else {
PacketPlayOutNamedEntitySpawn show2 = new PacketPlayOutNamedEntitySpawn(boundTo);
PacketPlayOutEntityVelocity playerVelocity2 = new PacketPlayOutEntityVelocity(boundTo);
PacketPlayOutEntityHeadRotation head2 = new PacketPlayOutEntityHeadRotation(boundTo, getCompressedAngle(boundTo.getBukkitYaw()));
entityPlayer.b.sendPacket(show2);
entityPlayer.b.sendPacket(playerVelocity2);
entityPlayer.b.sendPacket(head2);
showArmor(p, respawned);
}
}
}
}
for (Player spectator : arena.getSpectators()) {
if (spectator == null)
continue;
if (spectator.equals(respawned))
continue;
EntityPlayer boundTo = ((CraftPlayer) spectator).getHandle();
respawned.hidePlayer(getPlugin(), spectator);
if (spectator.getWorld().equals(respawned.getWorld())) {
if (respawned.getLocation().distance(spectator.getLocation()) <= arena.getRenderDistance()) {
// send respawned player to spectator
boundTo.b.sendPacket(show);
boundTo.b.sendPacket(playerVelocity);
boundTo.b.sendPacket(new PacketPlayOutEntityEquipment(entityPlayer.getId(), list));
boundTo.b.sendPacket(new PacketPlayOutEntityHeadRotation(entityPlayer, getCompressedAngle(entityPlayer.getBukkitYaw())));
}
}
}
}
use of net.minecraft.server.level.EntityPlayer in project BedWars1058 by andrei1058.
the class v1_18_R1 method hideArmor.
@Override
public void hideArmor(Player victim, Player receiver) {
List<Pair<EnumItemSlot, ItemStack>> items = new ArrayList<>();
List<Pair<EnumItemSlot, ItemStack>> hands = new ArrayList<>();
hands.add(new Pair<>(EnumItemSlot.a, new ItemStack(Item.b(0))));
hands.add(new Pair<>(EnumItemSlot.b, new ItemStack(Item.b(0))));
items.add(new Pair<>(EnumItemSlot.f, new ItemStack(Item.b(0))));
items.add(new Pair<>(EnumItemSlot.e, new ItemStack(Item.b(0))));
items.add(new Pair<>(EnumItemSlot.d, new ItemStack(Item.b(0))));
items.add(new Pair<>(EnumItemSlot.c, new ItemStack(Item.b(0))));
PacketPlayOutEntityEquipment packet1 = new PacketPlayOutEntityEquipment(victim.getEntityId(), items);
PacketPlayOutEntityEquipment packet2 = new PacketPlayOutEntityEquipment(victim.getEntityId(), hands);
EntityPlayer pc = ((CraftPlayer) receiver).getHandle();
if (victim != receiver) {
pc.b.a(packet2);
}
pc.b.a(packet1);
}
use of net.minecraft.server.level.EntityPlayer in project BedWars1058 by andrei1058.
the class v1_18_R1 method showArmor.
@Override
public void showArmor(Player victim, Player receiver) {
List<Pair<EnumItemSlot, ItemStack>> items = new ArrayList<>();
List<Pair<EnumItemSlot, ItemStack>> hands = new ArrayList<>();
hands.add(new Pair<>(EnumItemSlot.a, CraftItemStack.asNMSCopy(victim.getInventory().getItemInMainHand())));
hands.add(new Pair<>(EnumItemSlot.b, CraftItemStack.asNMSCopy(victim.getInventory().getItemInOffHand())));
items.add(new Pair<>(EnumItemSlot.f, CraftItemStack.asNMSCopy(victim.getInventory().getHelmet())));
items.add(new Pair<>(EnumItemSlot.e, CraftItemStack.asNMSCopy(victim.getInventory().getChestplate())));
items.add(new Pair<>(EnumItemSlot.d, CraftItemStack.asNMSCopy(victim.getInventory().getLeggings())));
items.add(new Pair<>(EnumItemSlot.c, CraftItemStack.asNMSCopy(victim.getInventory().getBoots())));
PacketPlayOutEntityEquipment packet1 = new PacketPlayOutEntityEquipment(victim.getEntityId(), items);
PacketPlayOutEntityEquipment packet2 = new PacketPlayOutEntityEquipment(victim.getEntityId(), hands);
EntityPlayer pc = ((CraftPlayer) receiver).getHandle();
if (victim != receiver) {
pc.b.a(packet2);
}
pc.b.a(packet1);
}
Aggregations