From f9f5068f6d206b25f85fb9050a2dfe9b1afe6002 Mon Sep 17 00:00:00 2001 From: Eric Date: Sun, 29 May 2016 12:35:46 +0200 Subject: [PATCH] Simplified saving of item_names.txt file --- src/de/epiceric/shopchest/ShopChest.java | 30 +----------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/src/de/epiceric/shopchest/ShopChest.java b/src/de/epiceric/shopchest/ShopChest.java index 2a28049..55cfdd5 100644 --- a/src/de/epiceric/shopchest/ShopChest.java +++ b/src/de/epiceric/shopchest/ShopChest.java @@ -48,23 +48,6 @@ public class ShopChest extends JavaPlugin { return instance; } - public static void copy(InputStream in, File file) { - try { - OutputStream out = new FileOutputStream(file); - byte[] buf = new byte[1024]; - int len; - - while ((len = in.read(buf)) > 0) { - out.write(buf, 0, len); - } - - out.close(); - in.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - private boolean setupEconomy() { RegisteredServiceProvider rsp = getServer().getServicesManager().getRegistration(Economy.class); if (rsp == null) { @@ -149,6 +132,7 @@ public class ShopChest extends JavaPlugin { logger.severe("Could not submit stats."); } + saveResource("item_names.txt", true); reloadConfig(); saveDefaultConfig(); @@ -261,18 +245,6 @@ public class ShopChest extends JavaPlugin { } } - File itemNamesFile = new File(getDataFolder(), "item_names.txt"); - - if (!itemNamesFile.exists()) - try { - itemNamesFile.createNewFile(); - } catch (IOException e) { - e.printStackTrace(); - } - - copy(getResource("item_names.txt"), itemNamesFile); - - try { Commands.registerCommand(new Commands(this, Config.main_command_name(), "Manage Shops.", "", new ArrayList()), this); } catch (Exception e) {