Minor tweaks to new economy system.

This commit is contained in:
Jeremy Wood 2015-07-14 15:47:20 -04:00
parent 4824d53fab
commit 61710369f4
2 changed files with 19 additions and 3 deletions

View File

@ -123,7 +123,13 @@ public class MVEconomist {
return vaultHandler;
}
private static boolean isItemCurrency(int currency) {
/**
* Determines if the currency type given represents an item currency.
*
* @param currency the type of currency. A value greater than -1 indicates the material type used for currency.
* @return true if currency is greater than -1.
*/
public static boolean isItemCurrency(int currency) {
return currency >= 0;
}
@ -197,7 +203,7 @@ public class MVEconomist {
} else if (price < 0D) {
player.sendMessage(String.format("%s%s%s %s",
ChatColor.DARK_GREEN, getFormattedPrice((price * -1), item),
ChatColor.WHITE, "has been added to your account."));
ChatColor.WHITE, "has been added to your inventory."));
}
}
}

View File

@ -155,6 +155,7 @@ public class PermissionTools {
} else {
economist.withdraw(teleporterPlayer, price, currency);
}
sendTeleportPaymentMessage(economist, teleporterPlayer, teleportee, toWorld.getColoredWorldString(), price, currency);
}
} else {
if (teleportee.equals(teleporter)) {
@ -162,7 +163,7 @@ public class PermissionTools {
"You need " + formattedAmount + " to enter " + toWorld.getColoredWorldString()));
} else {
teleporterPlayer.sendMessage(economist.getNSFMessage(currency,
"You need " + formattedAmount + " to send " + teleportee + " to " + toWorld.getColoredWorldString()));
"You need " + formattedAmount + " to send " + teleportee.getName() + " to " + toWorld.getColoredWorldString()));
}
return false;
}
@ -170,6 +171,15 @@ public class PermissionTools {
return true;
}
private void sendTeleportPaymentMessage (MVEconomist economist, Player teleporterPlayer, Player teleportee, String toWorld, double price, int currency) {
price = Math.abs(price);
if (teleporterPlayer.equals(teleportee)) {
teleporterPlayer.sendMessage("You were " + (price > 0D ? "charged " : "given ") + economist.formatPrice(price, currency) + " for teleporting to " + toWorld);
} else {
teleporterPlayer.sendMessage("You were " + (price > 0D ? "charged " : "given ") + economist.formatPrice(price, currency) + " for teleporting " + teleportee.getName() + " to " + toWorld);
}
}
/**
* Checks to see if player can go to a world given their current status.