summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIaccidentally <coryhuckaby@gmail.com>2012-11-11 14:21:18 -0800
committerIaccidentally <coryhuckaby@gmail.com>2012-11-11 14:21:18 -0800
commit5728f964a55169b26b2dbcc13cf58f6595345926 (patch)
treedae517f1fe3a505f11f9bdfcff9256bcc74d16cb
parentfbb3d7344f46ae813c6e8f3ec9d36329d785af86 (diff)
parentb11a1a7cf2d08aa05111fb1c25491541c2edaef1 (diff)
downloadEssentials-5728f964a55169b26b2dbcc13cf58f6595345926.tar
Essentials-5728f964a55169b26b2dbcc13cf58f6595345926.tar.gz
Essentials-5728f964a55169b26b2dbcc13cf58f6595345926.tar.lz
Essentials-5728f964a55169b26b2dbcc13cf58f6595345926.tar.xz
Essentials-5728f964a55169b26b2dbcc13cf58f6595345926.zip
Merge pull request #195 from evonuts/2.9
Update fly command to allow for /fly on|*ena*|1 and inversely, /fly off|...
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandfly.java27
1 files changed, 23 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..a299770b1 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandfly.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandfly.java
@@ -28,15 +28,34 @@ 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].equalsIgnoreCase("on") || args[0].startsWith("ena") || args[0].equalsIgnoreCase("1"))
+ {
+ user.setAllowFlight(true);
+ }
+ else if (args[0].equalsIgnoreCase("off") || args[0].startsWith("dis") || args[0].equalsIgnoreCase("0"))
+ {
+ user.setAllowFlight(false);
+ }
+ else if (user.isAuthorized("essentials.fly.others"))
+ {
+ flyOtherPlayers(server, user, args);
+ return;
+ }
+ }
+ else if (args.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()));
}