summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2013-05-03 01:53:54 +0200
committersnowleo <schneeleo@gmail.com>2013-05-03 01:53:54 +0200
commitaac9e4884d1cd631d297e30900c8209faa4d45d9 (patch)
treedd144531791e2341594f5b7703a712c222873d48
parentddb3b13931976a3c63aec9859690ee3ec8cdf672 (diff)
downloadEssentials-aac9e4884d1cd631d297e30900c8209faa4d45d9.tar
Essentials-aac9e4884d1cd631d297e30900c8209faa4d45d9.tar.gz
Essentials-aac9e4884d1cd631d297e30900c8209faa4d45d9.tar.lz
Essentials-aac9e4884d1cd631d297e30900c8209faa4d45d9.tar.xz
Essentials-aac9e4884d1cd631d297e30900c8209faa4d45d9.zip
Remove User instance from Teleport class
-rw-r--r--Essentials/src/com/earth2me/essentials/Teleport.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Teleport.java b/Essentials/src/com/earth2me/essentials/Teleport.java
index fad2d52ca..e4cb25bdf 100644
--- a/Essentials/src/com/earth2me/essentials/Teleport.java
+++ b/Essentials/src/com/earth2me/essentials/Teleport.java
@@ -42,8 +42,8 @@ public class Teleport implements Runnable, ITeleport
return location;
}
}
- private IUser user;
- private IUser teleportUser;
+ private final IUser user;
+ private String teleportUserName;
private int teleTimer = -1;
private long started; // time this task was initiated
private long tpdelay; // how long to delay the teleport
@@ -74,7 +74,7 @@ public class Teleport implements Runnable, ITeleport
this.initX = Math.round(teleportUser.getLocation().getX() * MOVE_CONSTANT);
this.initY = Math.round(teleportUser.getLocation().getY() * MOVE_CONSTANT);
this.initZ = Math.round(teleportUser.getLocation().getZ() * MOVE_CONSTANT);
- this.teleportUser = teleportUser;
+ this.teleportUserName = teleportUser.getName();
this.teleportTarget = target;
this.chargeFor = chargeFor;
this.cause = cause;
@@ -82,7 +82,7 @@ public class Teleport implements Runnable, ITeleport
this.canMove = user.isAuthorized("essentials.teleport.timer.move");
- teleTimer = ess.scheduleSyncRepeatingTask(this, 10, 10);
+ teleTimer = ess.scheduleSyncRepeatingTask(this, 20, 20);
}
@Override
@@ -94,6 +94,8 @@ public class Teleport implements Runnable, ITeleport
cancel(false);
return;
}
+
+ IUser teleportUser = ess.getUser(this.teleportUserName);
if (teleportUser == null || !teleportUser.isOnline())
{
@@ -216,9 +218,9 @@ public class Teleport implements Runnable, ITeleport
if (notifyUser)
{
user.sendMessage(_("pendingTeleportCancelled"));
- if (teleportUser != user)
+ if (teleportUserName != null && !teleportUserName.equals(user.getName()))
{
- teleportUser.sendMessage(_("pendingTeleportCancelled"));
+ ess.getUser(teleportUserName).sendMessage(_("pendingTeleportCancelled"));
}
}
}