From 2b9a9ae467857acf505136fca5e10e868ff5be10 Mon Sep 17 00:00:00 2001 From: Preva1l <149850944+ProdPreva1l@users.noreply.github.com> Date: Wed, 26 Jun 2024 01:12:45 +1000 Subject: [PATCH] fix: redis disconnecting when RTP could not find the world on the target server (#648) * fix: redis disconnecting when the world is not found --- .../java/net/william278/huskhomes/network/Broker.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/net/william278/huskhomes/network/Broker.java b/common/src/main/java/net/william278/huskhomes/network/Broker.java index 18233e9a..ac3cbc7c 100644 --- a/common/src/main/java/net/william278/huskhomes/network/Broker.java +++ b/common/src/main/java/net/william278/huskhomes/network/Broker.java @@ -146,8 +146,14 @@ public abstract class Broker { Optional 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) -> {