Permalink
Browse files

Split if tree for readability.

  • Loading branch information...
1 parent 518b013 commit 3e88fb44f47f8f17a0f496164255fbbff07bafc9 @khobbits khobbits committed Mar 20, 2012
Showing with 18 additions and 7 deletions.
  1. +18 −7 Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java
@@ -20,13 +20,24 @@ public void run(final Server server, final User user, final String commandLabel,
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"));
}

0 comments on commit 3e88fb4

Please sign in to comment.