From 6a8a2dd28be2b7ece61dbffe8ca729166b06ef40 Mon Sep 17 00:00:00 2001 From: evonuts Date: Sat, 10 Nov 2012 13:40:48 +1300 Subject: [PATCH] Update fly command to allow for /fly on|*ena*|1 and inversely, /fly off|*dis*|0. --- .../essentials/commands/Commandfly.java | 22 +++++++++++++++---- 1 file 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())); }