diff --git a/src/main/java/de/fanta/challenges/Challenges.java b/src/main/java/de/fanta/challenges/Challenges.java index abdff57..7c29f2f 100644 --- a/src/main/java/de/fanta/challenges/Challenges.java +++ b/src/main/java/de/fanta/challenges/Challenges.java @@ -24,6 +24,7 @@ import de.fanta.challenges.utils.Config; import de.fanta.challenges.utils.Statistics; import de.fanta.challenges.utils.VanishUtils; +import de.fanta.challenges.waypoints.WaypointManager; import de.iani.cubesidestats.api.CubesideStatisticsAPI; import de.iani.playerUUIDCache.PlayerUUIDCache; import de.speedy64.globalport.GlobalApi; @@ -113,6 +114,8 @@ private final Path challengeSavePath = new File("/home/storagebox/Challenge-saves").toPath(); private final Path adventureSavePath = new File("/home/storagebox/Adventure-saves/").toPath(); + private WaypointManager waypointMananger; + public static Challenges getPlugin() { return plugin; } @@ -196,6 +199,8 @@ timer.setTime(getConfig().getInt("timertime")); } + waypointMananger = new WaypointManager(this); + if (plugin.getServerType() == ServerType.ADVENTURE) { File texturepack = new File("world/resources.zip"); if (texturepack.exists()) { diff --git a/src/main/java/de/fanta/challenges/waypoints/Waypoint.java b/src/main/java/de/fanta/challenges/waypoints/Waypoint.java new file mode 100644 index 0000000..466c222 --- /dev/null +++ b/src/main/java/de/fanta/challenges/waypoints/Waypoint.java @@ -0,0 +1,9 @@ +package de.fanta.challenges.waypoints; + +import org.bukkit.Location; + +import javax.annotation.Nullable; +import java.util.UUID; + +public record Waypoint(String name, @Nullable UUID creator, Location location) { +} diff --git a/src/main/java/de/fanta/challenges/waypoints/WaypointManager.java b/src/main/java/de/fanta/challenges/waypoints/WaypointManager.java new file mode 100644 index 0000000..40398f1 --- /dev/null +++ b/src/main/java/de/fanta/challenges/waypoints/WaypointManager.java @@ -0,0 +1,43 @@ +package de.fanta.challenges.waypoints; + +import de.fanta.challenges.Challenges; + +import java.util.HashMap; + +public class WaypointManager { + + private final Challenges plugin; + private final HashMap waypoints; + + public WaypointManager(Challenges plugin) { + this.plugin = plugin; + this.waypoints = loadWaypoints(); + } + + private HashMap loadWaypoints() { + HashMap points = new HashMap<>(); + + + return points; + } + + public HashMap getWaypoints() { + return waypoints; + } + + public boolean addWaypoint(Waypoint waypoint) { + if (waypoints.containsKey(waypoint.name())) { + return false; + } + waypoints.put(waypoint.name(), waypoint); + return true; + } + + public boolean deleteWaypoint(Waypoint waypoint) { + if (!waypoints.containsKey(waypoint.name())) { + return false; + } + waypoints.remove(waypoint.name()); + return true; + } +}