Changes EconomyHandler method names to be more consistent

This commit is contained in:
Kristian Knarvik 2021-10-15 19:25:31 +02:00
parent d45af537cd
commit e2c91c1feb
5 changed files with 17 additions and 17 deletions

View File

@ -15,7 +15,7 @@ import org.jetbrains.annotations.NotNull;
public class StargateEntityPortalEvent extends StargateEvent {
private static final HandlerList handlers = new HandlerList();
Entity travellingEntity;
final Entity travellingEntity;
private final Portal destination;
private Location exit;

View File

@ -102,9 +102,9 @@ public class VehicleEventListener implements Listener {
}
//Transfer payment if necessary
int cost = EconomyHandler.getUseCost(player, entrancePortal, destinationPortal);
int cost = EconomyHandler.getDefaultUseCost(player, entrancePortal, destinationPortal);
if (cost > 0) {
if (!EconomyHelper.payTeleportFee(entrancePortal, player, cost)) {
if (EconomyHelper.cannotPayTeleportFee(entrancePortal, player, cost)) {
return;
}
}

View File

@ -32,7 +32,7 @@ public final class EconomyHandler {
*
* @return <p>The gate use cost</p>
*/
public static int getUseCost() {
public static int getDefaultUseCost() {
return useCost;
}
@ -43,7 +43,7 @@ public final class EconomyHandler {
*
* @param useCost <p>The gate use cost</p>
*/
public static void setUseCost(int useCost) {
public static void setDefaultUseCost(int useCost) {
if (useCost < 0) {
throw new IllegalArgumentException("Using a gate cannot cost a negative amount");
}
@ -66,7 +66,7 @@ public final class EconomyHandler {
*
* @param createCost <p>The gate creation cost</p>
*/
public static void setCreateCost(int createCost) {
public static void setDefaultCreateCost(int createCost) {
EconomyHandler.createCost = createCost;
}
@ -84,7 +84,7 @@ public final class EconomyHandler {
*
* @param destroyCost <p>The gate destruction cost</p>
*/
public static void setDestroyCost(int destroyCost) {
public static void setDefaultDestroyCost(int destroyCost) {
EconomyHandler.destroyCost = destroyCost;
}
@ -99,7 +99,7 @@ public final class EconomyHandler {
if (skipPayment(cost)) {
return true;
}
// Charge player
//Charge player
return EconomyHandler.chargePlayer(player, cost);
}
@ -115,7 +115,7 @@ public final class EconomyHandler {
if (skipPayment(cost)) {
return true;
}
// Charge player
//Charge player
return EconomyHandler.chargePlayer(player, target, cost);
}
@ -143,7 +143,7 @@ public final class EconomyHandler {
if (!economyEnabled) {
return false;
}
// Check for Vault
//Check if vault is loaded
Plugin vault = pluginManager.getPlugin("Vault");
if (vault != null && vault.isEnabled()) {
RegisteredServiceProvider<Economy> economyProvider = Stargate.server.getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
@ -188,7 +188,7 @@ public final class EconomyHandler {
* @param destination <p>The destination portal</p>
* @return <p>The cost of using the portal</p>
*/
public static int getUseCost(Player player, Portal source, Portal destination) {
public static int getDefaultUseCost(Player player, Portal source, Portal destination) {
//No payment required
if (!EconomyHandler.useEconomy() || source.getOptions().isFree()) {
return 0;

View File

@ -19,9 +19,9 @@ public final class EconomyHelper {
* @param entrancePortal <p>The portal the player is entering</p>
* @param player <p>The player wishing to teleport</p>
* @param cost <p>The cost of teleportation</p>
* @return <p>True if payment was successful</p>
* @return <p>False if payment was successful. True if the payment was unsuccessful</p>
*/
public static boolean payTeleportFee(Portal entrancePortal, Player player, int cost) {
public static boolean cannotPayTeleportFee(Portal entrancePortal, Player player, int cost) {
boolean success;
//Try to charge the player
@ -36,7 +36,7 @@ public final class EconomyHelper {
if (!success) {
sendInsufficientFundsMessage(entrancePortal.getName(), player, cost);
entrancePortal.close(false);
return false;
return true;
}
//Send the deduct-message to the player
@ -55,7 +55,7 @@ public final class EconomyHelper {
sendObtainMessage(entrancePortal.getName(), gateOwner, cost);
}
}
return true;
return false;
}
/**

View File

@ -405,9 +405,9 @@ public final class PermissionHelper {
}
//Player cannot pay for teleportation
int cost = EconomyHandler.getUseCost(player, entrancePortal, destination);
int cost = EconomyHandler.getDefaultUseCost(player, entrancePortal, destination);
if (cost > 0) {
return !EconomyHelper.payTeleportFee(entrancePortal, player, cost);
return EconomyHelper.cannotPayTeleportFee(entrancePortal, player, cost);
}
return false;
}