make it so the npc gets at least partially saved when a property fails to serialize
This commit is contained in:
parent
98b1d45966
commit
5f15ba9128
1 changed files with 6 additions and 3 deletions
|
@ -101,8 +101,11 @@ public class YamlStorage implements NpcStorage {
|
|||
config.set("location", serializeLocation(npc.getLocation()));
|
||||
config.set("type", npc.getType().getName());
|
||||
|
||||
for (EntityPropertyImpl<?> property : npc.getAppliedProperties()) {
|
||||
for (EntityPropertyImpl<?> property : npc.getAppliedProperties()) try {
|
||||
config.set("properties." + property.getName(), property.serialize(npc));
|
||||
} catch (Exception exception) {
|
||||
logger.severe("Failed to serialize property " + property.getName() + " for npc with id " + entry.getId());
|
||||
exception.printStackTrace();
|
||||
}
|
||||
|
||||
HologramImpl hologram = npc.getHologram();
|
||||
|
@ -119,9 +122,9 @@ public class YamlStorage implements NpcStorage {
|
|||
.collect(Collectors.toList()));
|
||||
|
||||
config.save(fileFor(entry));
|
||||
} catch (Exception e) {
|
||||
} catch (Exception exception) {
|
||||
logger.severe("Failed to save npc with id " + entry.getId());
|
||||
e.printStackTrace();
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue