mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 06:28:49 +00:00
Private home list display, caching
This commit is contained in:
1 parent
83d5a921ee
commit
bafd3837dd
10 files changed
+237
-19
No files matched your search
@@ -236,10 +236,13 @@ public class HuskHomesBukkit extends JavaPlugin implements HuskHomes {
|
||||
return getServer().getName();
|
||||
}
|
||||
|
||||
public static class BukkitAdapter {
|
||||
public static final class BukkitAdapter {
|
||||
|
||||
public static Optional<Location> adaptLocation(net.william278.huskhomes.position.Location location) {
|
||||
final World world = Bukkit.getWorld(location.world.name);
|
||||
World world = Bukkit.getWorld(location.world.name);
|
||||
if (world == null) {
|
||||
world = Bukkit.getWorld(location.world.uuid);
|
||||
}
|
||||
if (world == null) {
|
||||
return Optional.empty();
|
||||
}
|
||||
@@ -247,5 +250,14 @@ public class HuskHomesBukkit extends JavaPlugin implements HuskHomes {
|
||||
location.yaw, location.pitch));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static net.william278.huskhomes.position.Location adaptLocation(@NotNull Location location) {
|
||||
if (location.getWorld() == null) return null;
|
||||
return new net.william278.huskhomes.position.Location(location.getX(), location.getY(), location.getZ(),
|
||||
location.getYaw(), location.getPitch(),
|
||||
new net.william278.huskhomes.position.World(location.getWorld().getName(), location.getWorld().getUID()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -72,9 +72,7 @@ public class BukkitPlayer implements Player {
|
||||
|
||||
@Override
|
||||
public Location getLocation() {
|
||||
final org.bukkit.Location location = bukkitPlayer.getLocation();
|
||||
return new Location(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch(),
|
||||
new World(bukkitPlayer.getWorld().getName(), bukkitPlayer.getWorld().getUID()));
|
||||
return HuskHomesBukkit.BukkitAdapter.adaptLocation(bukkitPlayer.getLocation());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user