mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-04 06:28:49 +00:00
Fix IllegalArgumentException when returning to a last position that has not been defined yet
This commit is contained in:
1 parent
97df373fbb
commit
5b6976b652
1 file changed
+25
-20
@@ -86,33 +86,38 @@ public class TeleportManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void queueBackTeleport(Player player, Connection connection) throws SQLException {
|
public static void queueBackTeleport(Player player, Connection connection) throws SQLException {
|
||||||
TeleportationPoint lastPosition = DataManager.getPlayerLastPosition(player, connection);
|
try {
|
||||||
if (lastPosition != null) {
|
TeleportationPoint lastPosition = DataManager.getPlayerLastPosition(player, connection);
|
||||||
if (HuskHomes.getSettings().doEconomy()) {
|
if (lastPosition != null) {
|
||||||
double backCost = HuskHomes.getSettings().getBackCost();
|
|
||||||
if (backCost > 0) {
|
|
||||||
if (!VaultIntegration.hasMoney(player, backCost)) {
|
|
||||||
MessageManager.sendMessage(player, "error_insufficient_funds", VaultIntegration.format(backCost));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (player.hasPermission("huskhomes.bypass_timer")) {
|
|
||||||
if (HuskHomes.getSettings().doEconomy()) {
|
if (HuskHomes.getSettings().doEconomy()) {
|
||||||
double backCost = HuskHomes.getSettings().getRtpCost();
|
double backCost = HuskHomes.getSettings().getBackCost();
|
||||||
if (backCost > 0) {
|
if (backCost > 0) {
|
||||||
VaultIntegration.takeMoney(player, backCost);
|
if (!VaultIntegration.hasMoney(player, backCost)) {
|
||||||
MessageManager.sendMessage(player, "rtp_spent_money", VaultIntegration.format(backCost));
|
MessageManager.sendMessage(player, "error_insufficient_funds", VaultIntegration.format(backCost));
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
teleportPlayer(player, lastPosition, connection);
|
if (player.hasPermission("huskhomes.bypass_timer")) {
|
||||||
return;
|
if (HuskHomes.getSettings().doEconomy()) {
|
||||||
}
|
double backCost = HuskHomes.getSettings().getRtpCost();
|
||||||
|
if (backCost > 0) {
|
||||||
|
VaultIntegration.takeMoney(player, backCost);
|
||||||
|
MessageManager.sendMessage(player, "rtp_spent_money", VaultIntegration.format(backCost));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
teleportPlayer(player, lastPosition, connection);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
new TimedTeleport(player, lastPosition, TimedTeleport.TargetType.BACK).begin();
|
new TimedTeleport(player, lastPosition, TimedTeleport.TargetType.BACK).begin();
|
||||||
} else {
|
} else {
|
||||||
|
MessageManager.sendMessage(player, "error_no_last_position");
|
||||||
|
}
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
MessageManager.sendMessage(player, "error_no_last_position");
|
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 {
|
||||||
|
|||||||
Reference in new issue
Block a user