Teleport check cleanup

This commit is contained in:
KHobbits 2012-03-20 13:26:49 +00:00
parent e752538568
commit 518b013a63
8 changed files with 18 additions and 20 deletions

View File

@ -154,7 +154,7 @@ public interface ISettings extends IConf
boolean getRepairEnchanted();
boolean getIsWorldTeleportPermissions();
boolean isWorldTeleportPermissions();
boolean registerBackInListener();

View File

@ -678,7 +678,7 @@ public class Settings implements ISettings
}
@Override
public boolean getIsWorldTeleportPermissions()
public boolean isWorldTeleportPermissions()
{
return config.getBoolean("world-teleport-permissions", false);
}

View File

@ -250,7 +250,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
return teleportRequester;
}
public boolean isTeleportRequestHere()
public boolean isTpRequestHere()
{
return teleportRequestHere;
}

View File

@ -30,7 +30,7 @@ public class Commandtp extends EssentialsCommand
{
throw new Exception(_("teleportDisabled", player.getDisplayName()));
}
if (user.getWorld() != player.getWorld() && ess.getSettings().getIsWorldTeleportPermissions()
if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions()
&& !user.isAuthorized("essentials.world." + player.getWorld().getName()))
{
throw new Exception(_("noPerm", "essentials.world." + player.getWorld().getName()));
@ -49,7 +49,7 @@ public class Commandtp extends EssentialsCommand
user.sendMessage(_("teleporting"));
final User target = getPlayer(server, args, 0);
final User toPlayer = getPlayer(server, args, 1);
if (target.getWorld() != toPlayer.getWorld() && ess.getSettings().getIsWorldTeleportPermissions()
if (target.getWorld() != toPlayer.getWorld() && ess.getSettings().isWorldTeleportPermissions()
&& !user.isAuthorized("essentials.world." + toPlayer.getWorld().getName()))
{
throw new Exception(_("noPerm", "essentials.world." + toPlayer.getWorld().getName()));

View File

@ -25,7 +25,7 @@ public class Commandtpa extends EssentialsCommand
{
throw new Exception(_("teleportDisabled", player.getDisplayName()));
}
if (user.getWorld() != player.getWorld() && ess.getSettings().getIsWorldTeleportPermissions()
if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions()
&& !user.isAuthorized("essentials.world." + player.getWorld().getName()))
{
throw new Exception(_("noPerm", "essentials.world." + player.getWorld().getName()));

View File

@ -19,16 +19,14 @@ public class Commandtpaccept extends EssentialsCommand
{
final User target = user.getTeleportRequest();
if (target == null
|| !target.isOnline()
|| (user.isTeleportRequestHere() && !target.isAuthorized("essentials.tpahere"))
|| (!user.isTeleportRequestHere() && !target.isAuthorized("essentials.tpa") && !target.isAuthorized("essentials.tpaall"))
)
{
throw new Exception(_("noPendingRequest"));
}
if (args.length > 0 && !target.getName().contains(args[0]))
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())))))
{
throw new Exception(_("noPendingRequest"));
}
@ -41,7 +39,7 @@ public class Commandtpaccept extends EssentialsCommand
}
final Trade charge = new Trade(this.getName(), ess);
if (user.isTeleportRequestHere())
if (user.isTpRequestHere())
{
charge.isAffordableFor(user);
}
@ -52,7 +50,7 @@ public class Commandtpaccept extends EssentialsCommand
user.sendMessage(_("requestAccepted"));
target.sendMessage(_("requestAcceptedFrom", user.getDisplayName()));
if (user.isTeleportRequestHere())
if (user.isTpRequestHere())
{
user.getTeleport().teleport(target, charge, TeleportCause.COMMAND);
}

View File

@ -32,7 +32,7 @@ public class Commandtpo extends EssentialsCommand
// Verify permission
if (!player.isHidden() || user.isAuthorized("essentials.teleport.hidden"))
{
if (user.getWorld() != player.getWorld() && ess.getSettings().getIsWorldTeleportPermissions()
if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions()
&& !user.isAuthorized("essentials.world." + player.getWorld().getName()))
{
throw new Exception(_("noPerm", "essentials.world." + player.getWorld().getName()));

View File

@ -54,7 +54,7 @@ public class Commandworld extends EssentialsCommand
}
}
if (ess.getSettings().getIsWorldTeleportPermissions() && !user.isAuthorized("essentials.world." + world.getName()))
if (ess.getSettings().isWorldTeleportPermissions() && !user.isAuthorized("essentials.world." + world.getName()))
{
throw new Exception(_("noPerm", "essentials.world." + world.getName()));
}