From acf4d0bcf509ce89b907567b2ce102cc353c8abf Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sat, 8 Sep 2012 14:30:11 +0100 Subject: Potential fix for teleporting issue. --- Essentials/src/com/earth2me/essentials/Teleport.java | 20 ++++++++++---------- Essentials/src/config.yml | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/Teleport.java b/Essentials/src/com/earth2me/essentials/Teleport.java index 63ff59644..c437bdec5 100644 --- a/Essentials/src/com/earth2me/essentials/Teleport.java +++ b/Essentials/src/com/earth2me/essentials/Teleport.java @@ -6,7 +6,6 @@ import java.util.Calendar; import java.util.GregorianCalendar; import java.util.logging.Logger; import org.bukkit.Location; -import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; @@ -17,28 +16,29 @@ public class Teleport implements Runnable, ITeleport private static final double MOVE_CONSTANT = 0.3; - private static class Target + private class Target { private final Location location; - private final Entity entity; + private final String name; public Target(Location location) { this.location = location; - this.entity = null; + this.name = null; } - public Target(Entity entity) + public Target(Player entity) { - this.entity = entity; + this.name = entity.getName(); this.location = null; } public Location getLocation() { - if (this.entity != null) + if (this.name != null) { - return this.entity.getLocation(); + + return ess.getServer().getPlayerExact(name).getLocation(); } return location; } @@ -216,7 +216,7 @@ public class Teleport implements Runnable, ITeleport teleport(new Target(loc), chargeFor, cause); } - public void teleport(Entity entity, Trade chargeFor, TeleportCause cause) throws Exception + public void teleport(Player entity, Trade chargeFor, TeleportCause cause) throws Exception { teleport(new Target(entity), chargeFor, cause); } @@ -274,7 +274,7 @@ public class Teleport implements Runnable, ITeleport now(new Target(loc), cause); } - public void now(Entity entity, boolean cooldown, TeleportCause cause) throws Exception + public void now(Player entity, boolean cooldown, TeleportCause cause) throws Exception { if (cooldown) { diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index a7297866d..438f3102d 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -52,7 +52,7 @@ teleport-delay: 0 # The delay, in seconds, a player can't be attacked by other players after they have been teleported by a command # This will also prevent the player attacking other players -teleport-invulnerability: 2 +teleport-invulnerability: 4 # The delay, in seconds, required between /heal attempts heal-cooldown: 60 -- cgit v1.2.3