summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2012-09-29 23:48:59 +0100
committerKHobbits <rob@khobbits.co.uk>2012-09-29 23:48:59 +0100
commit872bc4df4cea886c0641c8fc7e479ea6f9205826 (patch)
tree7333949d52a6c80e57a62a04f4a7786839f4f01e
parent3083ba26279bc1e4002b1db3c8ac7763cfa5b2f4 (diff)
downloadEssentials-872bc4df4cea886c0641c8fc7e479ea6f9205826.tar
Essentials-872bc4df4cea886c0641c8fc7e479ea6f9205826.tar.gz
Essentials-872bc4df4cea886c0641c8fc7e479ea6f9205826.tar.lz
Essentials-872bc4df4cea886c0641c8fc7e479ea6f9205826.tar.xz
Essentials-872bc4df4cea886c0641c8fc7e479ea6f9205826.zip
New permission: essentials.teleport.timer.move - allow players to move during tp delay
-rw-r--r--Essentials/src/com/earth2me/essentials/Teleport.java21
1 files changed, 11 insertions, 10 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Teleport.java b/Essentials/src/com/earth2me/essentials/Teleport.java
index 17dbca0f2..a03a4b74b 100644
--- a/Essentials/src/com/earth2me/essentials/Teleport.java
+++ b/Essentials/src/com/earth2me/essentials/Teleport.java
@@ -95,17 +95,17 @@ public class Teleport implements Runnable, ITeleport
return;
}
- if (Math.round(teleportUser.getLocation().getX() * MOVE_CONSTANT) != initX
- || Math.round(teleportUser.getLocation().getY() * MOVE_CONSTANT) != initY
- || Math.round(teleportUser.getLocation().getZ() * MOVE_CONSTANT) != initZ
- || teleportUser.getHealth() < health)
- { // user moved, cancel teleport
+ if (!user.isAuthorized("essentials.teleport.timer.move")
+ && (Math.round(teleportUser.getLocation().getX() * MOVE_CONSTANT) != initX
+ || Math.round(teleportUser.getLocation().getY() * MOVE_CONSTANT) != initY
+ || Math.round(teleportUser.getLocation().getZ() * MOVE_CONSTANT) != initZ
+ || teleportUser.getHealth() < health))
+ {
+ // user moved, cancel teleport
cancel(true);
return;
}
-
health = teleportUser.getHealth(); // in case user healed, then later gets injured
-
long now = System.currentTimeMillis();
if (now > started + delay)
{
@@ -207,7 +207,7 @@ public class Teleport implements Runnable, ITeleport
teleTimer = -1;
}
}
-
+
//The now function is used when you want to skip tp delay when teleporting someone to a location or player.
public void now(Location loc, boolean cooldown, TeleportCause cause) throws Exception
{
@@ -301,8 +301,9 @@ public class Teleport implements Runnable, ITeleport
teleTimer = ess.scheduleSyncRepeatingTask(this, 10, 10);
}
-
- private void warnUser(final IUser user) {
+
+ private void warnUser(final IUser user)
+ {
Calendar c = new GregorianCalendar();
c.add(Calendar.SECOND, (int)delay);
c.add(Calendar.MILLISECOND, (int)((delay * 1000.0) % 1000.0));