fix: don't teleport users locally to beds if broken

This commit is contained in:
William committed 2023-12-26 15:34:57 +00:00
1 parent 69159d194f
commit bcac151410
1 file changed
+8 -2
@@ -256,12 +256,18 @@ public class EventListener {
plugin.getDatabase()
.getRespawnPosition(onlineUser)
.flatMap(pos -> {
if (pos.getServer().equals(plugin.getServerName()) && onlineUser.getBedSpawnPosition().isEmpty()) {
return Optional.empty();
}
return Optional.of(pos);
})
.or(() -> {
builder.type(Teleport.Type.TELEPORT);
return plugin.getSpawn();
})
.ifPresent(position -> {
builder.target(position);
.ifPresent(pos -> {
builder.target(pos);
try {
builder.toTeleport().execute();
} catch (TeleportationException e) {