Skip to content

Commit

Permalink
fix: redis disconnecting when RTP could not find the world on the tar…
Browse files Browse the repository at this point in the history
…get server (#648)

* fix: redis disconnecting when the world is not found
  • Loading branch information
ProdPreva1l authored Jun 25, 2024
1 parent 6e0e51f commit 2b9a9ae
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,14 @@ protected void handleRTPRequest(@NotNull Message message) {
Optional<World> world = plugin.getWorlds().stream()
.filter(w -> w.getName().equals(request.getWorldName())).findFirst();
if (world.isEmpty()) {
throw new RuntimeException("%s requested a position in a world we don't have! World: %s"
plugin.log(Level.SEVERE, "%s requested a position in a world we don't have! World: %s"
.formatted(message.getSourceServer(), request.getWorldName()));
Message.builder()
.type(Message.Type.RTP_LOCATION)
.target(request.getUsername())
.payload(Payload.empty())
.build().send(plugin.getMessenger(), request.getUsername());
return;
}
plugin.getRandomTeleportEngine().getRandomPosition(world.get(), null)
.thenAccept((position) -> {
Expand Down

0 comments on commit 2b9a9ae

Please sign in to comment.