summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2012-03-20 13:26:49 +0000
committerKHobbits <rob@khobbits.co.uk>2012-03-20 13:26:49 +0000
commit7f521ca4a299f09c43ca2b152cf8442952b43891 (patch)
treefb649fcb4632b3833e384321e65e2ce0bb6101ea
parent1d9218e3d91778066dbf5fc39174d15f4e50c18a (diff)
downloadEssentials-7f521ca4a299f09c43ca2b152cf8442952b43891.tar
Essentials-7f521ca4a299f09c43ca2b152cf8442952b43891.tar.gz
Essentials-7f521ca4a299f09c43ca2b152cf8442952b43891.tar.lz
Essentials-7f521ca4a299f09c43ca2b152cf8442952b43891.tar.xz
Essentials-7f521ca4a299f09c43ca2b152cf8442952b43891.zip
Teleport check cleanup
-rw-r--r--Essentials/src/com/earth2me/essentials/ISettings.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/Settings.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/User.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtp.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpa.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java22
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpo.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandworld.java2
8 files changed, 18 insertions, 20 deletions
diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java
index c5773404e..fe12720ea 100644
--- a/Essentials/src/com/earth2me/essentials/ISettings.java
+++ b/Essentials/src/com/earth2me/essentials/ISettings.java
@@ -154,7 +154,7 @@ public interface ISettings extends IConf
boolean getRepairEnchanted();
- boolean getIsWorldTeleportPermissions();
+ boolean isWorldTeleportPermissions();
boolean registerBackInListener();
diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java
index 6db8dcafc..f094dda6e 100644
--- a/Essentials/src/com/earth2me/essentials/Settings.java
+++ b/Essentials/src/com/earth2me/essentials/Settings.java
@@ -678,7 +678,7 @@ public class Settings implements ISettings
}
@Override
- public boolean getIsWorldTeleportPermissions()
+ public boolean isWorldTeleportPermissions()
{
return config.getBoolean("world-teleport-permissions", false);
}
diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java
index b9f5198dc..3d5cbb398 100644
--- a/Essentials/src/com/earth2me/essentials/User.java
+++ b/Essentials/src/com/earth2me/essentials/User.java
@@ -250,7 +250,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
return teleportRequester;
}
- public boolean isTeleportRequestHere()
+ public boolean isTpRequestHere()
{
return teleportRequestHere;
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtp.java b/Essentials/src/com/earth2me/essentials/commands/Commandtp.java
index 05451fdcf..22d4778d3 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtp.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtp.java
@@ -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()));
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java
index 90e8e69d9..95cbc58cd 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java
@@ -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()));
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java
index 449ae7489..ffc8f2fdd 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java
@@ -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);
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java
index 5edbe274d..e30aee127 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java
@@ -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()));
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandworld.java b/Essentials/src/com/earth2me/essentials/commands/Commandworld.java
index c160e0a7a..647115d66 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandworld.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandworld.java
@@ -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()));
}