Program: 33879
Project: 33879
Buggy source:
/** 
 * Prevents teleporting when falling based on setting and teleporting to locked islands
 * @param e
 */
@EventHandler(priority=EventPriority.HIGH,ignoreCancelled=true) public void onPlayerTeleport(final PlayerTeleportEvent e){
  if (DEBUG) {
    plugin.getLogger().info(e.getEventName());
    plugin.getLogger().info("String_Node_Str" + e.getTo());
    plugin.getLogger().info("String_Node_Str" + e.getFrom());
  }
  if (e.getTo() == null || e.getFrom() == null) {
    return;
  }
  if (!IslandGuard.inWorld(e.getTo()) && !IslandGuard.inWorld(e.getFrom())) {
    if (DEBUG)     plugin.getLogger().info("String_Node_Str");
    return;
  }
  if (plugin.getGrid() == null) {
    if (DEBUG)     plugin.getLogger().info("String_Node_Str");
    return;
  }
  if (!Settings.allowTeleportWhenFalling && e.getPlayer().getGameMode().equals(GameMode.SURVIVAL) && !e.getPlayer().isOp()) {
    if (DEBUG)     plugin.getLogger().info("String_Node_Str");
    if (plugin.getPlayers().isInTeleport(e.getPlayer().getUniqueId())) {
      if (DEBUG)       plugin.getLogger().info("String_Node_Str");
      unsetFalling(e.getPlayer().getUniqueId());
    }
 else     if (isFalling(e.getPlayer().getUniqueId())) {
      if (DEBUG)       plugin.getLogger().info("String_Node_Str");
      Util.sendMessage(e.getPlayer(),plugin.myLocale(e.getPlayer().getUniqueId()).islandcannotTeleport);
      e.setCancelled(true);
      if (e.getPlayer().getLocation().getBlockY() < 0) {
        if (DEBUG)         plugin.getLogger().info("String_Node_Str");
        e.getPlayer().setHealth(0D);
        unsetFalling(e.getPlayer().getUniqueId());
      }
      return;
    }
  }
  if (DEBUG)   plugin.getLogger().info("String_Node_Str");
  Island islandFrom=plugin.getGrid().getProtectedIslandAt(e.getFrom());
  if (DEBUG && islandFrom != null)   plugin.getLogger().info("String_Node_Str");
  Island islandTo=plugin.getGrid().getProtectedIslandAt(e.getTo());
  if (DEBUG && islandTo != null)   plugin.getLogger().info("String_Node_Str");
  if (e.getCause() != null) {
    if (e.getCause().equals(TeleportCause.ENDER_PEARL)) {
      if (DEBUG)       plugin.getLogger().info("String_Node_Str");
      if (islandTo == null) {
        if (Settings.defaultWorldSettings.get(SettingsFlag.ENDER_PEARL)) {
          return;
        }
      }
 else {
        if (DEBUG)         plugin.getLogger().info("String_Node_Str");
        if (DEBUG)         plugin.getLogger().info("String_Node_Str");
        if (islandTo.getIgsFlag(SettingsFlag.ENDER_PEARL) || islandTo.getMembers().contains(e.getPlayer().getUniqueId())) {
          if (DEBUG)           plugin.getLogger().info("String_Node_Str");
          return;
        }
      }
      if (DEBUG)       plugin.getLogger().info("String_Node_Str");
      Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
      e.setCancelled(true);
      return;
    }
 else     if (!plugin.getServer().getVersion().contains("String_Node_Str") && !plugin.getServer().getVersion().contains("String_Node_Str")) {
      if (DEBUG)       plugin.getLogger().info("String_Node_Str");
      if (e.getCause().equals(TeleportCause.CHORUS_FRUIT)) {
        if (DEBUG)         plugin.getLogger().info("String_Node_Str");
        boolean cancel=false;
        if (islandTo == null) {
          if (!Settings.defaultWorldSettings.get(SettingsFlag.CHORUS_FRUIT)) {
            cancel=true;
          }
        }
 else {
          if (!islandTo.getIgsFlag(SettingsFlag.CHORUS_FRUIT) && !islandTo.getMembers().contains(e.getPlayer().getUniqueId())) {
            cancel=true;
          }
        }
        if (islandFrom == null) {
          if (!Settings.defaultWorldSettings.get(SettingsFlag.CHORUS_FRUIT)) {
            cancel=true;
          }
        }
 else {
          if (!islandFrom.getIgsFlag(SettingsFlag.CHORUS_FRUIT) && !islandFrom.getMembers().contains(e.getPlayer().getUniqueId())) {
            cancel=true;
          }
        }
        if (cancel) {
          Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
          e.setCancelled(true);
        }
        return;
      }
    }
  }
  if (DEBUG)   plugin.getLogger().info("String_Node_Str");
  if (islandTo != null && islandFrom == null && (islandTo.getOwner() != null || islandTo.isSpawn())) {
    if (DEBUG)     plugin.getLogger().info("String_Node_Str");
    if (islandTo.isLocked() || plugin.getPlayers().isBanned(islandTo.getOwner(),e.getPlayer().getUniqueId())) {
      Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).lockIslandLocked);
      if (!plugin.getGrid().locationIsOnIsland(e.getPlayer(),e.getTo()) && !e.getPlayer().isOp() && !VaultHelper.checkPerm(e.getPlayer(),Settings.PERMPREFIX + "String_Node_Str")&& !VaultHelper.checkPerm(e.getPlayer(),Settings.PERMPREFIX + "String_Node_Str")) {
        if (DEBUG)         plugin.getLogger().info("String_Node_Str");
        e.setCancelled(true);
        return;
      }
    }
    if (islandTo.isSpawn()) {
      if (DEBUG)       plugin.getLogger().info("String_Node_Str");
      if (!plugin.myLocale(e.getPlayer().getUniqueId()).lockEnteringSpawn.isEmpty()) {
        Util.sendMessage(e.getPlayer(),plugin.myLocale(e.getPlayer().getUniqueId()).lockEnteringSpawn);
      }
    }
 else {
      if (DEBUG)       plugin.getLogger().info("String_Node_Str");
      if (!plugin.myLocale(e.getPlayer().getUniqueId()).lockNowEntering.isEmpty()) {
        Util.sendMessage(e.getPlayer(),plugin.myLocale(e.getPlayer().getUniqueId()).lockNowEntering.replace("String_Node_Str",plugin.getGrid().getIslandName(islandTo.getOwner())));
      }
    }
    final IslandEnterEvent event=new IslandEnterEvent(e.getPlayer().getUniqueId(),islandTo,e.getTo());
    plugin.getServer().getPluginManager().callEvent(event);
  }
 else   if (islandTo == null && islandFrom != null && (islandFrom.getOwner() != null || islandFrom.isSpawn())) {
    if (DEBUG)     plugin.getLogger().info("String_Node_Str");
    if (islandFrom.isSpawn()) {
      if (DEBUG)       plugin.getLogger().info("String_Node_Str");
      if (!plugin.myLocale(e.getPlayer().getUniqueId()).lockLeavingSpawn.isEmpty()) {
        Util.sendMessage(e.getPlayer(),plugin.myLocale(e.getPlayer().getUniqueId()).lockLeavingSpawn);
      }
    }
 else {
      if (DEBUG)       plugin.getLogger().info("String_Node_Str");
      if (!plugin.myLocale(e.getPlayer().getUniqueId()).lockNowLeaving.isEmpty()) {
        Util.sendMessage(e.getPlayer(),plugin.myLocale(e.getPlayer().getUniqueId()).lockNowLeaving.replace("String_Node_Str",plugin.getGrid().getIslandName(islandFrom.getOwner())));
      }
    }
    final IslandExitEvent event=new IslandExitEvent(e.getPlayer().getUniqueId(),islandFrom,e.getTo());
    plugin.getServer().getPluginManager().callEvent(event);
  }
 else   if (islandTo != null && islandFrom != null && !islandTo.equals(islandFrom)) {
    if (DEBUG)     plugin.getLogger().info("String_Node_Str");
    if (islandTo.isLocked() || plugin.getPlayers().isBanned(islandTo.getOwner(),e.getPlayer().getUniqueId())) {
      Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).lockIslandLocked);
      if (!plugin.getGrid().locationIsOnIsland(e.getPlayer(),e.getTo()) && !e.getPlayer().isOp() && !VaultHelper.checkPerm(e.getPlayer(),Settings.PERMPREFIX + "String_Node_Str")&& !VaultHelper.checkPerm(e.getPlayer(),Settings.PERMPREFIX + "String_Node_Str")) {
        if (DEBUG)         plugin.getLogger().info("String_Node_Str");
        e.setCancelled(true);
        return;
      }
    }
    if (islandFrom.isSpawn()) {
      Util.sendMessage(e.getPlayer(),plugin.myLocale(e.getPlayer().getUniqueId()).lockLeavingSpawn);
    }
 else     if (islandFrom.getOwner() != null) {
      Util.sendMessage(e.getPlayer(),plugin.myLocale(e.getPlayer().getUniqueId()).lockNowLeaving.replace("String_Node_Str",plugin.getGrid().getIslandName(islandFrom.getOwner())));
    }
    if (islandTo.isSpawn()) {
      Util.sendMessage(e.getPlayer(),plugin.myLocale(e.getPlayer().getUniqueId()).lockEnteringSpawn);
    }
 else     if (islandTo.getOwner() != null) {
      Util.sendMessage(e.getPlayer(),plugin.myLocale(e.getPlayer().getUniqueId()).lockNowEntering.replace("String_Node_Str",plugin.getGrid().getIslandName(islandTo.getOwner())));
    }
    final IslandExitEvent event=new IslandExitEvent(e.getPlayer().getUniqueId(),islandTo,e.getTo());
    plugin.getServer().getPluginManager().callEvent(event);
    final IslandEnterEvent event2=new IslandEnterEvent(e.getPlayer().getUniqueId(),islandFrom,e.getTo());
    plugin.getServer().getPluginManager().callEvent(event2);
  }
}

Fixed version (ground truth):
/** 
 * Prevents teleporting when falling based on setting and teleporting to locked islands
 * @param e
 */
@EventHandler(priority=EventPriority.HIGH,ignoreCancelled=true) public void onPlayerTeleport(final PlayerTeleportEvent e){
  if (DEBUG) {
    plugin.getLogger().info(e.getEventName());
    plugin.getLogger().info("String_Node_Str" + e.getTo());
    plugin.getLogger().info("String_Node_Str" + e.getFrom());
  }
  if (e.getTo() == null || e.getFrom() == null) {
    return;
  }
  if (!IslandGuard.inWorld(e.getTo()) && !IslandGuard.inWorld(e.getFrom())) {
    if (DEBUG)     plugin.getLogger().info("String_Node_Str");
    return;
  }
  if (plugin.getGrid() == null) {
    if (DEBUG)     plugin.getLogger().info("String_Node_Str");
    return;
  }
  if (!Settings.allowTeleportWhenFalling && e.getPlayer().getGameMode().equals(GameMode.SURVIVAL) && !e.getPlayer().isOp()) {
    if (DEBUG)     plugin.getLogger().info("String_Node_Str");
    if (plugin.getPlayers().isInTeleport(e.getPlayer().getUniqueId())) {
      if (DEBUG)       plugin.getLogger().info("String_Node_Str");
      unsetFalling(e.getPlayer().getUniqueId());
    }
 else     if (isFalling(e.getPlayer().getUniqueId())) {
      if (DEBUG)       plugin.getLogger().info("String_Node_Str");
      Util.sendMessage(e.getPlayer(),plugin.myLocale(e.getPlayer().getUniqueId()).islandcannotTeleport);
      e.setCancelled(true);
      if (e.getPlayer().getLocation().getBlockY() < 0) {
        if (DEBUG)         plugin.getLogger().info("String_Node_Str");
        e.getPlayer().setHealth(0D);
        unsetFalling(e.getPlayer().getUniqueId());
      }
      return;
    }
  }
  if (DEBUG)   plugin.getLogger().info("String_Node_Str");
  Island islandFrom=plugin.getGrid().getProtectedIslandAt(e.getFrom());
  if (DEBUG && islandFrom != null)   plugin.getLogger().info("String_Node_Str");
  Island islandTo=plugin.getGrid().getProtectedIslandAt(e.getTo());
  if (DEBUG && islandTo != null)   plugin.getLogger().info("String_Node_Str");
  if (e.getCause() != null) {
    if (e.getCause().equals(TeleportCause.ENDER_PEARL)) {
      if (DEBUG)       plugin.getLogger().info("String_Node_Str");
      if (islandTo == null) {
        if (Settings.defaultWorldSettings.get(SettingsFlag.ENDER_PEARL)) {
          return;
        }
      }
 else {
        if (DEBUG)         plugin.getLogger().info("String_Node_Str");
        if (DEBUG)         plugin.getLogger().info("String_Node_Str");
        if (islandTo.getIgsFlag(SettingsFlag.ENDER_PEARL) || islandTo.getMembers().contains(e.getPlayer().getUniqueId())) {
          if (DEBUG)           plugin.getLogger().info("String_Node_Str");
          return;
        }
      }
      if (DEBUG)       plugin.getLogger().info("String_Node_Str");
      Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
      e.setCancelled(true);
      return;
    }
 else     if (!plugin.getServer().getVersion().contains("String_Node_Str") && !plugin.getServer().getVersion().contains("String_Node_Str")) {
      if (DEBUG)       plugin.getLogger().info("String_Node_Str");
      if (e.getCause().equals(TeleportCause.CHORUS_FRUIT)) {
        if (DEBUG)         plugin.getLogger().info("String_Node_Str");
        boolean cancel=false;
        if (islandTo == null) {
          if (!Settings.defaultWorldSettings.get(SettingsFlag.CHORUS_FRUIT)) {
            cancel=true;
          }
        }
 else {
          if (!islandTo.getIgsFlag(SettingsFlag.CHORUS_FRUIT) && !islandTo.getMembers().contains(e.getPlayer().getUniqueId())) {
            cancel=true;
          }
        }
        if (islandFrom == null) {
          if (!Settings.defaultWorldSettings.get(SettingsFlag.CHORUS_FRUIT)) {
            cancel=true;
          }
        }
 else {
          if (!islandFrom.getIgsFlag(SettingsFlag.CHORUS_FRUIT) && !islandFrom.getMembers().contains(e.getPlayer().getUniqueId())) {
            cancel=true;
          }
        }
        if (cancel) {
          Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
          e.setCancelled(true);
        }
        return;
      }
    }
  }
  if (DEBUG)   plugin.getLogger().info("String_Node_Str");
  if (islandTo != null && islandFrom == null && (islandTo.getOwner() != null || islandTo.isSpawn())) {
    if (DEBUG)     plugin.getLogger().info("String_Node_Str");
    if (islandTo.isLocked() || plugin.getPlayers().isBanned(islandTo.getOwner(),e.getPlayer().getUniqueId())) {
      Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).lockIslandLocked);
      if (!plugin.getGrid().locationIsOnIsland(e.getPlayer(),e.getTo()) && !e.getPlayer().isOp() && !VaultHelper.checkPerm(e.getPlayer(),Settings.PERMPREFIX + "String_Node_Str")&& !VaultHelper.checkPerm(e.getPlayer(),Settings.PERMPREFIX + "String_Node_Str")) {
        if (DEBUG)         plugin.getLogger().info("String_Node_Str");
        e.setCancelled(true);
        return;
      }
    }
    if (islandTo.isSpawn()) {
      if (DEBUG)       plugin.getLogger().info("String_Node_Str");
      if (!plugin.myLocale(e.getPlayer().getUniqueId()).lockEnteringSpawn.isEmpty()) {
        Util.sendMessage(e.getPlayer(),plugin.myLocale(e.getPlayer().getUniqueId()).lockEnteringSpawn);
      }
    }
 else {
      if (DEBUG)       plugin.getLogger().info("String_Node_Str");
      if (!plugin.myLocale(e.getPlayer().getUniqueId()).lockNowEntering.isEmpty()) {
        Util.sendMessage(e.getPlayer(),plugin.myLocale(e.getPlayer().getUniqueId()).lockNowEntering.replace("String_Node_Str",plugin.getGrid().getIslandName(islandTo.getOwner())));
      }
    }
    final IslandEnterEvent event=new IslandEnterEvent(e.getPlayer().getUniqueId(),islandTo,e.getTo());
    plugin.getServer().getPluginManager().callEvent(event);
  }
 else   if (islandTo == null && islandFrom != null && (islandFrom.getOwner() != null || islandFrom.isSpawn())) {
    if (DEBUG)     plugin.getLogger().info("String_Node_Str");
    if (islandFrom.isSpawn()) {
      if (DEBUG)       plugin.getLogger().info("String_Node_Str");
      if (!plugin.myLocale(e.getPlayer().getUniqueId()).lockLeavingSpawn.isEmpty()) {
        Util.sendMessage(e.getPlayer(),plugin.myLocale(e.getPlayer().getUniqueId()).lockLeavingSpawn);
      }
    }
 else {
      if (DEBUG)       plugin.getLogger().info("String_Node_Str");
      if (!plugin.myLocale(e.getPlayer().getUniqueId()).lockNowLeaving.isEmpty()) {
        Util.sendMessage(e.getPlayer(),plugin.myLocale(e.getPlayer().getUniqueId()).lockNowLeaving.replace("String_Node_Str",plugin.getGrid().getIslandName(islandFrom.getOwner())));
      }
    }
    removeTempPerms(e.getPlayer(),islandFrom,islandTo);
    final IslandExitEvent event=new IslandExitEvent(e.getPlayer().getUniqueId(),islandFrom,e.getFrom());
    plugin.getServer().getPluginManager().callEvent(event);
  }
 else   if (islandTo != null && islandFrom != null && !islandTo.equals(islandFrom)) {
    if (DEBUG)     plugin.getLogger().info("String_Node_Str");
    if (islandTo.isLocked() || plugin.getPlayers().isBanned(islandTo.getOwner(),e.getPlayer().getUniqueId())) {
      Util.sendMessage(e.getPlayer(),ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).lockIslandLocked);
      if (!plugin.getGrid().locationIsOnIsland(e.getPlayer(),e.getTo()) && !e.getPlayer().isOp() && !VaultHelper.checkPerm(e.getPlayer(),Settings.PERMPREFIX + "String_Node_Str")&& !VaultHelper.checkPerm(e.getPlayer(),Settings.PERMPREFIX + "String_Node_Str")) {
        if (DEBUG)         plugin.getLogger().info("String_Node_Str");
        e.setCancelled(true);
        return;
      }
    }
    if (islandFrom.isSpawn()) {
      Util.sendMessage(e.getPlayer(),plugin.myLocale(e.getPlayer().getUniqueId()).lockLeavingSpawn);
    }
 else     if (islandFrom.getOwner() != null) {
      Util.sendMessage(e.getPlayer(),plugin.myLocale(e.getPlayer().getUniqueId()).lockNowLeaving.replace("String_Node_Str",plugin.getGrid().getIslandName(islandFrom.getOwner())));
    }
    if (islandTo.isSpawn()) {
      Util.sendMessage(e.getPlayer(),plugin.myLocale(e.getPlayer().getUniqueId()).lockEnteringSpawn);
    }
 else     if (islandTo.getOwner() != null) {
      Util.sendMessage(e.getPlayer(),plugin.myLocale(e.getPlayer().getUniqueId()).lockNowEntering.replace("String_Node_Str",plugin.getGrid().getIslandName(islandTo.getOwner())));
    }
    if (!islandTo.getMembers().contains(e.getPlayer().getUniqueId())) {
      removeTempPerms(e.getPlayer(),islandFrom,islandTo);
    }
    final IslandExitEvent event=new IslandExitEvent(e.getPlayer().getUniqueId(),islandFrom,e.getFrom());
    plugin.getServer().getPluginManager().callEvent(event);
    final IslandEnterEvent event2=new IslandEnterEvent(e.getPlayer().getUniqueId(),islandTo,e.getTo());
    plugin.getServer().getPluginManager().callEvent(event2);
  }
}