mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-04 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()
|
plugin.getDatabase()
|
||||||
.getRespawnPosition(onlineUser)
|
.getRespawnPosition(onlineUser)
|
||||||
|
.flatMap(pos -> {
|
||||||
|
if (pos.getServer().equals(plugin.getServerName()) && onlineUser.getBedSpawnPosition().isEmpty()) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
return Optional.of(pos);
|
||||||
|
})
|
||||||
.or(() -> {
|
.or(() -> {
|
||||||
builder.type(Teleport.Type.TELEPORT);
|
builder.type(Teleport.Type.TELEPORT);
|
||||||
return plugin.getSpawn();
|
return plugin.getSpawn();
|
||||||
})
|
})
|
||||||
.ifPresent(position -> {
|
.ifPresent(pos -> {
|
||||||
builder.target(position);
|
builder.target(pos);
|
||||||
try {
|
try {
|
||||||
builder.toTeleport().execute();
|
builder.toTeleport().execute();
|
||||||
} catch (TeleportationException e) {
|
} catch (TeleportationException e) {
|
||||||
|
|||||||
Reference in new issue
Block a user