Saves NPCs immediately after they are changed
Additionally: Updates Citizens dependency to the newest version Removes some redundancy in NPC settings' path
This commit is contained in:
@@ -39,7 +39,7 @@ public class BlackSmithEditCommand implements CommandExecutor {
|
||||
return false;
|
||||
}
|
||||
|
||||
BlacksmithTrait blacksmithTrait = npc.getTrait(BlacksmithTrait.class);
|
||||
BlacksmithTrait blacksmithTrait = npc.getTraitNullable(BlacksmithTrait.class);
|
||||
|
||||
for (NPCSetting npcSetting : NPCSetting.values()) {
|
||||
String commandName = npcSetting.getCommandName();
|
||||
@@ -87,6 +87,8 @@ public class BlackSmithEditCommand implements CommandExecutor {
|
||||
ChatColor.translateAlternateColorCodes('&', newValue);
|
||||
blacksmithTrait.getSettings().changeSetting(npcSetting, nullCheckedValue);
|
||||
displaySuccessMessage(sender, TranslatableMessage.getValueChangedMessage(npcSetting.getNodeName(), newValue));
|
||||
//Save the changes immediately to prevent data loss on server crash
|
||||
CitizensAPI.getNPCRegistry().saveToStore();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user