mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-04 06:28:49 +00:00
Add backup world resolution by environment name
This commit is contained in:
1 parent
db988349ca
commit
f0ffed0d3b
1 file changed
+13
-2
@@ -24,11 +24,22 @@ public final class BukkitAdapter {
|
|||||||
if (world == null) {
|
if (world == null) {
|
||||||
world = Bukkit.getWorld(location.getWorld().getUuid());
|
world = Bukkit.getWorld(location.getWorld().getUuid());
|
||||||
}
|
}
|
||||||
|
if (world == null) {
|
||||||
|
world = Bukkit.getWorlds().stream()
|
||||||
|
.filter(w -> w.getEnvironment().name().equalsIgnoreCase(location.getWorld().getEnvironment().name()))
|
||||||
|
.findFirst().orElse(null);
|
||||||
|
}
|
||||||
if (world == null) {
|
if (world == null) {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
return Optional.of(new org.bukkit.Location(world, location.getX(), location.getY(), location.getZ(),
|
return Optional.of(new org.bukkit.Location(
|
||||||
location.getYaw(), location.getPitch()));
|
world,
|
||||||
|
location.getX(),
|
||||||
|
location.getY(),
|
||||||
|
location.getZ(),
|
||||||
|
location.getYaw(),
|
||||||
|
location.getPitch()
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in new issue
Block a user