Skip to content

Commit

Permalink
fix removing flags in datapersist impl
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Dec 13, 2020
1 parent 6865285 commit 6d0db71
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Expand Up @@ -39,6 +39,10 @@ public ObjectTag fromPrimitive(String primitive, PersistentDataAdapterContext co

public static final DenizenObjectType PERSISTER_TYPE = new DenizenObjectType();

public static void removeDenizenKey(PersistentDataHolder holder, String keyName) {
holder.getPersistentDataContainer().remove(new NamespacedKey(Denizen.getInstance(), keyName));
}

public static void setDenizenKey(PersistentDataHolder holder, String keyName, ObjectTag keyValue) {
holder.getPersistentDataContainer().set(new NamespacedKey(Denizen.getInstance(), keyName), PERSISTER_TYPE, keyValue);
}
Expand Down
Expand Up @@ -31,6 +31,10 @@ public MapTag getRootMap(String key) {

@Override
public void setRootMap(String key, MapTag map) {
if (map == null) {
DataPersistenceHelper.removeDenizenKey(holder, keyPrefix + CoreUtilities.toLowerCase(key));
return;
}
DataPersistenceHelper.setDenizenKey(holder, keyPrefix + CoreUtilities.toLowerCase(key), map);
}

Expand Down

0 comments on commit 6d0db71

Please sign in to comment.