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
This commit is contained in:
snowleo 2011-05-22 19:41:22 +00:00
parent 1f23740832
commit aeb46128bc
2 changed files with 11 additions and 1 deletions

View File

@ -162,7 +162,7 @@ public class EssentialsPlayerListener extends PlayerListener
event.setTo(loc); event.setTo(loc);
try try
{ {
user.getTeleport().teleport(loc, new Charge("portal")); user.getTeleport().now(loc, new Charge("portal"));
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -190,6 +190,7 @@ public class Teleport implements Runnable
cooldown(true); cooldown(true);
if (delay <= 0 || user.isAuthorized("essentials.teleport.timer.bypass")) if (delay <= 0 || user.isAuthorized("essentials.teleport.timer.bypass"))
{ {
cooldown(false);
now(target); now(target);
if (chargeFor != null) if (chargeFor != null)
{ {
@ -217,11 +218,20 @@ public class Teleport implements Runnable
public void now(Location loc) throws Exception 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)); now(new Target(loc));
} }
public void now(Entity entity) throws Exception public void now(Entity entity) throws Exception
{ {
cooldown(false);
now(new Target(entity)); now(new Target(entity));
} }