Refactor #getServer() to be pre-cached from a CachedServer yaml file, no longer require fetcher, add #fetchServer(requester)

This commit is contained in:
William committed 2022-08-31 11:55:47 +01:00
1 parent 800bffbbf2
commit 74cb268426
11 files changed
+105 -45

No files matched your search

@@ -65,14 +65,14 @@ public class BukkitPlayer extends OnlineUser {
public Position getPosition() {
return new Position(BukkitAdapter.adaptLocation(player.getLocation())
.orElseThrow(() -> new HuskHomesException("Failed to get the position of a BukkitPlayer (null)")),
BukkitHuskHomes.getInstance().getServer(this));
BukkitHuskHomes.getInstance().getPluginServer());
}
@Override
public Optional<Position> getBedSpawnPosition() {
return Optional.ofNullable(player.getBedSpawnLocation()).flatMap(BukkitAdapter::adaptLocation)
.map(location -> new Position(location, BukkitHuskHomes.getInstance().getServer(this)));
.map(location -> new Position(location, BukkitHuskHomes.getInstance().getPluginServer()));
}
@Override