Skip to content

Commit 9fecb76

Browse files
committed
fix TeleportUtils
1 parent f1ac6cf commit 9fecb76

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/main/java/cat/nyaa/nyaacore/utils/TeleportUtils.java

+7-5
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
public class TeleportUtils {
1212

13-
public static void Teleport(Player player, Location loc) {
14-
if (!player.isOnline()) {
15-
return;
13+
public static boolean Teleport(Player player, Location loc) {
14+
if (!player.isOnline() || loc == null || loc.getWorld() == null) {
15+
return false;
1616
}
1717
Essentials ess = null;
1818
if (Bukkit.getServer().getPluginManager().getPlugin("Essentials") != null) {
@@ -21,12 +21,14 @@ public static void Teleport(Player player, Location loc) {
2121
if (ess != null) {
2222
try {
2323
ess.getUser(player).getTeleport().now(loc, false, PlayerTeleportEvent.TeleportCause.PLUGIN);
24-
return;
24+
return true;
2525
} catch (Exception e) {
26-
e.printStackTrace();
26+
return false;
2727
}
28+
} else {
2829
player.setFallDistance(0);
2930
player.teleport(loc, PlayerTeleportEvent.TeleportCause.PLUGIN);
31+
return true;
3032
}
3133
}
3234

0 commit comments

Comments
 (0)