Skip to content

Commit

Permalink
fix: don't teleport users locally to beds if broken
Browse files Browse the repository at this point in the history
  • Loading branch information
WiIIiam278 committed Dec 26, 2023
1 parent 69159d1 commit bcac151
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,18 @@ private void respawnGlobally(@NotNull OnlineUser onlineUser) {

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) {
Expand Down

0 comments on commit bcac151

Please sign in to comment.