diff options
author | KHobbits <rob@khobbits.co.uk> | 2012-03-20 14:32:11 +0000 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2012-03-20 15:03:53 +0000 |
commit | 3e88fb44f47f8f17a0f496164255fbbff07bafc9 (patch) | |
tree | 69e16a062cf7520d1f1ea5d8e0a508a4299d4fb4 | |
parent | 518b013a63a23f9bdb587355aa34442cf2327a25 (diff) | |
download | Essentials-3e88fb44f47f8f17a0f496164255fbbff07bafc9.tar Essentials-3e88fb44f47f8f17a0f496164255fbbff07bafc9.tar.gz Essentials-3e88fb44f47f8f17a0f496164255fbbff07bafc9.tar.lz Essentials-3e88fb44f47f8f17a0f496164255fbbff07bafc9.tar.xz Essentials-3e88fb44f47f8f17a0f496164255fbbff07bafc9.zip |
Split if tree for readability.
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java index ffc8f2fdd..7f06602ae 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java @@ -20,13 +20,24 @@ public class Commandtpaccept extends EssentialsCommand final User target = user.getTeleportRequest(); - if (target == null || !target.isOnline() - || (args.length > 0 && !target.getName().contains(args[0])) - || (user.isTpRequestHere() && !target.isAuthorized("essentials.tpahere")) - || (!user.isTpRequestHere() && ((!target.isAuthorized("essentials.tpa") && !target.isAuthorized("essentials.tpaall")) - || (user.getWorld() != target.getWorld() - && ess.getSettings().isWorldTeleportPermissions() - && !user.isAuthorized("essentials.world." + target.getWorld().getName()))))) + if (target == null || !target.isOnline()) + { + throw new Exception(_("noPendingRequest")); + } + + if (user.isTpRequestHere() && !target.isAuthorized("essentials.tpahere")) + { + throw new Exception(_("noPendingRequest")); + } + + if (!user.isTpRequestHere() && ((!target.isAuthorized("essentials.tpa") && !target.isAuthorized("essentials.tpaall")) + || (user.getWorld() != target.getWorld() && ess.getSettings().isWorldTeleportPermissions() + && !user.isAuthorized("essentials.world." + target.getWorld().getName())))) + { + throw new Exception(_("noPendingRequest")); + } + + if (args.length > 0 && !target.getName().contains(args[0])) { throw new Exception(_("noPendingRequest")); } |