本文整理了Java中org.bukkit.Server.getEntity()
方法的一些代码示例,展示了Server.getEntity()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Server.getEntity()
方法的具体详情如下:
包路径:org.bukkit.Server
类名称:Server
方法名:getEntity
暂无
代码示例来源:origin: EngineHub/CommandHelper
@Override
public MCEntity getEntity(UUID uuid) {
return BukkitConvertor.BukkitGetCorrectEntity(s.getEntity(uuid));
}
代码示例来源:origin: mcmonkeyprojects/Sentinel
/**
* Gets the entity for a given UUID.
*/
public static Entity getEntityForID(UUID id) {
if (!SentinelTarget.v1_12) {
for (World world : Bukkit.getServer().getWorlds()) {
for (Entity e : world.getEntities()) {
if (e.getUniqueId().equals(id)) {
return e;
}
}
}
return null;
}
return Bukkit.getServer().getEntity(id);
}
代码示例来源:origin: NyaaCat/RPGItems-reloaded
@Override
public PowerResult<Boolean> pickupOffhand(Player player, ItemStack stack, InventoryClickEvent event) {
checkCooldown(this, player, cooldown, false, true);
UUID armorStandUUID = playerTranslocatorMap.getIfPresent(player.getUniqueId());
if (armorStandUUID == null) {
return PowerResult.fail();
}
playerTranslocatorMap.invalidate(player.getUniqueId());
translocatorPlayerMap.invalidate(armorStandUUID);
Entity armorStand = Bukkit.getServer().getEntity(armorStandUUID);
if (armorStand != null) {
armorStand.remove();
return PowerResult.ok(true);
}
return PowerResult.fail();
}
代码示例来源:origin: NyaaCat/RPGItems-reloaded
@Override
public PowerResult<Boolean> swapToMainhand(Player player, ItemStack stack, PlayerSwapHandItemsEvent event) {
checkCooldown(this, player, cooldown, false, true);
UUID translocatorUUID = playerTranslocatorMap.getIfPresent(player.getUniqueId());
if (translocatorUUID == null) {
return PowerResult.fail();
}
playerTranslocatorMap.invalidate(player.getUniqueId());
translocatorPlayerMap.invalidate(translocatorUUID);
Entity translocator = Bukkit.getServer().getEntity(translocatorUUID);
if (translocator == null) {
return PowerResult.fail();
}
if (translocator.isDead() || !translocator.isValid()) {
translocator.remove();
return PowerResult.fail();
}
translocator.remove();
if (!getItem().consumeDurability(stack, tpCost)) return PowerResult.cost();
Location newLoc = translocator.getLocation();
Vector direction = player.getLocation().getDirection();
newLoc.setDirection(direction);
World world = newLoc.getWorld();
player.teleport(newLoc);
world.playEffect(newLoc, Effect.ENDER_SIGNAL, 0);
world.playSound(newLoc, Sound.ENTITY_ENDERMAN_TELEPORT, 1.0f, 0.3f);
return PowerResult.ok(true);
}
内容来源于网络,如有侵权,请联系作者删除!