package cat.nyaa.nyaacore.utils;

import com.earth2me.essentials.Essentials;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerTeleportEvent;

import java.util.List;

public class TeleportUtils {

    public static void Teleport(Player player, Location loc) {
        if (!player.isOnline()) {
            return;
        }
        Essentials ess = null;
        if (Bukkit.getServer().getPluginManager().getPlugin("Essentials") != null) {
            ess = (Essentials) Bukkit.getServer().getPluginManager().getPlugin("Essentials");
        }
        if (ess != null) {
            try {
                ess.getUser(player).getTeleport().now(loc, false, PlayerTeleportEvent.TeleportCause.PLUGIN);
                return;
            } catch (Exception e) {
                e.printStackTrace();
            }
            player.setFallDistance(0);
            player.teleport(loc, PlayerTeleportEvent.TeleportCause.PLUGIN);
        }
    }

    public static void Teleport(List<Player> players, Location loc) {
        for (Player p : players) {
            Teleport(p, loc);
        }
    }
}

@@ -274,36 +274,39 @@
   public static 
-void
+boolean
  Teleport(Player
@@ -360,16 +360,57 @@
 Online()
+ %7C%7C loc == null %7C%7C loc.getWorld() == null
 ) %7B%0A    
@@ -415,32 +415,38 @@
           return
+ false
 ;%0A        %7D%0A    
@@ -837,16 +837,21 @@
   return
+ true
 ;%0A      
@@ -900,42 +900,52 @@
     
-e.printStackTrace();%0A            %7D
+return false;%0A            %7D%0A        %7D else %7B
 %0A   
@@ -1048,32 +1048,57 @@
 tCause.PLUGIN);%0A
+            return true;%0A
         %7D%0A    %7D%0A

fix TeleportUtils