mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-10-05 19:07:32 +02:00
Use Persistable in WaypointProvider
This commit is contained in:
parent
4271d80dda
commit
ecf5f145c6
@ -2,15 +2,14 @@ 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}.
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* The player to link the editor with
|
* The player to link the editor with
|
||||||
* @param args
|
* @param args
|
||||||
@ -20,19 +19,11 @@ public interface WaypointProvider {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether this provider has paused execution of waypoints.
|
* Returns whether this provider has paused execution of waypoints.
|
||||||
*
|
*
|
||||||
* @return Whether the provider is paused.
|
* @return Whether the provider is paused.
|
||||||
*/
|
*/
|
||||||
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.
|
||||||
*/
|
*/
|
||||||
@ -40,23 +31,15 @@ public interface WaypointProvider {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the {@link NPC} attached to this provider is spawned.
|
* Called when the {@link NPC} attached to this provider is spawned.
|
||||||
*
|
*
|
||||||
* @param npc
|
* @param npc
|
||||||
* The attached NPC
|
* The attached NPC
|
||||||
*/
|
*/
|
||||||
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.
|
||||||
*
|
*
|
||||||
* @param paused
|
* @param paused
|
||||||
* Whether to pause waypoint execution.
|
* Whether to pause waypoint execution.
|
||||||
*/
|
*/
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user