本文整理汇总了Java中org.bukkit.entity.Player.leaveVehicle方法的典型用法代码示例。如果您正苦于以下问题:Java Player.leaveVehicle方法的具体用法?Java Player.leaveVehicle怎么用?Java Player.leaveVehicle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.entity.Player
的用法示例。
在下文中一共展示了Player.leaveVehicle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: refreshInteraction
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void refreshInteraction() {
final Player bukkit = getBukkit();
boolean interact = canInteract();
if(!interact) bukkit.leaveVehicle();
bukkit.setAffectsSpawning(interact);
bukkit.setCollidesWithEntities(interact);
}
示例2: freeze
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public FrozenPlayer freeze(Player player) {
final FrozenPlayerImpl frozenPlayer = new FrozenPlayerImpl(player);
final boolean wasFrozen = isFrozen(player);
frozenPlayers.put(player, frozenPlayer);
if(!wasFrozen) {
player.setPaused(true);
player.leaveVehicle(); // TODO: Put them back in the vehicle when thawed?
armorStand(player).spawn(player, player.getLocation());
sendAttach(player);
}
return frozenPlayer;
}
示例3: homeTeleport
import org.bukkit.entity.Player; //导入方法依赖的package包/类
/**
* Teleport player to a home location. If one cannot be found a search is done to
* find a safe place.
* @param player
* @param number - home location to do to
* @return true if successful, false if not
*/
@SuppressWarnings("deprecation")
public boolean homeTeleport(final Player player, int number) {
Location home;
if (DEBUG)
plugin.getLogger().info("home teleport called for #" + number);
home = getSafeHomeLocation(player.getUniqueId(), number);
if (DEBUG)
plugin.getLogger().info("home get safe loc = " + home);
// Check if the player is a passenger in a boat
if (player.isInsideVehicle()) {
Entity boat = player.getVehicle();
if (boat instanceof Boat) {
player.leaveVehicle();
// Remove the boat so they don't lie around everywhere
boat.remove();
player.getInventory().addItem(new ItemStack(Material.BOAT, 1));
player.updateInventory();
}
}
if (home == null) {
if (DEBUG)
plugin.getLogger().info("Fixing home location using safe spot teleport");
// Try to fix this teleport location and teleport the player if possible
new SafeSpotTeleport(plugin, player, plugin.getPlayers().getHomeLocation(player.getUniqueId(), number), number);
return true;
}
if (DEBUG)
plugin.getLogger().info("DEBUG: home loc = " + home + " teleporting");
//home.getChunk().load();
player.teleport(home);
//player.sendBlockChange(home, Material.GLOWSTONE, (byte)0);
if (number ==1 ) {
Util.sendMessage(player, ChatColor.GREEN + plugin.getLocale(player.getUniqueId()).get("island.teleport").replace("[label]", Settings.ISLANDCOMMAND));
} else {
Util.sendMessage(player, ChatColor.GREEN + plugin.getLocale(player.getUniqueId()).get("island.teleported").replace("[number]", String.valueOf(number)));
}
// Exit spectator mode if in it
if (player.getGameMode().equals(GameMode.SPECTATOR)) {
player.setGameMode(GameMode.SURVIVAL);
}
return true;
}