Search in sources :

Example 16 with DataKey

use of net.citizensnpcs.api.util.DataKey in project Citizens2 by CitizensDev.

the class GuidedWaypointProvider method save.

@Override
public void save(DataKey key) {
    key.removeKey("availablewaypoints");
    DataKey root = key.getRelative("availablewaypoints");
    for (int i = 0; i < available.size(); ++i) {
        PersistenceLoader.save(available.get(i), root.getRelative(i));
    }
    key.removeKey("helperwaypoints");
    root = key.getRelative("helperwaypoints");
    for (int i = 0; i < helpers.size(); ++i) {
        PersistenceLoader.save(helpers.get(i), root.getRelative(i));
    }
}
Also used : DataKey(net.citizensnpcs.api.util.DataKey)

Example 17 with DataKey

use of net.citizensnpcs.api.util.DataKey in project Citizens2 by CitizensDev.

the class LinearWaypointProvider method load.

@Override
public void load(DataKey key) {
    for (DataKey root : key.getRelative("points").getIntegerSubKeys()) {
        Waypoint waypoint = PersistenceLoader.load(Waypoint.class, root);
        if (waypoint == null)
            continue;
        waypoints.add(waypoint);
    }
}
Also used : DataKey(net.citizensnpcs.api.util.DataKey)

Aggregations

DataKey (net.citizensnpcs.api.util.DataKey)17 MemoryDataKey (net.citizensnpcs.api.util.MemoryDataKey)5 Trait (net.citizensnpcs.api.trait.Trait)4 GameProfile (com.mojang.authlib.GameProfile)2 Property (com.mojang.authlib.properties.Property)2 Anchor (net.citizensnpcs.util.Anchor)2 EventHandler (org.bukkit.event.EventHandler)2 SkullMeta (org.bukkit.inventory.meta.SkullMeta)2 AssignmentScriptContainer (com.denizenscript.denizen.scripts.containers.core.AssignmentScriptContainer)1 FlaggableObject (com.denizenscript.denizencore.flags.FlaggableObject)1 ElementTag (com.denizenscript.denizencore.objects.core.ElementTag)1 ListTag (com.denizenscript.denizencore.objects.core.ListTag)1 ScriptTag (com.denizenscript.denizencore.objects.core.ScriptTag)1 Function (com.google.common.base.Function)1 Collection (java.util.Collection)1 EnumSet (java.util.EnumSet)1 List (java.util.List)1 Set (java.util.Set)1 UUID (java.util.UUID)1 NPCCloneEvent (net.citizensnpcs.api.event.NPCCloneEvent)1