Fix IllegalArgumentException when returning to a last position that has not been defined yet

This commit is contained in:
WiIIiam278 committed 2021-06-16 22:00:01 +01:00
1 parent 97df373fbb
commit 5b6976b652
1 file changed
+5
@@ -86,6 +86,7 @@ public class TeleportManager {
} }
public static void queueBackTeleport(Player player, Connection connection) throws SQLException { public static void queueBackTeleport(Player player, Connection connection) throws SQLException {
try {
TeleportationPoint lastPosition = DataManager.getPlayerLastPosition(player, connection); TeleportationPoint lastPosition = DataManager.getPlayerLastPosition(player, connection);
if (lastPosition != null) { if (lastPosition != null) {
if (HuskHomes.getSettings().doEconomy()) { if (HuskHomes.getSettings().doEconomy()) {
@@ -113,6 +114,10 @@ public class TeleportManager {
} else { } else {
MessageManager.sendMessage(player, "error_no_last_position"); MessageManager.sendMessage(player, "error_no_last_position");
} }
} catch (IllegalArgumentException e) {
MessageManager.sendMessage(player, "error_no_last_position");
}
} }
public static void queueRandomTeleport(Player player, Connection connection) throws SQLException { public static void queueRandomTeleport(Player player, Connection connection) throws SQLException {