Fix last position not being updated

This commit is contained in:
William committed 2023-03-23 02:22:13 +00:00
1 parent a36a0f4292
commit 458c2a0e4b
1 file changed
+7 -1
@@ -85,6 +85,10 @@ public class Teleport {
if (localTarget.isPresent()) { if (localTarget.isPresent()) {
fireEvent((event) -> { fireEvent((event) -> {
executeEconomyActions(); executeEconomyActions();
if (updateLastPosition) {
plugin.getDatabase().setLastPosition(teleporter, teleporter.getPosition());
}
teleporter.teleportLocally(localTarget.get().getPosition(), async); teleporter.teleportLocally(localTarget.get().getPosition(), async);
this.displayTeleportingComplete(teleporter); this.displayTeleportingComplete(teleporter);
}); });
@@ -98,7 +102,6 @@ public class Teleport {
.type(Message.Type.TELEPORT_TO_NETWORKED_POSITION) .type(Message.Type.TELEPORT_TO_NETWORKED_POSITION)
.target(username.name()) .target(username.name())
.build().send(plugin.getMessenger(), executor); .build().send(plugin.getMessenger(), executor);
this.displayTeleportingComplete(teleporter);
}); });
return; return;
} }
@@ -108,6 +111,9 @@ public class Teleport {
fireEvent((event) -> { fireEvent((event) -> {
executeEconomyActions(); executeEconomyActions();
if (updateLastPosition) {
plugin.getDatabase().setLastPosition(teleporter, teleporter.getPosition());
}
final Position target = (Position) this.target; final Position target = (Position) this.target;
if (!plugin.getSettings().isCrossServer() || target.getServer().equals(plugin.getServerName())) { if (!plugin.getSettings().isCrossServer() || target.getServer().equals(plugin.getServerName())) {