Skip to content

Commit

Permalink
persistence fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
aabssmc committed Jul 10, 2024
1 parent 06a0a70 commit b27e997
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/main/java/lol/aabss/skuishy/Skuishy.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,9 @@ public static NamespacedKey namespacedKeyFromObject(Object object){
String namespace = split[0];
String key = split[1];
return new NamespacedKey(split[0], split[1]);
} else {
return new NamespacedKey(Skuishy.instance, string);
}
return null;
} else if (object instanceof NamespacedKey){
return (NamespacedKey) object;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected void execute(@NotNull Event event) {
if (namespacedKey == null){
return;
}
if (classInfo == null && newValue == null){
if (classInfo == null || newValue == null){
for (PersistentDataContainer container : this.dataContainer.getArray(event)){
container.remove(namespacedKey);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"All classinfo types are supported.",
"See EffEditPersistentData"})
@Examples({
"set {_integer} to integer data key namespaced key from \"skuishy:rocks\" of player",
"set {_string} to string data key \"simple:string\" or default \"\"of player"
"set {_integer} to integer data key namespaced key from \"skuishy:rocks\" of player's data container",
"set {_string} to string data key \"simple:string\" or default \"\" of player's data container"
})
@Since("2.7")
public class ExprGetPersistentData extends PropertyExpression<PersistentDataContainer, Object> {
Expand Down Expand Up @@ -88,7 +88,9 @@ public boolean init(Expression<?> @NotNull [] expressions, int matchedPattern, @
classInfo = (Literal<ClassInfo<Object>>) expressions[0];
namespacedKey = (Expression<Object>) expressions[1];
defaultObject = (Expression<Object>) expressions[2];
setExpr((Expression<? extends PersistentDataContainer>) expressions[3]);
} else {
setExpr((Expression<? extends PersistentDataContainer>) expressions[0]);
classInfo = (Literal<ClassInfo<Object>>) expressions[1];
namespacedKey = (Expression<Object>) expressions[2];
defaultObject = (Expression<Object>) expressions[3];
Expand Down

0 comments on commit b27e997

Please sign in to comment.