本文整理匯總了Java中cn.nukkit.Player.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java Player.equals方法的具體用法?Java Player.equals怎麽用?Java Player.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cn.nukkit.Player
的用法示例。
在下文中一共展示了Player.equals方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: sendHeldItem
import cn.nukkit.Player; //導入方法依賴的package包/類
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);
}
}
示例2: sendArmorContents
import cn.nukkit.Player; //導入方法依賴的package包/類
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);
}
}
}
示例3: sendArmorSlot
import cn.nukkit.Player; //導入方法依賴的package包/類
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);
}
}
}
示例4: sendSlot
import cn.nukkit.Player; //導入方法依賴的package包/類
@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());
}
}
}
示例5: getMinDistancePlayer
import cn.nukkit.Player; //導入方法依賴的package包/類
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;
}
示例6: sendHeldItem
import cn.nukkit.Player; //導入方法依賴的package包/類
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);
}
}
示例7: sendSlot
import cn.nukkit.Player; //導入方法依賴的package包/類
@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());
}
}
}
示例8: sendHeldItem
import cn.nukkit.Player; //導入方法依賴的package包/類
public void sendHeldItem(Player[] players) {
Item item = this.getItemInHand();
MobEquipmentPacket pk = new MobEquipmentPacket();
pk.item = item;
pk.slot = (byte) this.getHeldItemSlot();
pk.selectedSlot = (byte) this.getHeldItemIndex();
for (Player player : players) {
pk.eid = this.getHolder().getId();
if (player.equals(this.getHolder())) {
pk.eid = player.getId();
this.sendSlot(this.getHeldItemSlot(), player);
}
player.dataPacket(pk);
}
}
示例9: sendSlot
import cn.nukkit.Player; //導入方法依賴的package包/類
@Override
public void sendSlot(int index, Player[] players) {
ContainerSetSlotPacket pk = new ContainerSetSlotPacket();
pk.slot = index;
pk.item = this.getItem(index).clone();
for (Player player : players) {
if (player.equals(this.getHolder())) {
pk.windowid = 0;
player.dataPacket(pk);
} else {
int id = player.getWindowId(this);
if (id == -1) {
this.close(player);
continue;
}
pk.windowid = (byte) id;
player.dataPacket(pk.clone());
}
}
}
示例10: sendArmorSlot
import cn.nukkit.Player; //導入方法依賴的package包/類
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())) {
ContainerSetSlotPacket pk2 = new ContainerSetSlotPacket();
pk2.windowid = ContainerSetContentPacket.SPECIAL_ARMOR;
pk2.slot = index - this.getSize();
pk2.item = this.getItem(index);
player.dataPacket(pk2);
} else {
player.dataPacket(pk);
}
}
}
示例11: sendArmorContents
import cn.nukkit.Player; //導入方法依賴的package包/類
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())) {
ContainerSetContentPacket pk2 = new ContainerSetContentPacket();
pk2.windowid = ContainerSetContentPacket.SPECIAL_ARMOR;
pk2.eid = player.getId();
pk2.slots = armor;
player.dataPacket(pk2);
} else {
player.dataPacket(pk);
}
}
}
示例12: sendContents
import cn.nukkit.Player; //導入方法依賴的package包/類
@Override
public void sendContents(Player[] players) {
ContainerSetContentPacket pk = new ContainerSetContentPacket();
pk.slots = new Item[this.getSize() + + this.getHotbarSize()];
for (int i = 0; i < this.getSize(); ++i) {
pk.slots[i] = this.getItem(i);
}
//Because PE is stupid and shows 9 less slots than you send it, give it 9 dummy slots so it shows all the REAL slots.
for(int i = this.getSize(); i < this.getSize() + this.getHotbarSize(); ++i){
pk.slots[i] = new ItemBlock(new BlockAir());
}
for (Player player : players) {
if (player.equals(this.getHolder())) {
pk.hotbar = new int[this.getHotbarSize()];
for (int i = 0; i < this.getHotbarSize(); ++i) {
int index = this.getHotbarSlotIndex(i);
pk.hotbar[i] = index <= -1 ? -1 : index + 9;
}
}
int id = player.getWindowId(this);
if (id == -1 || !player.spawned) {
this.close(player);
continue;
}
pk.eid = player.getId();
pk.windowid = (byte) id;
player.dataPacket(pk.clone());
}
}
示例13: isOwner
import cn.nukkit.Player; //導入方法依賴的package包/類
public boolean isOwner(Player player){
return player.equals(this.getOwner());
}