mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 06:28:49 +00:00
fix: don't teleport users locally to beds if broken
This commit is contained in:
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) {
|
||||
|
||||
Reference in new issue
Block a user