Java Code Examples for cn.nukkit.Player#equals()
The following examples show how to use
cn.nukkit.Player#equals() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Entity.java From Jupiter with GNU General Public License v3.0 | 6 votes |
public Player getMinDistancePlayer(double maxDistance){ Player result = null; double distance = Double.MAX_VALUE; if (maxDistance <= 0) maxDistance = Double.MAX_VALUE; for (Player player : this.getLevel().getPlayers().values()){ if (maxDistance != 0){ if (!(player.equals(this)) && this.distance(player) < distance && this.distance(player) < maxDistance){ result = player; distance = this.distance(player); } } } return result; }
Example 2
Source File: PlayerInventory.java From Jupiter with GNU General Public License v3.0 | 6 votes |
public void sendHeldItem(Player... players) { Item item = this.getItemInHand(); MobEquipmentPacket pk = new MobEquipmentPacket(); pk.item = item; pk.inventorySlot = pk.hotbarSlot = this.getHeldItemIndex(); for (Player player : players) { pk.entityRuntimeId = this.getHolder().getId(); if (player.equals(this.getHolder())) { pk.entityRuntimeId = player.getId(); this.sendSlot(this.getHeldItemIndex(), player); } player.dataPacket(pk); } }
Example 3
Source File: PlayerInventory.java From Jupiter with GNU General Public License v3.0 | 6 votes |
public void sendArmorContents(Player[] players) { Item[] armor = this.getArmorContents(); MobArmorEquipmentPacket pk = new MobArmorEquipmentPacket(); pk.eid = this.getHolder().getId(); pk.slots = armor; pk.encode(); pk.isEncoded = true; for (Player player : players) { if (player.equals(this.getHolder())) { InventoryContentPacket pk2 = new InventoryContentPacket(); pk2.inventoryId = InventoryContentPacket.SPECIAL_ARMOR; pk2.slots = armor; player.dataPacket(pk2); } else { player.dataPacket(pk); } } }
Example 4
Source File: PlayerInventory.java From Jupiter with GNU General Public License v3.0 | 6 votes |
public void sendArmorSlot(int index, Player[] players) { Item[] armor = this.getArmorContents(); MobArmorEquipmentPacket pk = new MobArmorEquipmentPacket(); pk.eid = this.getHolder().getId(); pk.slots = armor; pk.encode(); pk.isEncoded = true; for (Player player : players) { if (player.equals(this.getHolder())) { InventorySlotPacket pk2 = new InventorySlotPacket(); pk2.inventoryId = InventoryContentPacket.SPECIAL_ARMOR; pk2.slot = index - this.getSize(); pk2.item = this.getItem(index); player.dataPacket(pk2); } else { player.dataPacket(pk); } } }
Example 5
Source File: PlayerInventory.java From Jupiter with GNU General Public License v3.0 | 6 votes |
@Override public void sendSlot(int index, Player... players) { InventorySlotPacket pk = new InventorySlotPacket(); pk.slot = index; pk.item = this.getItem(index).clone(); for (Player player : players) { if (player.equals(this.getHolder())) { pk.inventoryId = ContainerIds.INVENTORY; player.dataPacket(pk); } else { int id = player.getWindowId(this); if (id == -1) { this.close(player); continue; } pk.inventoryId = id; player.dataPacket(pk.clone()); } } }
Example 6
Source File: PlayerOffhandInventory.java From Jupiter with GNU General Public License v3.0 | 6 votes |
@Override public void sendSlot(int index, Player... players) { InventorySlotPacket pk = new InventorySlotPacket(); pk.slot = index; pk.item = this.getItem(index).clone(); for (Player player : players) { if (player.equals(this.getHolder())) { pk.inventoryId = ContainerIds.OFFHAND; player.dataPacket(pk); } else { int id = player.getWindowId(this); if (id == -1) { this.close(player); continue; } pk.inventoryId = id; player.dataPacket(pk.clone()); } } }
Example 7
Source File: PlayerInventory.java From Nukkit with GNU General Public License v3.0 | 6 votes |
public void sendHeldItem(Player... players) { Item item = this.getItemInHand(); MobEquipmentPacket pk = new MobEquipmentPacket(); pk.item = item; pk.inventorySlot = pk.hotbarSlot = this.getHeldItemIndex(); for (Player player : players) { pk.eid = this.getHolder().getId(); if (player.equals(this.getHolder())) { pk.eid = player.getId(); this.sendSlot(this.getHeldItemIndex(), player); } player.dataPacket(pk); } }
Example 8
Source File: PlayerInventory.java From Nukkit with GNU General Public License v3.0 | 6 votes |
public void sendArmorContents(Player[] players) { Item[] armor = this.getArmorContents(); MobArmorEquipmentPacket pk = new MobArmorEquipmentPacket(); pk.eid = this.getHolder().getId(); pk.slots = armor; pk.encode(); pk.isEncoded = true; for (Player player : players) { if (player.equals(this.getHolder())) { InventoryContentPacket pk2 = new InventoryContentPacket(); pk2.inventoryId = InventoryContentPacket.SPECIAL_ARMOR; pk2.slots = armor; player.dataPacket(pk2); } else { player.dataPacket(pk); } } }
Example 9
Source File: PlayerInventory.java From Nukkit with GNU General Public License v3.0 | 6 votes |
public void sendArmorSlot(int index, Player[] players) { Item[] armor = this.getArmorContents(); MobArmorEquipmentPacket pk = new MobArmorEquipmentPacket(); pk.eid = this.getHolder().getId(); pk.slots = armor; pk.encode(); pk.isEncoded = true; for (Player player : players) { if (player.equals(this.getHolder())) { InventorySlotPacket pk2 = new InventorySlotPacket(); pk2.inventoryId = InventoryContentPacket.SPECIAL_ARMOR; pk2.slot = index - this.getSize(); pk2.item = this.getItem(index); player.dataPacket(pk2); } else { player.dataPacket(pk); } } }
Example 10
Source File: PlayerInventory.java From Nukkit with GNU General Public License v3.0 | 6 votes |
@Override public void sendSlot(int index, Player... players) { InventorySlotPacket pk = new InventorySlotPacket(); pk.slot = index; pk.item = this.getItem(index).clone(); for (Player player : players) { if (player.equals(this.getHolder())) { pk.inventoryId = ContainerIds.INVENTORY; player.dataPacket(pk); } else { int id = player.getWindowId(this); if (id == -1) { this.close(player); continue; } pk.inventoryId = id; player.dataPacket(pk.clone()); } } }
Example 11
Source File: PlayerInventory.java From Nukkit with GNU General Public License v3.0 | 6 votes |
public void sendHeldItem(Player... players) { Item item = this.getItemInHand(); MobEquipmentPacket pk = new MobEquipmentPacket(); pk.item = item; pk.inventorySlot = pk.hotbarSlot = this.getHeldItemIndex(); for (Player player : players) { pk.eid = this.getHolder().getId(); if (player.equals(this.getHolder())) { pk.eid = player.getId(); this.sendSlot(this.getHeldItemIndex(), player); } player.dataPacket(pk); } }
Example 12
Source File: PlayerInventory.java From Nukkit with GNU General Public License v3.0 | 6 votes |
public void sendArmorContents(Player[] players) { Item[] armor = this.getArmorContents(); MobArmorEquipmentPacket pk = new MobArmorEquipmentPacket(); pk.eid = this.getHolder().getId(); pk.slots = armor; pk.encode(); pk.isEncoded = true; for (Player player : players) { if (player.equals(this.getHolder())) { InventoryContentPacket pk2 = new InventoryContentPacket(); pk2.inventoryId = InventoryContentPacket.SPECIAL_ARMOR; pk2.slots = armor; player.dataPacket(pk2); } else { player.dataPacket(pk); } } }
Example 13
Source File: PlayerInventory.java From Nukkit with GNU General Public License v3.0 | 6 votes |
public void sendArmorSlot(int index, Player[] players) { Item[] armor = this.getArmorContents(); MobArmorEquipmentPacket pk = new MobArmorEquipmentPacket(); pk.eid = this.getHolder().getId(); pk.slots = armor; pk.encode(); pk.isEncoded = true; for (Player player : players) { if (player.equals(this.getHolder())) { InventorySlotPacket pk2 = new InventorySlotPacket(); pk2.inventoryId = InventoryContentPacket.SPECIAL_ARMOR; pk2.slot = index - this.getSize(); pk2.item = this.getItem(index); player.dataPacket(pk2); } else { player.dataPacket(pk); } } }
Example 14
Source File: PlayerInventory.java From Nukkit with GNU General Public License v3.0 | 6 votes |
@Override public void sendSlot(int index, Player... players) { InventorySlotPacket pk = new InventorySlotPacket(); pk.slot = index; pk.item = this.getItem(index).clone(); for (Player player : players) { if (player.equals(this.getHolder())) { pk.inventoryId = ContainerIds.INVENTORY; player.dataPacket(pk); } else { int id = player.getWindowId(this); if (id == -1) { this.close(player); continue; } pk.inventoryId = id; player.dataPacket(pk.clone()); } } }