diff options
author | Iaccidentally <coryhuckaby@gmail.com> | 2012-08-06 07:50:40 -0400 |
---|---|---|
committer | Iaccidentally <coryhuckaby@gmail.com> | 2012-08-06 07:50:40 -0400 |
commit | 9cee4f9826fddae13be15e63a5a809ca88530156 (patch) | |
tree | 83199f9c434a0efb759bf86a5b578459deb13ede /EssentialsSigns/src/net/ess3/signs/SignGameMode.java | |
parent | 412d979c75f9986711a298254a76e455e03bd931 (diff) | |
download | Essentials-9cee4f9826fddae13be15e63a5a809ca88530156.tar Essentials-9cee4f9826fddae13be15e63a5a809ca88530156.tar.gz Essentials-9cee4f9826fddae13be15e63a5a809ca88530156.tar.lz Essentials-9cee4f9826fddae13be15e63a5a809ca88530156.tar.xz Essentials-9cee4f9826fddae13be15e63a5a809ca88530156.zip |
2.9 -> 3.0 (new commands and signs)
Diffstat (limited to 'EssentialsSigns/src/net/ess3/signs/SignGameMode.java')
-rw-r--r-- | EssentialsSigns/src/net/ess3/signs/SignGameMode.java | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/EssentialsSigns/src/net/ess3/signs/SignGameMode.java b/EssentialsSigns/src/net/ess3/signs/SignGameMode.java index a8ef5a881..b2e1b2db2 100644 --- a/EssentialsSigns/src/net/ess3/signs/SignGameMode.java +++ b/EssentialsSigns/src/net/ess3/signs/SignGameMode.java @@ -19,16 +19,30 @@ public class SignGameMode extends EssentialsSign @Override protected boolean onSignCreate(final ISign sign, final IUser player, final String username, final IEssentials ess) throws SignException { - validateTrade(sign, 1, ess); + final String gamemode = sign.getLine(1); + if (gamemode.isEmpty()) + { + sign.setLine(1, "Survival"); + } + + validateTrade(sign, 2, ess); + return true; } @Override protected boolean onSignInteract(final ISign sign, final IUser player, final String username, final IEssentials ess) throws SignException, ChargeException { - final Trade charge = getTrade(sign, 1, ess); + final Trade charge = getTrade(sign, 2, ess); + final String mode = sign.getLine(1).trim(); + + if (mode.isEmpty()) + { + throw new SignException(_("invalidSignLine", 2)); + } charge.isAffordableFor(player); - + + //this needs to be fixed player.setGameMode(player.getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : GameMode.SURVIVAL); player.sendMessage(_("gameMode", _(player.getGameMode().toString().toLowerCase(Locale.ENGLISH)), player.getDisplayName())); charge.charge(player); |