本文整理了Java中org.bukkit.entity.Entity.getPassenger()
方法的一些代码示例,展示了Entity.getPassenger()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.getPassenger()
方法的具体详情如下:
包路径:org.bukkit.entity.Entity
类名称:Entity
方法名:getPassenger
[英]Gets the primary passenger of a vehicle. For vehicles that could have multiple passengers, this will only return the primary passenger.
[中]获取车辆的主要乘客。对于可能有多个乘客的车辆,这将只返回主要乘客。
代码示例来源:origin: elBukkit/MagicPlugin
public static Entity getPassenger(Entity mount) {
// TODO: Use getPassengers, refactor to search through list
return mount.getPassenger();
}
代码示例来源:origin: bergerkiller/BKCommonLib
@Override
public Entity getPassenger() {
return base.getPassenger();
}
代码示例来源:origin: bergerkiller/BKCommonLib
public org.bukkit.entity.Entity getPassenger() {
return entity.getPassenger();
}
代码示例来源:origin: NoCheatPlus/NoCheatPlus
@SuppressWarnings("deprecation")
@Override
public List<Entity> getEntityPassengers(final Entity entity) {
final Entity passenger = entity.getPassenger();
return passenger == null ? nullPassenger : Arrays.asList(passenger);
}
代码示例来源:origin: Dytanic/CloudNet
@Deprecated
public void shutdown()
{
for (MobImpl mobImpl : this.mobs.values())
{
if (mobImpl.displayMessage != null)
{
try
{
Entity entity = (Entity) mobImpl.displayMessage;
if (entity.getPassenger() != null)
{
entity.getPassenger().remove();
}
mobImpl.displayMessage.getClass().getMethod("remove").invoke(mobImpl.displayMessage);
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e)
{
}
}
mobImpl.entity.remove();
}
mobs.clear();
}
代码示例来源:origin: Multiverse/Multiverse-Core
/**
* {@inheritDoc}
*/
@Override
public Location getLocation(Entity e) {
Player p = plugin.getServer().getPlayer(this.player);
Player plLoc = null;
if (e instanceof Player) {
plLoc = (Player) e;
} else if (e.getPassenger() instanceof Player) {
plLoc = (Player) e.getPassenger();
}
if (p != null && plLoc != null) {
return p.getLocation();
}
return null;
}
代码示例来源:origin: Dytanic/CloudNet
@Override
public boolean isAccepted(MobSelector.MobImpl value)
{
return ((Entity) value.getDisplayMessage()).getPassenger() != null && e.getEntity().getEntityId() == ((Entity) value.getDisplayMessage()).getPassenger().getEntityId();
}
});
代码示例来源:origin: CitizensDev/CitizensAPI
private void teleport(final Entity entity, Location location, int delay) {
final Entity passenger = entity.getPassenger();
entity.eject();
entity.teleport(location);
if (passenger == null)
return;
teleport(passenger, location, delay++);
Runnable task = new Runnable() {
@Override
public void run() {
entity.setPassenger(passenger);
}
};
if (!location.getWorld().equals(entity.getWorld())) {
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), task, delay);
} else {
task.run();
}
}
代码示例来源:origin: elBukkit/MagicPlugin
@EventHandler
public void onHorseJump(HorseJumpEvent event)
{
Entity horse = ((EntityEvent)event).getEntity();
if (horse.hasMetadata("broom"))
{
Entity passenger = horse.getPassenger();
Mage mage = controller.getMage(passenger);
Set<Spell> active = mage.getActiveSpells();
for (Spell spell : active) {
if (spell instanceof LevitateSpell) {
LevitateSpell levitate = (LevitateSpell)spell;
double amount = Math.max(0, (event.getPower() - mountBoostMinimum) / (1 - mountBoostMinimum));
levitate.boost(amount);
}
}
}
}
代码示例来源:origin: BigScary/GriefPrevention
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onEntityInteract(EntityInteractEvent event)
{
Material material = event.getBlock().getType();
if(material == Material.SOIL)
{
if(!GriefPrevention.instance.config_creaturesTrampleCrops)
{
event.setCancelled(true);
}
else
{
Entity rider = event.getEntity().getPassenger();
if(rider != null && rider.getType() == EntityType.PLAYER)
{
event.setCancelled(true);
}
}
}
}
代码示例来源:origin: elBukkit/MagicPlugin
@EventHandler
public void onVehicleExit(VehicleExitEvent event)
{
Entity vehicle = event.getVehicle();
if (vehicle.hasMetadata("broom"))
{
event.setCancelled(true);
Entity passenger = vehicle.getPassenger();
Mage mage = controller.getMage(passenger);
Set<Spell> active = mage.getActiveSpells();
for (Spell spell : active) {
if (spell instanceof LevitateSpell) {
LevitateSpell levitate = (LevitateSpell)spell;
levitate.forceSneak(10);
}
}
}
}
}
代码示例来源:origin: Multiverse/Multiverse-Core
if (teleportee instanceof Player) {
teleporteePlayer = ((Player) teleportee);
} else if (teleportee.getPassenger() instanceof Player) {
teleporteePlayer = ((Player) teleportee.getPassenger());
代码示例来源:origin: Multiverse/Multiverse-Core
this.plugin.getMessaging().sendMessage(p, "No safe locations found!", false);
this.plugin.log(Level.FINER, "No safe location found for " + p.getName());
} else if (e.getPassenger() instanceof Player) {
Player p = (Player) e.getPassenger();
this.plugin.getMessaging().sendMessage(p, "No safe locations found!", false);
this.plugin.log(Level.FINER, "No safe location found for " + p.getName());
内容来源于网络,如有侵权,请联系作者删除!