From aeb46128bc75c67401c5f61a0bbadeadb6cf4a29 Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 22 May 2011 19:41:22 +0000 Subject: [PATCH] Ignore teleport delay on portals, fix cooldown not working if delay is disabled, fix cooldown for teleport.now() git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1517 e251c2fe-e539-e718-e476-b85c1f46cddb --- .../earth2me/essentials/EssentialsPlayerListener.java | 2 +- Essentials/src/com/earth2me/essentials/Teleport.java | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index f0b4941b7..464002548 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -162,7 +162,7 @@ public class EssentialsPlayerListener extends PlayerListener event.setTo(loc); try { - user.getTeleport().teleport(loc, new Charge("portal")); + user.getTeleport().now(loc, new Charge("portal")); } catch (Exception ex) { diff --git a/Essentials/src/com/earth2me/essentials/Teleport.java b/Essentials/src/com/earth2me/essentials/Teleport.java index a618e3eab..3318aa779 100644 --- a/Essentials/src/com/earth2me/essentials/Teleport.java +++ b/Essentials/src/com/earth2me/essentials/Teleport.java @@ -190,6 +190,7 @@ public class Teleport implements Runnable cooldown(true); if (delay <= 0 || user.isAuthorized("essentials.teleport.timer.bypass")) { + cooldown(false); now(target); if (chargeFor != null) { @@ -217,11 +218,20 @@ public class Teleport implements Runnable public void now(Location loc) throws Exception { + cooldown(false); + now(new Target(loc)); + } + + public void now(Location loc, Charge chargeFor) throws Exception + { + cooldown(false); + chargeFor.charge(user); now(new Target(loc)); } public void now(Entity entity) throws Exception { + cooldown(false); now(new Target(entity)); }