diff options
author | KHobbits <rob@khobbits.co.uk> | 2014-04-15 00:06:29 +0100 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2014-04-15 00:06:29 +0100 |
commit | b18713f86d7d8604f6cda7229ad73f44e79aa093 (patch) | |
tree | 4b3e3cb9d3ef2df0c921a9ef998d91b7ad917f97 | |
parent | 3bf0279a3e4f8474c4f2642725cdd5cacff14412 (diff) | |
download | Essentials-b18713f86d7d8604f6cda7229ad73f44e79aa093.tar Essentials-b18713f86d7d8604f6cda7229ad73f44e79aa093.tar.gz Essentials-b18713f86d7d8604f6cda7229ad73f44e79aa093.tar.lz Essentials-b18713f86d7d8604f6cda7229ad73f44e79aa093.tar.xz Essentials-b18713f86d7d8604f6cda7229ad73f44e79aa093.zip |
Make eco npc methods use proper user config creation and resets.
-rw-r--r-- | Essentials/src/com/earth2me/essentials/api/Economy.java | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/Essentials/src/com/earth2me/essentials/api/Economy.java b/Essentials/src/com/earth2me/essentials/api/Economy.java index 13f8e3559..edfb78731 100644 --- a/Essentials/src/com/earth2me/essentials/api/Economy.java +++ b/Essentials/src/com/earth2me/essentials/api/Economy.java @@ -1,6 +1,7 @@ package com.earth2me.essentials.api; import com.earth2me.essentials.EssentialsConf; +import com.earth2me.essentials.EssentialsUserConf; import static com.earth2me.essentials.I18n.tl; import com.earth2me.essentials.User; import static com.earth2me.essentials.api.Economy.add; @@ -52,7 +53,7 @@ public class Economy { folder.mkdirs(); } - EssentialsConf npcConfig = new EssentialsConf(new File(folder, StringUtil.sanitizeFileName(name) + ".yml")); + EssentialsUserConf npcConfig = new EssentialsUserConf(name, null, new File(folder, name + ".yml")); npcConfig.load(); npcConfig.setProperty("npc", true); npcConfig.setProperty("money", ess.getSettings().getStartingBalance()); @@ -61,22 +62,8 @@ public class Economy private static void deleteNPC(String name) { - File folder = new File(ess.getDataFolder(), "userdata"); - if (!folder.exists()) - { - folder.mkdirs(); - } - File config = new File(folder, StringUtil.sanitizeFileName(name) + ".yml"); - EssentialsConf npcConfig = new EssentialsConf(config); - npcConfig.load(); - if (npcConfig.hasProperty("npc") && npcConfig.getBoolean("npc", false)) - { - if (!config.delete()) - { - logger.log(Level.WARNING, tl("deleteFileError", config)); - } - ess.getUserMap().removeUser(name); - } + User user = ess.getUser(name); + user.reset(); } private static User getUserByName(String name) |