Skip to content

Commit

Permalink
Treat configurationsections as null values when loading
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Mar 23, 2024
1 parent 72ca7fe commit fbbdb84
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
7 changes: 0 additions & 7 deletions src/main/java/net/citizensnpcs/api/npc/AbstractNPC.java
Expand Up @@ -339,18 +339,11 @@ public void load(final DataKey root) {
keys.remove(locationKey);
}
for (DataKey key : keys) {
if (key.name().equals("speech"))
continue;

loadTraitFromKey(key);
}
}

private void loadTraitFromKey(DataKey traitKey) {
if (traitKey.name().equals("smoothrotationtrait")) {
traitKey.removeKey("");
return;
}
Class<? extends Trait> clazz = CitizensAPI.getTraitFactory().getTraitClass(traitKey.name());
Trait trait;
if (hasTrait(clazz)) {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/net/citizensnpcs/api/util/YamlStorage.java
Expand Up @@ -86,7 +86,8 @@ public boolean load() {
}

private boolean pathExists(String key) {
return config.get(key) != null;
Object object = config.get(key);
return object != null && !(object instanceof ConfigurationSection);
}

@Override
Expand Down

0 comments on commit fbbdb84

Please sign in to comment.