mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-19 17:15:16 +01:00
Remove User instance from Teleport class
This commit is contained in:
parent
ddb3b13931
commit
aac9e4884d
@ -42,8 +42,8 @@ public class Teleport implements Runnable, ITeleport
|
|||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private IUser user;
|
private final IUser user;
|
||||||
private IUser teleportUser;
|
private String teleportUserName;
|
||||||
private int teleTimer = -1;
|
private int teleTimer = -1;
|
||||||
private long started; // time this task was initiated
|
private long started; // time this task was initiated
|
||||||
private long tpdelay; // how long to delay the teleport
|
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.initX = Math.round(teleportUser.getLocation().getX() * MOVE_CONSTANT);
|
||||||
this.initY = Math.round(teleportUser.getLocation().getY() * MOVE_CONSTANT);
|
this.initY = Math.round(teleportUser.getLocation().getY() * MOVE_CONSTANT);
|
||||||
this.initZ = Math.round(teleportUser.getLocation().getZ() * MOVE_CONSTANT);
|
this.initZ = Math.round(teleportUser.getLocation().getZ() * MOVE_CONSTANT);
|
||||||
this.teleportUser = teleportUser;
|
this.teleportUserName = teleportUser.getName();
|
||||||
this.teleportTarget = target;
|
this.teleportTarget = target;
|
||||||
this.chargeFor = chargeFor;
|
this.chargeFor = chargeFor;
|
||||||
this.cause = cause;
|
this.cause = cause;
|
||||||
@ -82,7 +82,7 @@ public class Teleport implements Runnable, ITeleport
|
|||||||
|
|
||||||
this.canMove = user.isAuthorized("essentials.teleport.timer.move");
|
this.canMove = user.isAuthorized("essentials.teleport.timer.move");
|
||||||
|
|
||||||
teleTimer = ess.scheduleSyncRepeatingTask(this, 10, 10);
|
teleTimer = ess.scheduleSyncRepeatingTask(this, 20, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -95,6 +95,8 @@ public class Teleport implements Runnable, ITeleport
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IUser teleportUser = ess.getUser(this.teleportUserName);
|
||||||
|
|
||||||
if (teleportUser == null || !teleportUser.isOnline())
|
if (teleportUser == null || !teleportUser.isOnline())
|
||||||
{
|
{
|
||||||
cancel(false);
|
cancel(false);
|
||||||
@ -216,9 +218,9 @@ public class Teleport implements Runnable, ITeleport
|
|||||||
if (notifyUser)
|
if (notifyUser)
|
||||||
{
|
{
|
||||||
user.sendMessage(_("pendingTeleportCancelled"));
|
user.sendMessage(_("pendingTeleportCancelled"));
|
||||||
if (teleportUser != user)
|
if (teleportUserName != null && !teleportUserName.equals(user.getName()))
|
||||||
{
|
{
|
||||||
teleportUser.sendMessage(_("pendingTeleportCancelled"));
|
ess.getUser(teleportUserName).sendMessage(_("pendingTeleportCancelled"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user