Use Persistable in WaypointProvider

This commit is contained in:
fullwall 2014-01-11 23:19:23 +08:00
parent 4271d80dda
commit ecf5f145c6
2 changed files with 6 additions and 25 deletions

View File

@ -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.
*/

View File

@ -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);
}