Program: 33990
Project: 33990
Buggy source:
@EventHandler(priority=EventPriority.LOWEST,ignoreCancelled=true) public void onPlayerPortal(PlayerPortalEvent event){
  UUID playerUUID=event.getPlayer().getUniqueId();
  if (!Settings.createNether || ASkyBlock.getNetherWorld() == null) {
    return;
  }
  Location currentLocation=event.getFrom().clone();
  String currentWorld=currentLocation.getWorld().getName();
  if (!currentWorld.equalsIgnoreCase(Settings.worldName) && !currentWorld.equalsIgnoreCase(Settings.worldName + "String_Node_Str") && !currentWorld.equalsIgnoreCase(Settings.worldName + "String_Node_Str")) {
    return;
  }
  Island island=plugin.getGrid().getIslandAt(currentLocation);
  if ((island == null && !Settings.allowPortalUse) || (island != null && !island.getIgsFlag(Flags.allowPortalUse))) {
    if (!event.getPlayer().isOp() && !VaultHelper.checkPerm(event.getPlayer(),Settings.PERMPREFIX + "String_Node_Str")) {
      if (!plugin.getGrid().locationIsOnIsland(event.getPlayer(),event.getPlayer().getLocation()) && !plugin.getGrid().isAtSpawn(event.getPlayer().getLocation())) {
        event.getPlayer().sendMessage(ChatColor.RED + plugin.myLocale(event.getPlayer().getUniqueId()).islandProtected);
        event.setCancelled(true);
        return;
      }
    }
  }
switch (event.getCause()) {
case END_PORTAL:
    if (!event.getFrom().getWorld().getEnvironment().equals(Environment.THE_END)) {
      if (plugin.getServer().getWorld(Settings.worldName + "String_Node_Str") != null) {
        event.setCancelled(true);
        Location end_place=plugin.getServer().getWorld(Settings.worldName + "String_Node_Str").getSpawnLocation();
        if (GridManager.isSafeLocation(end_place)) {
          event.getPlayer().teleport(end_place);
          return;
        }
 else {
          event.getPlayer().sendMessage(ChatColor.RED + plugin.myLocale(event.getPlayer().getUniqueId()).warpserrorNotSafe);
          plugin.getGrid().homeTeleport(event.getPlayer());
          return;
        }
      }
    }
 else {
      event.setCancelled(true);
      plugin.getGrid().homeTeleport(event.getPlayer());
    }
  break;
case NETHER_PORTAL:
World homeWorld=ASkyBlock.getIslandWorld();
Location home=plugin.getPlayers().getHomeLocation(event.getPlayer().getUniqueId());
if (home != null) {
homeWorld=home.getWorld();
}
if (!Settings.newNether) {
if (event.getFrom().getWorld().getEnvironment().equals(Environment.NORMAL)) {
if (homeWorld.getEnvironment().equals(Environment.NORMAL)) {
event.setTo(ASkyBlock.getNetherWorld().getSpawnLocation());
event.useTravelAgent(true);
}
 else {
event.useTravelAgent(false);
Location dest=plugin.getGrid().getSafeHomeLocation(playerUUID,1);
if (dest != null) {
  event.setTo(dest);
}
 else {
  event.setCancelled(true);
  new SafeSpotTeleport(plugin,event.getPlayer(),plugin.getPlayers().getIslandLocation(playerUUID),1);
}
}
}
 else {
if (homeWorld.getEnvironment().equals(Environment.NORMAL)) {
event.useTravelAgent(false);
Location dest=plugin.getGrid().getSafeHomeLocation(playerUUID,1);
if (dest != null) {
  event.setTo(dest);
}
 else {
  event.setCancelled(true);
  new SafeSpotTeleport(plugin,event.getPlayer(),plugin.getPlayers().getIslandLocation(playerUUID),1);
}
}
 else {
event.setTo(ASkyBlock.getIslandWorld().getSpawnLocation());
event.useTravelAgent(true);
}
}
}
 else {
if (island == null) {
event.setCancelled(true);
return;
}
Location dest=event.getFrom().toVector().toLocation(ASkyBlock.getIslandWorld());
if (event.getFrom().getWorld().getEnvironment().equals(Environment.NORMAL)) {
dest=event.getFrom().toVector().toLocation(ASkyBlock.getNetherWorld());
if (island.getCenter().toVector().toLocation(ASkyBlock.getNetherWorld()).getBlock().getType() != Material.BEDROCK) {
if (plugin.getGrid().bigScan(dest,20) == null) {
  plugin.getLogger().warning("String_Node_Str" + event.getPlayer().getName() + "String_Node_Str");
  Schematic nether=IslandCmd.getSchematics().get("String_Node_Str");
  if (nether != null) {
    plugin.getIslandCmd().pasteSchematic(nether,island.getCenter().toVector().toLocation(ASkyBlock.getNetherWorld()),event.getPlayer());
  }
 else {
    plugin.getLogger().severe("String_Node_Str");
    event.setCancelled(true);
    event.getPlayer().sendMessage(ChatColor.RED + plugin.myLocale(event.getPlayer().getUniqueId()).warpserrorNotSafe);
    return;
  }
}
}
}
event.setCancelled(true);
new SafeSpotTeleport(plugin,event.getPlayer(),dest);
}
break;
default :
break;
}
}

Fixed version (ground truth):
@EventHandler(priority=EventPriority.LOWEST,ignoreCancelled=true) public void onPlayerPortal(PlayerPortalEvent event){
  UUID playerUUID=event.getPlayer().getUniqueId();
  if (!Settings.createNether || ASkyBlock.getNetherWorld() == null) {
    return;
  }
  Location currentLocation=event.getFrom().clone();
  String currentWorld=currentLocation.getWorld().getName();
  if (!currentWorld.equalsIgnoreCase(Settings.worldName) && !currentWorld.equalsIgnoreCase(Settings.worldName + "String_Node_Str") && !currentWorld.equalsIgnoreCase(Settings.worldName + "String_Node_Str")) {
    return;
  }
  Island island=plugin.getGrid().getIslandAt(currentLocation);
  if ((island == null && !Settings.allowPortalUse) || (island != null && !island.getIgsFlag(Flags.allowPortalUse))) {
    if (!event.getPlayer().isOp() && !VaultHelper.checkPerm(event.getPlayer(),Settings.PERMPREFIX + "String_Node_Str")) {
      if (!plugin.getGrid().locationIsOnIsland(event.getPlayer(),event.getPlayer().getLocation()) && !plugin.getGrid().isAtSpawn(event.getPlayer().getLocation())) {
        event.getPlayer().sendMessage(ChatColor.RED + plugin.myLocale(event.getPlayer().getUniqueId()).islandProtected);
        event.setCancelled(true);
        return;
      }
    }
  }
switch (event.getCause()) {
case END_PORTAL:
    if (!event.getFrom().getWorld().getEnvironment().equals(Environment.THE_END)) {
      if (plugin.getServer().getWorld(Settings.worldName + "String_Node_Str") != null) {
        event.setCancelled(true);
        Location end_place=plugin.getServer().getWorld(Settings.worldName + "String_Node_Str").getSpawnLocation();
        if (GridManager.isSafeLocation(end_place)) {
          event.getPlayer().teleport(end_place);
          return;
        }
 else {
          event.getPlayer().sendMessage(ChatColor.RED + plugin.myLocale(event.getPlayer().getUniqueId()).warpserrorNotSafe);
          plugin.getGrid().homeTeleport(event.getPlayer());
          return;
        }
      }
    }
 else {
      event.setCancelled(true);
      plugin.getGrid().homeTeleport(event.getPlayer());
    }
  break;
case NETHER_PORTAL:
World homeWorld=ASkyBlock.getIslandWorld();
Location home=plugin.getPlayers().getHomeLocation(event.getPlayer().getUniqueId());
if (home != null) {
homeWorld=home.getWorld();
}
if (!Settings.newNether) {
if (event.getFrom().getWorld().getEnvironment().equals(Environment.NORMAL)) {
if (homeWorld.getEnvironment().equals(Environment.NORMAL)) {
event.setTo(ASkyBlock.getNetherWorld().getSpawnLocation());
event.useTravelAgent(true);
}
 else {
event.useTravelAgent(false);
Location dest=plugin.getGrid().getSafeHomeLocation(playerUUID,1);
if (dest != null) {
  event.setTo(dest);
}
 else {
  event.setCancelled(true);
  new SafeSpotTeleport(plugin,event.getPlayer(),plugin.getPlayers().getIslandLocation(playerUUID),1);
}
}
}
 else {
if (homeWorld.getEnvironment().equals(Environment.NORMAL)) {
event.useTravelAgent(false);
Location dest=plugin.getGrid().getSafeHomeLocation(playerUUID,1);
if (dest != null) {
  event.setTo(dest);
}
 else {
  event.setCancelled(true);
  new SafeSpotTeleport(plugin,event.getPlayer(),plugin.getPlayers().getIslandLocation(playerUUID),1);
}
}
 else {
event.setTo(ASkyBlock.getIslandWorld().getSpawnLocation());
event.useTravelAgent(true);
}
}
}
 else {
if (island == null) {
event.setCancelled(true);
return;
}
Location overworldIsland=island.getCenter().toVector().toLocation(ASkyBlock.getIslandWorld());
Location netherIsland=island.getCenter().toVector().toLocation(ASkyBlock.getNetherWorld());
if (event.getFrom().getWorld().getEnvironment().equals(Environment.NORMAL)) {
if (netherIsland.getBlock().getType() != Material.BEDROCK) {
if (plugin.getGrid().bigScan(netherIsland,20) == null) {
  plugin.getLogger().warning("String_Node_Str" + event.getPlayer().getName() + "String_Node_Str");
  Schematic nether=IslandCmd.getSchematics().get("String_Node_Str");
  if (nether != null) {
    plugin.getIslandCmd().pasteSchematic(nether,netherIsland,event.getPlayer());
  }
 else {
    plugin.getLogger().severe("String_Node_Str");
    event.setCancelled(true);
    event.getPlayer().sendMessage(ChatColor.RED + plugin.myLocale(event.getPlayer().getUniqueId()).warpserrorNotSafe);
    return;
  }
}
}
event.setCancelled(true);
new SafeSpotTeleport(plugin,event.getPlayer(),netherIsland);
return;
}
event.setCancelled(true);
new SafeSpotTeleport(plugin,event.getPlayer(),overworldIsland);
}
break;
default :
break;
}
}