本文整理了Java中org.bukkit.entity.Entity.getVehicle()
方法的一些代码示例,展示了Entity.getVehicle()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.getVehicle()
方法的具体详情如下:
包路径:org.bukkit.entity.Entity
类名称:Entity
方法名:getVehicle
[英]Get the vehicle that this player is inside. If there is no vehicle, null will be returned.
[中]获取该玩家所在的车辆。如果没有车辆,则返回null。
代码示例来源:origin: bergerkiller/BKCommonLib
@Override
public Entity getVehicle() {
return base.getVehicle();
}
代码示例来源:origin: bergerkiller/BKCommonLib
public org.bukkit.entity.Entity getVehicle() {
return entity.getVehicle();
}
代码示例来源:origin: NoCheatPlus/NoCheatPlus
/**
* Check recursively for vehicles, returns null if players are vehicles,
* otherwise the lowest vehicle (that has no vehicle).
*
* @param passenger
* The passenger of vehicles. Typically the player.
* @param includePassenger
* If set to true, the passenger is counted as a vehicle as well
* (meaning: vehicle enter, the player is not in a vehicle, test
* with this set to true and the vehicle returned by the event).
* @return Supposedly the vehicle that is steered.
*/
public Entity getLastNonPlayerVehicle(final Entity passenger, final boolean includePassenger) {
Entity vehicle = includePassenger ? passenger : passenger.getVehicle();
while (vehicle != null){
if (vehicle instanceof Player){
return null;
}
else if (vehicle.isInsideVehicle()) {
vehicle = vehicle.getVehicle();
}
else {
break;
}
}
return vehicle;
}
代码示例来源:origin: EngineHub/CommandHelper
@Override
public MCEntity getVehicle() {
return BukkitConvertor.BukkitGetCorrectEntity(e.getVehicle());
}
代码示例来源:origin: NoCheatPlus/NoCheatPlus
private void debugNestedVehicleEnter(Player player) {
debug(player, "Vehicle enter: Skip on nested vehicles, possibly with multiple players involved, who would do that?");
List<String> vehicles = new LinkedList<String>();
Entity tempVehicle = player.getVehicle();
while (tempVehicle != null) {
vehicles.add(tempVehicle.getType().toString());
tempVehicle = tempVehicle.getVehicle();
}
if (!vehicles.isEmpty()) {
debug(player, "Vehicle enter: Nested vehicles: " + StringUtil.join(vehicles, ", "));
}
}
代码示例来源:origin: CitizensDev/CitizensAPI
@Override
public void teleport(Location location, TeleportCause cause) {
if (!isSpawned())
return;
NPCTeleportEvent event = new NPCTeleportEvent(this, location);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled())
return;
Entity entity = getEntity();
while (entity.getVehicle() != null) {
entity = entity.getVehicle();
}
location.getBlock().getChunk();
teleport(entity, location, 5);
}
代码示例来源:origin: BedwarsRel/BedwarsRel
@EventHandler(priority = EventPriority.HIGHEST)
public void onInteractOtherUser(PlayerInteractEntityEvent event) {
if (event.getPlayer() == null) {
return;
}
Player player = event.getPlayer();
Game game = BedwarsRel.getInstance().getGameManager().getGameOfPlayer(player);
if (game == null) {
return;
}
if (game.getState() != GameState.RUNNING) {
return;
}
if (event.getRightClicked() == null) {
return;
}
if (event.getRightClicked() instanceof ITNTSheep) {
event.setCancelled(true);
return;
}
if (event.getRightClicked().getVehicle() != null
&& event.getRightClicked().getVehicle() instanceof ITNTSheep) {
event.setCancelled(true);
return;
}
}
代码示例来源:origin: io.github.bedwarsrel/BedwarsRel-Common
@EventHandler(priority = EventPriority.HIGHEST)
public void onInteractOtherUser(PlayerInteractEntityEvent event) {
if (event.getPlayer() == null) {
return;
}
Player player = event.getPlayer();
Game game = BedwarsRel.getInstance().getGameManager().getGameOfPlayer(player);
if (game == null) {
return;
}
if (game.getState() != GameState.RUNNING) {
return;
}
if (event.getRightClicked() == null) {
return;
}
if (event.getRightClicked() instanceof ITNTSheep) {
event.setCancelled(true);
return;
}
if (event.getRightClicked().getVehicle() != null
&& event.getRightClicked().getVehicle() instanceof ITNTSheep) {
event.setCancelled(true);
return;
}
}
代码示例来源:origin: elBukkit/MagicPlugin
Entity currentMount = isPassenger ? DeprecatedUtils.getPassenger(mounted) : mounted.getVehicle();
if (currentMount == null) {
return SpellResult.CAST;
代码示例来源:origin: bergerkiller/BKCommonLib
if (!passenger.isDead() && passenger.getVehicle() == entity) {
CommonEntity<?> commonPassenger = get(passenger);
commonPassenger.getController().onTick();
代码示例来源:origin: elBukkit/MagicPlugin
Entity mountEntity = entity.getVehicle();
while (mountEntity != null) {
entity = mountEntity;
mountEntity = entity.getVehicle();
代码示例来源:origin: EngineHub/WorldGuard
vehicle.teleport(override.clone().add(0, 1, 0));
current = current.getVehicle();
内容来源于网络,如有侵权,请联系作者删除!