Refactor cached data away from cache

This commit is contained in:
William committed 2023-03-21 19:23:45 +00:00
1 parent b095c92854
commit a959aa9519
14 files changed
+166 -373

No files matched your search

@@ -7,13 +7,24 @@ import net.william278.huskhomes.position.Warp;
import net.william278.huskhomes.util.ValidationException;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import java.util.Optional;
public class WarpsManager {
private final HuskHomes plugin;
private final List<Warp> warps;
protected WarpsManager(@NotNull HuskHomes plugin) {
this.plugin = plugin;
this.warps = plugin.getDatabase().getWarps();
}
/**
* Cached warp names
*/
@NotNull
public List<String> getWarps() {
return warps.stream().map(Warp::getName).toList();
}
public void createWarp(@NotNull String name, @NotNull Position position, boolean overwrite) throws ValidationException {