From ecf5f145c69af2e8460c1165865d53af2e5d588b Mon Sep 17 00:00:00 2001 From: fullwall Date: Sat, 11 Jan 2014 23:19:23 +0800 Subject: [PATCH] Use Persistable in WaypointProvider --- .../trait/waypoint/WaypointProvider.java | 29 ++++--------------- .../trait/waypoint/Waypoints.java | 2 -- 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/src/main/java/net/citizensnpcs/trait/waypoint/WaypointProvider.java b/src/main/java/net/citizensnpcs/trait/waypoint/WaypointProvider.java index ce3f5d107..ca754eae5 100644 --- a/src/main/java/net/citizensnpcs/trait/waypoint/WaypointProvider.java +++ b/src/main/java/net/citizensnpcs/trait/waypoint/WaypointProvider.java @@ -2,15 +2,14 @@ package net.citizensnpcs.trait.waypoint; import net.citizensnpcs.api.command.CommandContext; import net.citizensnpcs.api.npc.NPC; -import net.citizensnpcs.api.util.DataKey; +import net.citizensnpcs.api.persistence.Persistable; import org.bukkit.entity.Player; -public interface WaypointProvider { - +public interface WaypointProvider extends Persistable { /** * Creates an {@link WaypointEditor} with the given {@link Player}. - * + * * @param player * The player to link the editor with * @param args @@ -20,19 +19,11 @@ public interface WaypointProvider { /** * Returns whether this provider has paused execution of waypoints. - * + * * @return Whether the provider is paused. */ public boolean isPaused(); - /** - * Loads from the specified {@link DataKey}. - * - * @param key - * The key to load from - */ - public void load(DataKey key); - /** * Called when the provider is removed from the NPC. */ @@ -40,23 +31,15 @@ public interface WaypointProvider { /** * Called when the {@link NPC} attached to this provider is spawned. - * + * * @param npc * The attached NPC */ public void onSpawn(NPC npc); - /** - * Saves to the specified {@link DataKey}. - * - * @param key - * The key to save to - */ - public void save(DataKey key); - /** * Pauses waypoint execution. - * + * * @param paused * Whether to pause waypoint execution. */ diff --git a/src/main/java/net/citizensnpcs/trait/waypoint/Waypoints.java b/src/main/java/net/citizensnpcs/trait/waypoint/Waypoints.java index 2af3a848f..bbccb4e58 100644 --- a/src/main/java/net/citizensnpcs/trait/waypoint/Waypoints.java +++ b/src/main/java/net/citizensnpcs/trait/waypoint/Waypoints.java @@ -76,7 +76,6 @@ public class Waypoints extends Trait { if (provider == null) return; PersistenceLoader.load(provider, key.getRelative(providerName)); - provider.load(key.getRelative(providerName)); } @Override @@ -91,7 +90,6 @@ public class Waypoints extends Trait { if (provider == null) return; PersistenceLoader.save(provider, key.getRelative(providerName)); - provider.save(key.getRelative(providerName)); key.setString("provider", providerName); }