@EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL) public void onPlayerPortal(PlayerPortalEvent event) { if (event.getCause() != PlayerTeleportEvent.TeleportCause.END_PORTAL) { return; } if (event.getTo() != null) { World toWorld = event.getTo().getWorld(); if (toWorld != null && toWorld.getEnvironment() == World.Environment.THE_END) { event.useTravelAgent(false); event.setTo(toWorld.getSpawnLocation()); return; } } World fromWorld = event.getFrom().getWorld(); if (fromWorld != null && fromWorld.getEnvironment() == World.Environment.THE_END) { event.useTravelAgent(false); event.setTo(endExit); } }
@EventHandler(priority = EventPriority.HIGH) public void onPlayerPortal(PlayerPortalEvent event) { if (plugin.UseQuickPortals) return; Player player = event.getPlayer(); if (!player.hasPermission("cuteportals.use")) { player.sendMessage(ChatColor.DARK_RED + "You don't have permission to use portals."); return; } Block block = player.getWorld().getBlockAt(player.getLocation()); String data = String.format("%s#%s#%s#%s", block.getWorld().getName(), String.valueOf(block.getX()), String.valueOf(block.getY()), String.valueOf(block.getZ())); if (plugin.portalData.containsKey(data)) { String[] args = plugin.portalData.get(data).split("#"); plugin.TransferPlayer(player, args[0], args[1]); event.setCancelled(true); } }
@EventHandler(priority = EventPriority.LOWEST) public void onPlayerPortal(PlayerPortalEvent event) { if (!this.worldConfig.getBoolean("special-travel-agent", true)) { return; } Location destination = event.getTo(); if (destination == null) { return; } World targetWorld = destination.getWorld(); if (targetWorld.getName() != this.nmsWorld.worldData.getName()) { return; } if (this.worldConfig.getBoolean("enabled", false)) { event.setPortalTravelAgent(this.portalTravelAgent); } }
@EventHandler(priority = EventPriority.HIGHEST) public void ClassChanger(final PlayerPortalEvent event) { if(Game.isGameRunning() && event.getPlayer().getGameMode() != GameMode.CREATIVE) { AnniPlayer p = AnniPlayer.getPlayer(event.getPlayer().getUniqueId()); if(p != null) { event.setCancelled(true); if(p.getTeam() != null) { final Player pl = event.getPlayer(); pl.teleport(p.getTeam().getRandomSpawn()); Bukkit.getScheduler().runTaskLater(AnnihilationMain.getInstance(), new Runnable(){ @Override public void run() { openKitMap(pl); }}, 40); } } } }
@EventHandler public void onPlayerEnterPortal(PlayerPortalEvent e){ Player p = e.getPlayer(); Region rto = null; Region from = null; if (e.getTo() != null){ rto = RedProtect.get().rm.getTopRegion(e.getTo()); } if (e.getFrom() != null){ from = RedProtect.get().rm.getTopRegion(e.getFrom()); } if (rto != null && !rto.canExitPortal(p)){ RPLang.sendMessage(p, "playerlistener.region.cantteleport"); e.setCancelled(true); } if (from != null && !from.canEnterPortal(p)){ RPLang.sendMessage(p, "playerlistener.region.cantenterteleport"); e.setCancelled(true); } }
@EventHandler(priority = EventPriority.MONITOR) public void onPortalEvent(PlayerPortalEvent event) { Player player = event.getPlayer(); if (usePortals || event.getTo() == null || event.getFrom() == null || (!plugin.isSkyWorld(event.getTo().getWorld()) && !plugin.isSkyWorld(event.getFrom().getWorld()))) { return; // We only care about portals going into or out of skyworld } if (hasPermission(player, "usb.mod.bypassprotection") || plugin.playerIsOnIsland(player) || plugin.playerIsInSpawn(player)) { return; } if (event.getCause() == PlayerTeleportEvent.TeleportCause.NETHER_PORTAL || event.getCause() == PlayerTeleportEvent.TeleportCause.END_PORTAL) { us.talabrek.ultimateskyblock.api.IslandInfo islandInfo = plugin.getIslandInfo(player); if (islandInfo == null || (!islandInfo.contains(event.getTo()) && !islandInfo.contains(event.getFrom()))) { event.setCancelled(true); player.sendMessage(tr("\u00a7eYou can not use another islands portals!")); } } }
@EventHandler(priority = EventPriority.LOWEST) public void onPlayerPortal(final PlayerPortalEvent event) { Bukkit.getScheduler().scheduleSyncDelayedTask(BridgePlugin.getInstance(), new Runnable() { @Override public void run() { final ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getPlayer().getLocation()); ServerWorldUtil.sendResidenceInfo(event.getPlayer(), res); // Send Title for (Player player : Bukkit.getServer().getOnlinePlayers()) { ServerWorldUtil.sendAdditionalWorldInfo(player, player.getWorld().getName(), Bukkit.getOnlinePlayers().size(), Bukkit.getMaxPlayers()); TitleUtil.sendDisplayName(player, event.getPlayer().getName(), ChatColor.stripColor(event.getPlayer().getDisplayName()) + "\n" + TitleUtil.getCustomTitle(event.getPlayer())); TitleUtil.sendDisplayName(event.getPlayer(), player.getName(), ChatColor.stripColor(player.getDisplayName()) + "\n" + TitleUtil.getCustomTitle(player)); } } }, 20L); EconUtil.sendCurrencyAmount(event.getPlayer(), EconUtil.economy.getBalance(event.getPlayer().getName())); }
/** * When a portal event happends * * @param entityPortalEvent the portal event */ @EventHandler public void onPortalEvent(PlayerPortalEvent entityPortalEvent) { //if we're enabled if(isEnabled()) { //create a travel agent for the portal TravelAgent ta = entityPortalEvent.getPortalTravelAgent(); //if they're in the nether if(entityPortalEvent.getPlayer().getWorld().getEnvironment() == World.Environment.NETHER) { //set data from the nether ta.setCanCreatePortal(config.getBoolean("PortalRanges.from_nether.allowed")); ta.setCreationRadius(config.getInt("PortalRanges.from_nether.creation_radius")); ta.setSearchRadius(config.getInt("PortalRanges.from_nether.search_radius")); } else { //set the data to the nether ta.setCanCreatePortal(config.getBoolean("PortalRanges.to_nether.allowed")); ta.setCreationRadius(config.getInt("PortalRanges.to_nether.creation_radius")); ta.setSearchRadius(config.getInt("PortalRanges.to_nether.search_radius")); } } }
@EventHandler public void onPlayerPortal(PlayerPortalEvent event) { if (!event.getCause().equals(TeleportCause.NETHER_PORTAL)) { return; } Location cornerLocation = PortalUtils.findCornerBlock(event.getFrom()).orElse(null); if (cornerLocation == null) { debug("Couldnt find cornerLoc for loc: " + Utility.toString(event.getFrom())); return; } Portal portal = this.module.storage.getPortal(cornerLocation).orElse(null); if (portal == null) { debug("Couldnt find portal for cornerLoc: " + Utility.toString(cornerLocation)); return; } CraftoPlayer player = CraftoPlayer.getPlayer(event.getPlayer()).orElse(null); if (!event.getPlayer().hasPermission("craftoplugin.portal.always-teleport")) { if (player != null && player.getPlaytime().toMinutes() < this.minPlaytime.toMinutes()) { debug(event.getPlayer().getName() + " failed to teleport because he doesn't have permission!"); CraftoMessenger.sendFailure(event.getPlayer(), "Du kannst erst ab " + this.minPlaytime.toMinutes() + " Minuten Spielzeit das Portal nutzen!"); event.setCancelled(true); return; } } event.useTravelAgent(false); event.setTo(portal.getDestination()); debug("Teleported " + event.getPlayer().getName() + " to dest of portal '" + portal.getName() + "'"); }
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void onPlayerPortalEnter(final PlayerPortalEvent event) { this.plugin.entering(this.getClass(), "onPlayerPortalEnter"); final Location from = event.getFrom(); final ChunkCoord coord = new ChunkCoord(from.getChunk()); final Altar altar = this.plugin.getAltars().get(coord); if (altar != null) { this.plugin.debug("It's an Altar portal, cancel the event"); final Location teleportLocation = altar.getCenterLocation().clone().toBukkitLocation().add(2.5, 1, 0.5); teleportLocation.setPitch(6f); teleportLocation.setYaw(90f); event.getPlayer().teleport(teleportLocation); event.setCancelled(true); } this.plugin.exiting(this.getClass(), "onPlayerPortalEnter"); }
@Deprecated @EventHandler public void onSound(final PlayerPortalEvent e) { if(e.isCancelled()) { return; } new BukkitRunnable() { @Override public void run() { e.getPlayer().playSound(e.getPlayer().getLocation(), Sound.BLOCK_PORTAL_TRAVEL, 1F, 1F); } }.runTaskLater(pl, 5L); }
/** * Patch player teleporting through portals to be INSIDE the world border * * @param event Event */ @EventHandler public void onPlayerPortal(PlayerPortalEvent event) { if (!this.game.getPlugin().getServer().getAllowNether() || this.game.getSurvivalGameLoop().isNetherClosed()) { event.setCancelled(true); return; } TravelAgent travelAgent = event.getPortalTravelAgent(); Location destination = travelAgent.findPortal(event.getTo()); if (destination != null) { if (!SafePortalsUtils.isInsideBorder(destination)) { event.useTravelAgent(false); boolean success = travelAgent.createPortal(event.getTo()); if (success) { event.setTo(travelAgent.findPortal(event.getTo())); if (!SafePortalsUtils.isSafeSpot(event.getTo())) { Location safeTo = SafePortalsUtils.searchSafeSpot(event.getTo()); if (safeTo != null) { event.setTo(safeTo); } } } } } else { event.useTravelAgent(true); } }
@EventHandler(ignoreCancelled=true, priority=EventPriority.HIGHEST) public void onPlayerPortal(PlayerPortalEvent event) { if (event.getCause() == TeleportCause.END_PORTAL) { if (event.getTo().getWorld().getEnvironment() == Environment.THE_END) { event.setTo(event.getTo().getWorld().getSpawnLocation().clone().add(0.5D, 0.0D, 0.5D)); } else if (event.getFrom().getWorld().getEnvironment() == Environment.THE_END) { event.setTo(this.endExitLocation); } } }
@Override protected Location[] get(Event event) { if (event instanceof PlayerPortalEvent) { return new Location[]{createPortal(targetLoc.getSingle(event), radius.getSingle(event).intValue(), ((PlayerPortalEvent) event).getPortalTravelAgent())}; } else if (event instanceof EntityPortalEvent) { return new Location[]{createPortal(targetLoc.getSingle(event), radius.getSingle(event).intValue(), ((EntityPortalEvent) event).getPortalTravelAgent())}; } throw new IllegalArgumentException("The event " + event + " should be a PlayerPortalEvent or EntityPortalEvent"); }
@Override public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) { if (!ScriptLoader.isCurrentEvent(PlayerPortalEvent.class, EntityPortalEvent.class)) { Skript.error("'new nether portal' can only be used in an 'on teleport' event!"); return false; } radius = (Expression<Number>) expressions[0]; targetLoc = (Expression<Location>) expressions[1]; return false; }
@EventHandler public void onEntityPortalEvent(PlayerPortalEvent event) { if (!event.isCancelled()) { ThePlayer tp = plugin.getPlayerHandler().getPlayer(event.getPlayer().getUniqueId()); if (tp.getPortalTimeout() != -1) event.setCancelled(true); } }
private final static void register() { if (registered) return; Bukkit.getPluginManager().registerEvent(PlayerMoveEvent.class, new Listener() {}, SkriptConfig.defaultEventPriority.value(), ee, Skript.getInstance(), true); Bukkit.getPluginManager().registerEvent(PlayerTeleportEvent.class, new Listener() {}, SkriptConfig.defaultEventPriority.value(), ee, Skript.getInstance(), true); Bukkit.getPluginManager().registerEvent(PlayerPortalEvent.class, new Listener() {}, SkriptConfig.defaultEventPriority.value(), ee, Skript.getInstance(), true); registered = true; }
@EventHandler public void onPlayerPortal(PlayerPortalEvent event) { ExilePearl pearl = pearlApi.getPearl(event.getPlayer().getUniqueId()); if(pearl != null && pearl.getPearlType() == PearlType.PRISON && event.getCause() == TeleportCause.END_PORTAL) { event.setTo(pearlApi.getPearlConfig().getPrisonWorld().getSpawnLocation()); } }
@EventHandler(priority = EventPriority.LOWEST) public void onPlayerPortal(PlayerPortalEvent event) { EntityPortalEvent e = new EntityPortalEvent(event.getPlayer(), event.getFrom(), event.getTo(), event.getPortalTravelAgent()); this.onEntityPortal(e); event.setFrom(e.getFrom()); event.setTo(e.getTo()); event.setPortalTravelAgent(e.getPortalTravelAgent()); event.useTravelAgent(e.useTravelAgent()); }
@EventHandler(priority = EventPriority.HIGHEST) public void onPlayerPortalEvent(PlayerPortalEvent event) { if(event.getCause().equals(TeleportCause.END_PORTAL)) { event.setCancelled(true); CivMessage.sendErrorNoRepeat(event.getPlayer(), "The End portal is disabled on this server."); return; } if (event.getCause().equals(TeleportCause.NETHER_PORTAL)) { event.setCancelled(true); CivMessage.sendErrorNoRepeat(event.getPlayer(), "The Nether is disabled on this server."); return; } }
@EventHandler public void onPlayerPortal(PlayerPortalEvent e) { final Player player = e.getPlayer(); player.setHealth(0D); Bukkit.getScheduler().runTaskLater(plugin, new Runnable() { public void run() { Util.showClassSelector(player, "Select Class"); } }, 4l); }
@EventHandler public void onPlayerPortal(PlayerPortalEvent e) { final Player player = e.getPlayer(); player.setHealth(0D); Bukkit.getScheduler().runTaskLater(plugin, new Runnable() { @Override public void run() { Util.showClassSelector(player, "Select Class"); } }, 4l); }
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = false) public void onPlayerUsePortal(final PlayerPortalEvent event) { this.plugin.entering(this.getClass(), "onPlayerUsePortal", "player=" + event.getPlayer().getName() + ";from=" + NLocation.toString(event.getFrom()) + ";to=" + NLocation.toString(event.getTo())); final GeneralWorld world = this.plugin.getWorlds().get(event.getFrom().getWorld().getName()); if (GeneralWorld.WorldType.isStock(world)) { return; } if (world.getType() == WorldType.ADDITIONAL) { final AdditionalWorld additionalWorld = (AdditionalWorld)world; if (event.getCause() == TeleportCause.NETHER_PORTAL && !additionalWorld.hasNether()) { event.setCancelled(true); this.plugin.exiting(this.getClass(), "onPlayerUsePortal", "doesn't have required subworld (nether)"); return; } else if (event.getCause() == TeleportCause.END_PORTAL && !additionalWorld.hasEnd()) { event.setCancelled(true); this.plugin.exiting(this.getClass(), "onPlayerUsePortal", "doesn't have required subworld (end)"); return; } } final PortalEventResult result = this.handlePortalEvent(event.getFrom(), event.getCause(), event.getPortalTravelAgent()); if (result == null) { return; } if (result.destination != null) { event.setTo(result.destination); } if (result.useTravelAgent) { event.useTravelAgent(true); } if (result.cancelEvent) { event.setCancelled(true); } this.plugin.exiting(this.getClass(), "onPlayerUsePortal"); }
@EventHandler public void onTeleport(PlayerPortalEvent e) { if (GameStatus.isState(gameStatus)) e.setCancelled(!canUsePortals); }
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH) public void onPortalEnter(PlayerPortalEvent event) { if (event.getCause() != PlayerTeleportEvent.TeleportCause.END_PORTAL) { return; } Location to = event.getTo(); World toWorld = to.getWorld(); if (toWorld == null) return; // safe-guard if the End or Nether is disabled if (toWorld.getEnvironment() == World.Environment.THE_END) { Player player = event.getPlayer(); // Prevent entering the end if it's closed. if (false /* TODO:plugin.getEndManager().isOpened() */) { message(player, ChatColor.RED + "The End is currently closed."); event.setCancelled(true); return; } // Prevent entering the end if the player is Spawn Tagged. PlayerTimer timer = plugin.getTimerManager().getCombatTimer(); long remaining; if ((remaining = timer.getRemaining(player)) > 0L) { message(player, ChatColor.RED + "You cannot enter the End whilst your " + timer.getDisplayName() + ChatColor.RED + " timer is active [" + ChatColor.BOLD + DurationFormatter.getRemaining(remaining, true, false) + ChatColor.RED + " remaining]"); event.setCancelled(true); return; } // Prevent entering the end if the player is PVP Protected. timer = plugin.getTimerManager().getInvincibilityTimer(); if ((remaining = timer.getRemaining(player)) > 0L) { message(player, ChatColor.RED + "You cannot enter the End whilst your " + timer.getDisplayName() + ChatColor.RED + " timer is active [" + ChatColor.BOLD + DurationFormatter.getRemaining(remaining, true, false) + ChatColor.RED + " remaining]"); event.setCancelled(true); return; } event.useTravelAgent(false); event.setTo(toWorld.getSpawnLocation().add(0.5, 0, 0.5)); } }
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void onPlayerPortal(PlayerPortalEvent event) { this.onPlayerTeleport(event); }
@EventHandler(ignoreCancelled = true) public void on(PlayerPortalEvent event) { if (freezer.isCurrentlyFrozen(event.getPlayer().getUniqueId())) { event.setCancelled(true); } }
public void changeDimension(EntityPlayer entityplayer, int i, TeleportCause cause) { WorldServer exitWorld = null; if (entityplayer.dimension < CraftWorld.CUSTOM_DIMENSION_OFFSET) { // plugins must specify exit from custom Bukkit worlds // only target existing worlds (compensate for allow-nether/allow-end as false) for (WorldServer world : this.server.worlds) { if (world.dimension == i) { exitWorld = world; } } } Location enter = entityplayer.getBukkitEntity().getLocation(); Location exit = null; boolean useTravelAgent = false; // don't use agent for custom worlds or return from THE_END if (exitWorld != null) { if ((cause == TeleportCause.END_PORTAL) && (i == 0)) { // THE_END -> NORMAL; use bed if available, otherwise default spawn exit = ((org.bukkit.craftbukkit.entity.CraftPlayer) entityplayer.getBukkitEntity()).getBedSpawnLocation(); if (exit == null || ((CraftWorld) exit.getWorld()).getHandle().dimension != 0) { exit = exitWorld.getWorld().getSpawnLocation(); } } else { // NORMAL <-> NETHER or NORMAL -> THE_END exit = this.calculateTarget(enter, exitWorld); useTravelAgent = true; } } TravelAgent agent = exit != null ? (TravelAgent) ((CraftWorld) exit.getWorld()).getHandle().getTravelAgent() : org.bukkit.craftbukkit.CraftTravelAgent.DEFAULT; // return arbitrary TA to compensate for implementation dependent plugins PlayerPortalEvent event = new PlayerPortalEvent(entityplayer.getBukkitEntity(), enter, exit, agent, cause); event.useTravelAgent(useTravelAgent); Bukkit.getServer().getPluginManager().callEvent(event); if (event.isCancelled() || event.getTo() == null) { return; } exit = event.useTravelAgent() ? event.getPortalTravelAgent().findOrCreate(event.getTo()) : event.getTo(); if (exit == null) { return; } exitWorld = ((CraftWorld) exit.getWorld()).getHandle(); Vector velocity = entityplayer.getBukkitEntity().getVelocity(); boolean before = exitWorld.chunkProviderServer.forceChunkLoad; exitWorld.chunkProviderServer.forceChunkLoad = true; exitWorld.getTravelAgent().adjustExit(entityplayer, exit, velocity); exitWorld.chunkProviderServer.forceChunkLoad = before; this.moveToWorld(entityplayer, exitWorld.dimension, true, exit, false); // Vanilla doesn't check for suffocation when handling portals, so neither should we if (entityplayer.motX != velocity.getX() || entityplayer.motY != velocity.getY() || entityplayer.motZ != velocity.getZ()) { entityplayer.getBukkitEntity().setVelocity(velocity); } // CraftBukkit end }
@EventHandler(priority = EventPriority.HIGH) public void onPlayerPortal(final PlayerPortalEvent event) { if (event.isCancelled()) { return; } final Player player = event.getPlayer(); // Ok so a player portal event begins // Find the nearest gate! final WorldCoord playerCoord = new WorldCoord(this.playerLocationAtEvent.get(player)); final Gate nearestGate = Gates.gateFromPortal(playerCoord); if (nearestGate != null) { event.setCancelled(true); // Check teleportation method if (!Conf.useVanillaPortals) { return; } // Check player is not carrying a passenger if (player.getPassenger() != null) { return; } // Get current time final Long now = Calendar.getInstance().getTimeInMillis(); // Check player has passed cooldown period if (Plugin.lastTeleportTime.containsKey(player.getName()) && Plugin.lastTeleportTime.get(player.getName()) > now - Conf.getGateCooldownMillis()) { return; } // Check player has permission to enter the gate. if (!Plugin.hasPermManage(player, "ancientgates.use." + nearestGate.getId()) && !Plugin.hasPermManage(player, "ancientgates.use.*") && Conf.enforceAccess) { player.sendMessage("You lack the permissions to enter this gate."); return; } // Handle economy (check player has funds to use gate) if (!Plugin.handleEconManage(player, nearestGate.getCost())) { player.sendMessage("This gate costs: " + nearestGate.getCost() + ". You have insufficient funds."); return; } // Handle BungeeCord gates (BungeeCord support disabled) if (nearestGate.getBungeeTo() != null && Conf.bungeeCordSupport == false) { player.sendMessage(String.format("BungeeCord support not enabled.")); return; } // Teleport the player (Nether method) if (nearestGate.getTo() == null && nearestGate.getBungeeTo() == null && nearestGate.getCommand() == null) { player.sendMessage(String.format("This gate does not point anywhere :P")); } else if (nearestGate.getTo() != null) { TeleportUtil.teleportPlayer(player, nearestGate.getTo(), nearestGate.getTeleportEntities(), nearestGate.getTeleportInventory()); if (nearestGate.getCommand() != null) ExecuteUtil.execCommand(player, nearestGate.getCommand(), nearestGate.getCommandType()); if (nearestGate.getMessage() != null) player.sendMessage(nearestGate.getMessage()); Plugin.lastTeleportTime.put(player.getName(), now); } else if (nearestGate.getBungeeTo() != null) { TeleportUtil.teleportPlayer(player, nearestGate.getBungeeTo(), nearestGate.getBungeeType(), nearestGate.getTeleportEntities(), nearestGate.getTeleportInventory(), false, nearestGate.getCommand(), nearestGate.getCommandType(), nearestGate.getMessage()); } else { ExecuteUtil.execCommand(player, nearestGate.getCommand(), nearestGate.getCommandType(), true); Plugin.lastTeleportTime.put(player.getName(), now); } } }
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onPlayerPortal(PlayerPortalEvent event) { // If the nether is disabled then quit immediately if (!Settings.createNether) { return; } Location currentLocation = event.getFrom().clone(); String currentWorld = currentLocation.getWorld().getName(); if (!currentWorld.equalsIgnoreCase(Settings.worldName) && !currentWorld.equalsIgnoreCase(Settings.worldName + "_nether") && !currentWorld.equalsIgnoreCase(Settings.worldName + "_the_end")) { return; } // Determine what portal it is switch (event.getCause()) { case END_PORTAL: if (Settings.createEnd) { // Same action for all worlds except the end itself if (!event.getFrom().getWorld().getEnvironment().equals(Environment.THE_END)) { if (ASkyGrid.getEndWorld() != null) { // The end exists event.setCancelled(true); // Convert current location to end world location Location end_place = event.getPlayer().getLocation().toVector().toLocation(ASkyGrid.getEndWorld()); // Set the height to the top of the end grid end_place.setY(Settings.gridHeight); if (GridManager.isSafeLocation(end_place)) { event.getPlayer().teleport(end_place); return; } else { end_place = plugin.getGrid().bigScan(end_place, 10); if (end_place != null) { event.getPlayer().teleport(end_place); } else { // Try the spawn end_place = ASkyGrid.getEndWorld().getSpawnLocation(); if (GridManager.isSafeLocation(end_place)) { event.getPlayer().teleport(end_place); return; } else { event.getPlayer().sendMessage(ChatColor.RED + plugin.myLocale(event.getPlayer().getUniqueId()).warpserrorNotSafe); } } return; } } } else { // Returning from the end - just go home event.setCancelled(true); plugin.getGrid().homeTeleport(event.getPlayer()); } } break; case NETHER_PORTAL: // Get the home world of this player if (event.getFrom().getWorld().getEnvironment().equals(Environment.NORMAL)) { // Going to Nether event.setTo(event.getFrom().toVector().toLocation(ASkyGrid.getNetherWorld())); event.useTravelAgent(true); } else { // Returning event.setTo(event.getFrom().toVector().toLocation(ASkyGrid.getGridWorld())); event.useTravelAgent(true); } break; default: break; } }