Added a cost per use to stealth mode!

This commit is contained in:
ProSavage 2018-08-27 10:39:34 -05:00
parent 1531efc030
commit 2410fafcc4
4 changed files with 13 additions and 4 deletions

@ -29,6 +29,12 @@ public class CmdStealth extends FCommand {
if (fme.isStealthEnabled()) {
fme.setStealth(false);
} else {
/* The FPlayer#takeMoney method calls the FPlayer#hasMoney method beforehand to check if the amount
* can be withdrawn successfully.
* The FPlayer#hasMoney method already sends a deny message so there isn't a need to send another.
* Basically the takeMoney is an all in one solution for taking money :)
*/
fme.takeMoney(P.p.getConfig().getInt("stealth-cost"));
fme.setStealth(true);
Bukkit.getScheduler().scheduleSyncDelayedTask(P.p, new Runnable() {
@Override

@ -1209,7 +1209,7 @@ public abstract class MemoryFPlayer implements FPlayer {
return true;
} else {
getPlayer().closeInventory();
msg(TL.COMMAND_UPGRADES_NOTENOUGHMONEY);
msg(TL.GENERIC_NOTENOUGHMONEY);
return false;
}
}
@ -1219,7 +1219,7 @@ public abstract class MemoryFPlayer implements FPlayer {
if (hasMoney(amt)) {
Economy econ = P.p.getEcon();
econ.withdrawPlayer(getPlayer(), amt);
sendMessage(TL.COMMAND_UPGRADES_MONEYTAKE.toString().replace("{amount}", amt + ""));
sendMessage(TL.GENERIC_MONEYTAKE.toString().replace("{amount}", amt + ""));
}
}
}

@ -105,8 +105,8 @@ public enum TL {
*/
COMMAND_UPGRADES_DESCRIPTION("&cOpen the Upgrades Menu"),
COMMAND_UPGRADES_MONEYTAKE("&c{amount} has been taken from your account."),
COMMAND_UPGRADES_NOTENOUGHMONEY("&cYou dont have enough money!"),
COMMAND_ADMIN_NOTMEMBER("&c&l[!] &7%1$s &cis not a member in your faction."),
@ -824,6 +824,8 @@ public enum TL {
GENERIC_FACTIONTAG_TOOLONG("<i>The faction tag can't be longer than <h>%s<i> chars."),
GENERIC_FACTIONTAG_ALPHANUMERIC("<i>Faction tag must be alphanumeric. \"<h>%s<i>\" is not allowed."),
GENERIC_PLACEHOLDER("<This is a placeholder for a message you should not see>"),
GENERIC_NOTENOUGHMONEY("&cYou dont have enough money!"),
GENERIC_MONEYTAKE("&c{amount} has been taken from your account."),
WARBANNER_NOFACTION("&cYou need a faction to use a warbanner!"),

@ -74,6 +74,7 @@ ffly:
# This will set the timeout for the stealth in seconds.
stealth-timeout: 300
stealth-cost: 500
# If a player leaves fly (out of territory or took damage)
# how long should they not take fall damage for?