Tidies up and comments the economy handler and removes the depreciated method of getting an offline player by username

This commit is contained in:
2021-02-08 14:30:14 +01:00
parent f97cb32466
commit e702a0d734
2 changed files with 77 additions and 61 deletions

View File

@ -542,18 +542,6 @@ public class Stargate extends JavaPlugin {
return portal.isOwner(player) && hasPerm(player, "stargate.destroy.personal");
}
/*
* Charge player for {action} if required, true on success, false if can't afford
*/
public static boolean chargePlayer(Player player, String target, int cost) {
// If cost is 0
if (cost == 0) return true;
// Economy is disabled
if (!EconomyHandler.useEconomy()) return true;
// Charge player
return EconomyHandler.chargePlayer(player, target, cost);
}
/*
* Charge player for {action} if required, true on success, false if can't afford
*/
@ -817,11 +805,7 @@ public class Stargate extends JavaPlugin {
if (cost > 0) {
boolean success;
if (portal.getGate().getToOwner()) {
if (portal.getOwnerUUID() == null) {
success = Stargate.chargePlayer(player, portal.getOwnerUUID(), cost);
} else {
success = Stargate.chargePlayer(player, portal.getOwnerName(), cost);
}
success = portal.getOwnerUUID() != null && Stargate.chargePlayer(player, portal.getOwnerUUID(), cost);
} else {
success = Stargate.chargePlayer(player, cost);
}