diff options
author | evonuts <git@clevo.net.nz> | 2012-11-10 13:40:48 +1300 |
---|---|---|
committer | evonuts <git@clevo.net.nz> | 2012-11-10 13:40:48 +1300 |
commit | 6a8a2dd28be2b7ece61dbffe8ca729166b06ef40 (patch) | |
tree | 0162810964894e22d24108808872fcb92b4df5a0 | |
parent | 83120f707f207dc1402f9eab7942920e97c5c5b7 (diff) | |
download | Essentials-6a8a2dd28be2b7ece61dbffe8ca729166b06ef40.tar Essentials-6a8a2dd28be2b7ece61dbffe8ca729166b06ef40.tar.gz Essentials-6a8a2dd28be2b7ece61dbffe8ca729166b06ef40.tar.lz Essentials-6a8a2dd28be2b7ece61dbffe8ca729166b06ef40.tar.xz Essentials-6a8a2dd28be2b7ece61dbffe8ca729166b06ef40.zip |
Update fly command to allow for /fly on|*ena*|1 and inversely, /fly off|*dis*|0.
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandfly.java | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandfly.java b/Essentials/src/com/earth2me/essentials/commands/Commandfly.java index 86347d3e9..b0bd91ee5 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandfly.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandfly.java @@ -28,15 +28,29 @@ public class Commandfly extends EssentialsCommand @Override protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { - if (args.length > 0 && args[0].trim().length() > 2 && user.isAuthorized("essentials.fly.others")) + if (args.length == 1) + { + if (args[0].contains("on") || args[0].contains("ena") || args[0].equalsIgnoreCase("1")) + { + user.setAllowFlight(true); + } + else if (args[0].contains("off") || args[0].contains("dis") || args[0].equalsIgnoreCase("0")) + { + user.setAllowFlight(false); + } + } + else if (args.length > 0 && args[0].trim().length() > 2 && user.isAuthorized("essentials.fly.others")) { flyOtherPlayers(server, user, args); return; } - user.setAllowFlight(!user.getAllowFlight()); - if (!user.getAllowFlight()) + else { - user.setFlying(false); + user.setAllowFlight(!user.getAllowFlight()); + if (!user.getAllowFlight()) + { + user.setFlying(false); + } } user.sendMessage(_("flyMode", _(user.getAllowFlight() ? "enabled" : "disabled"), user.getDisplayName())); } |