Java Code Examples for org.bukkit.entity.Player#leaveVehicle()
The following examples show how to use
org.bukkit.entity.Player#leaveVehicle() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MatchImpl.java From PGM with GNU Affero General Public License v3.0 | 6 votes |
@Override public MatchPlayer addPlayer(Player bukkit) { MatchPlayer player = players.get(bukkit.getUniqueId()); if (player == null) { logger.fine("Adding player " + bukkit); // If the bukkit player is dead, force them back into the world if (bukkit.isDead()) { bukkit.leaveVehicle(); bukkit.spigot().respawn(); } player = new MatchPlayerImpl(this, bukkit); MatchPlayerAddEvent event = new MatchPlayerAddEvent(player, getDefaultParty()); callEvent(event); setParty(player, event.getInitialParty()); } return player; }
Example 2
Source File: MatchPlayer.java From ProjectAres with GNU Affero General Public License v3.0 | 5 votes |
public void refreshInteraction() { final Player bukkit = getBukkit(); boolean interact = canInteract(); if(!interact) bukkit.leaveVehicle(); bukkit.setAffectsSpawning(interact); bukkit.setCollidesWithEntities(interact); }
Example 3
Source File: PlayerFreezer.java From ProjectAres with GNU Affero General Public License v3.0 | 5 votes |
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; }
Example 4
Source File: SitListener.java From NyaaUtils with MIT License | 5 votes |
@EventHandler public void onQuit(PlayerQuitEvent event) { Player player = event.getPlayer(); Entity vehicle = player.getVehicle(); if (safeLocations.containsKey(player.getUniqueId()) && player.isInsideVehicle() && vehicle instanceof ArmorStand) { safeLocations.remove(player.getUniqueId()); player.leaveVehicle(); vehicle.remove(); } }
Example 5
Source File: FeatureEmulation.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@EventHandler public void onShift(PlayerToggleSneakEvent event) { Player player = event.getPlayer(); Connection connection = ProtocolSupportAPI.getConnection(player); if ( player.isInsideVehicle() && (connection != null) && (connection.getVersion().getProtocolType() == ProtocolType.PC) && connection.getVersion().isBeforeOrEq(ProtocolVersion.MINECRAFT_1_5_2) ) { player.leaveVehicle(); } }
Example 6
Source File: ProcessSyncPlayerLogout.java From AuthMeReloaded with GNU General Public License v3.0 | 5 votes |
private void applyLogoutEffect(Player player) { // dismount player player.leaveVehicle(); teleportationService.teleportOnJoin(player); // Apply Blindness effect if (service.getProperty(RegistrationSettings.APPLY_BLIND_EFFECT)) { int timeout = service.getProperty(RestrictionSettings.TIMEOUT) * TICKS_PER_SECOND; player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, timeout, 2)); } // Set player's data to unauthenticated limboService.createLimboPlayer(player, true); }
Example 7
Source File: ProcessSyncPlayerQuit.java From AuthMeReloaded with GNU General Public License v3.0 | 5 votes |
/** * Processes a player having quit. * * @param player the player that left * @param wasLoggedIn true if the player was logged in when leaving, false otherwise */ public void processSyncQuit(Player player, boolean wasLoggedIn) { if (wasLoggedIn) { commandManager.runCommandsOnLogout(player); } else { limboService.restoreData(player); player.saveData(); // #1238: Speed is sometimes not restored properly } player.leaveVehicle(); }
Example 8
Source File: GridManager.java From askyblock with GNU General Public License v2.0 | 4 votes |
/** * Teleport player to a home location. If one cannot be found a search is done to * find a safe place. * @param player player object * @param number - home location to do to * @return true if successful, false if not */ @SuppressWarnings("deprecation") public void homeTeleport(final Player player, int number) { Location home = null; //plugin.getLogger().info("home teleport called for #" + number); home = getSafeHomeLocation(player.getUniqueId(), number); //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) { //plugin.getLogger().info("Fixing home location using safe spot teleport"); // Try to fix this teleport location and teleport the player if possible new SafeTeleportBuilder(plugin) .entity(player) .location(plugin.getPlayers().getHomeLocation(player.getUniqueId(), number)) .homeNumber(number) .build(); return; } //plugin.getLogger().info("DEBUG: home loc = " + home + " teleporting"); //home.getChunk().load(); IslandPreTeleportEvent event = new IslandPreTeleportEvent(player, IslandPreTeleportEvent.Type.HOME, home); Bukkit.getPluginManager().callEvent(event); if (!event.isCancelled()) { player.teleport(event.getLocation()); //player.sendBlockChange(home, Material.GLOWSTONE, (byte)0); if (number ==1 ) { Util.sendMessage(player, ChatColor.GREEN + plugin.myLocale(player.getUniqueId()).islandteleport); } else { Util.sendMessage(player, ChatColor.GREEN + plugin.myLocale(player.getUniqueId()).islandteleport + " #" + number); } } plugin.getPlayers().setInTeleport(player.getUniqueId(), false); }