Fix various issues

This commit is contained in:
William committed 2023-03-20 23:23:06 +00:00
1 parent 503898a0ef
commit 054811676d
35 files changed
+236 -243

No files matched your search

@@ -85,6 +85,8 @@ public class Teleport {
fireEvent((event) -> {
executeEconomyActions();
teleporter.teleportLocally(localTarget.get().getPosition(), async);
plugin.getLocales().getLocale("teleporting_complete")
.ifPresent(teleporter::sendMessage);
});
return;
}
@@ -96,6 +98,8 @@ public class Teleport {
.type(Message.Type.TELEPORT_TO_NETWORKED_POSITION)
.target(username.name())
.build().send(plugin.getMessenger(), executor);
plugin.getLocales().getLocale("teleporting_complete")
.ifPresent(teleporter::sendMessage);
});
return;
}
@@ -105,10 +109,24 @@ public class Teleport {
fireEvent((event) -> {
executeEconomyActions();
teleporter.teleportLocally((Position) target, async);
final Position target = (Position) this.target;
if (plugin.getSettings().isCrossServer() && target.getServer().equals(plugin.getServerName())) {
teleporter.teleportLocally(target, async);
plugin.getLocales().getLocale("teleporting_complete")
.ifPresent(teleporter::sendMessage);
return;
}
plugin.getDatabase().setCurrentTeleport(teleporter, this);
plugin.getMessenger().changeServer(teleporter, target.getServer());
});
}
private void teleport(@NotNull OnlineUser teleporter, @NotNull Position target) {
}
@NotNull
private Optional<OnlineUser> resolveLocalTeleporter() throws TeleportationException {
if (this.teleporter instanceof Username username) {
@@ -16,6 +16,8 @@ public class TeleportationException extends IllegalArgumentException {
ALREADY_WARMING_UP,
ECONOMY_ACTION_FAILED,
WARMUP_ALREADY_MOVING,
WORLD_NOT_FOUND,
ILLEGAL_TARGET_COORDINATES,
CANNOT_TELEPORT_TO_SELF
}
@@ -33,6 +35,12 @@ public class TeleportationException extends IllegalArgumentException {
case CANNOT_TELEPORT_TO_SELF -> plugin.getLocales()
.getLocale("error_teleport_request_self")
.ifPresent(user::sendMessage);
case ILLEGAL_TARGET_COORDINATES -> plugin.getLocales()
.getLocale("error_illegal_target_coordinates")
.ifPresent(user::sendMessage);
case WORLD_NOT_FOUND -> plugin.getLocales()
.getLocale("error_invalid_world")
.ifPresent(user::sendMessage);
}
}
}