/** On player respawn, we'll act upon the settings whether to respawn them in the world or not. */
 @Override
 public void onPlayerRespawn(PlayerRespawnEvent event) {
   /** Grab the Player and World. */
   Player player = event.getPlayer();
   World world = player.getWorld();
   /** Start off with a blank Location, this allows us to error check. */
   Location l = null;
   /**
    * Check whether the server has GlobalRespawn enabled, by default this is false. If true we grab
    * the Respawn point regardless of what world they are in.
    */
   if (this.configuration.getBoolean("globalrespawn", false)) {
     l =
         playerTeleporter.getDestination(
             this.plugin.MVWorlds.get(world.getName()).getSpawnLocation(), player);
   }
   /**
    * If GlobalRespawn is disabled then we check if they have Alternate Respawning setup, if they
    * are we get the location and assign it to 'l'. Otherwise we do nothing.
    */
   else {
     if (this.configuration.getBoolean("alternaterespawn", false)) {
       if (!world.getName().equals(this.plugin.getServer().getWorlds().get(0).getName())) {
         l =
             playerTeleporter.getDestination(
                 this.plugin.MVWorlds.get(world.getName()).getSpawnLocation(), player);
       }
     }
   }
   /**
    * If the user is within the SPLike world and the RespawnToDefault setting is turned on. We will
    * respawn them back to the default World.
    */
   /*
    * if (event.getPlayer().getWorld().getName()
    * .equalsIgnoreCase(this.configuration.getString("nether"))) { if
    * (this.configuration.getBoolean("respawntodefault", true) &&
    * this.configuration.getBoolean("splike", false)) { l = this.plugin.MVWorlds.get(
    * this.plugin.getServer().getWorlds().get(0).getName()) .getSpawnLocation(); } else { l =
    * null; } }
    */
   /**
    * If both GlobalRespawn and AlternateRespawn are disabled then 'l' will still be NULL so we do
    * nothing, otherwise we teleport the player to the location.
    */
   if (l != null) {
     event.setRespawnLocation(l);
     player.teleport(l);
   }
 }
  /** On player move, detect they are inside a portal then teleport them appropriately. */
  @Override
  public void onPlayerMove(PlayerMoveEvent event) {
    if (event.isCancelled()) {
      return;
    }
    /** Grab the Player and our Players Session */
    final Player pl = event.getPlayer();
    final Location loc = pl.getLocation();

    MVPlayerSession ps = this.plugin.getPlayerSession(pl);
    if (ps == null
        || ps.getLocation().getBlockX() == loc.getBlockX()
            && ps.getLocation().getBlockY() == loc.getBlockY()
            && ps.getLocation().getBlockZ() == loc.getBlockZ()) {
      return;
    } else {
      ps.setLocation(loc); // Update the Players Session to the new Location.
    }

    /** Start the Price off at 0, this will change according to the Portal/World Settings. */
    Integer price = 0;
    /** Start of our Location as NULL, this allows us to check it later on. */
    Location d = null;
    /**
     * First we do a check against all the Portals we have created, if the area the user is within
     * is a Portal then we will act upon it; if not then we move onto our next check.
     */
    String ptest = utils.isPortal(pl.getLocation());
    if (ptest != null) {
      MVPortal p = this.plugin.MVPortals.get(ptest);
      price = (int) Math.round(p.getPrice());
      d = playerTeleporter.portalDestination(pl, ptest, p);
    }
    /** End of First Portal Check. */

    /**
     * If the first Portal Check failed then we will check for Any Signs around the player. This
     * check is only performed if the user is standing inside a Portal Block.
     */
    if (this.plugin.configMV.getBoolean("checksigns", true) && d == null) {
      d = playerTeleporter.portalSignMethod(pl);
    }
    /** End of Sign Based Portal Check. */

    /**
     * Standard Nether Portal Check, this will be for a Single Player like feel, customizeable...
     * Can be on or off.
     */
    if (this.plugin.configMV.getBoolean("splike", false) && d == null) {
      d = playerTeleporter.portalSPNether(pl);
    }
    /** End of Single Player Nether Check. */

    // TODO: Permissions to add here...
    /** If we have a Location set and it is NOT NULL then we can perform a teleport. */
    if (d != null) {
      if (!ps.getTeleportable()) {
        return;
      }
      if (!playerTeleporter.canTravelFromWorld(pl, d.getWorld())) {
        ps.sendMessage(
            "Sorry but you cannot travel to '" + d.getWorld().getName() + "' from this World!");
        return;
      }
      if (!playerTeleporter.canEnterWorld(pl, d.getWorld())) {
        ps.sendMessage("Sorry but you cannot enter the '" + d.getWorld().getName() + "' world.");
        return;
      }
      if (MultiVerse.useiConomy
          && !MultiVerse.Permissions.has(pl, "multiverse.portal.exempt")
          && price > 0) {
        Holdings balance = iConomy.getAccount(pl.getName()).getHoldings();
        if (balance.hasEnough(price)) {
          balance.subtract(price);
          pl.sendMessage(
              ChatColor.RED
                  + this.plugin.logPrefix
                  + " You have been charged "
                  + iConomy.format(price));
        } else {
          if (ps.getAlertable()) {
            pl.sendMessage("Sorry but you do not have the required funds for this portal");
            ps.setAlertCooldown();
          }
          return;
        }
      }
      final Location destination = d;
      plugin
          .getServer()
          .getScheduler()
          .scheduleSyncDelayedTask(
              plugin,
              new Runnable() {
                @Override
                public void run() {
                  pl.teleport(destination);
                }
              });
      ps.setTPCooldown();
      return;
    }
    return;
  }