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,12 +2,11 @@ package net.citizensnpcs.trait.waypoint;
import net.citizensnpcs.api.command.CommandContext; import net.citizensnpcs.api.command.CommandContext;
import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.util.DataKey; import net.citizensnpcs.api.persistence.Persistable;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public interface WaypointProvider { public interface WaypointProvider extends Persistable {
/** /**
* Creates an {@link WaypointEditor} with the given {@link Player}. * Creates an {@link WaypointEditor} with the given {@link Player}.
* *
@ -25,14 +24,6 @@ public interface WaypointProvider {
*/ */
public boolean isPaused(); 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. * Called when the provider is removed from the NPC.
*/ */
@ -46,14 +37,6 @@ public interface WaypointProvider {
*/ */
public void onSpawn(NPC 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. * Pauses waypoint execution.
* *

View File

@ -76,7 +76,6 @@ public class Waypoints extends Trait {
if (provider == null) if (provider == null)
return; return;
PersistenceLoader.load(provider, key.getRelative(providerName)); PersistenceLoader.load(provider, key.getRelative(providerName));
provider.load(key.getRelative(providerName));
} }
@Override @Override
@ -91,7 +90,6 @@ public class Waypoints extends Trait {
if (provider == null) if (provider == null)
return; return;
PersistenceLoader.save(provider, key.getRelative(providerName)); PersistenceLoader.save(provider, key.getRelative(providerName));
provider.save(key.getRelative(providerName));
key.setString("provider", providerName); key.setString("provider", providerName);
} }