From 266c979319d3b04604863f9936f815c183f769c0 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Sat, 2 Jan 2016 06:16:35 +0700 Subject: [PATCH] Use Bukkit API to extract "email.html" from plugin file. --- .../fr/xephi/authme/settings/Settings.java | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java index e28ddc3f8..ac5207638 100644 --- a/src/main/java/fr/xephi/authme/settings/Settings.java +++ b/src/main/java/fr/xephi/authme/settings/Settings.java @@ -310,8 +310,9 @@ public final class Settings { } private static String loadEmailText() { - if (!EMAIL_FILE.exists()) - saveDefaultEmailText(); + if (!EMAIL_FILE.exists()) { + plugin.saveResource("email.html", false); + } StringBuilder str = new StringBuilder(); try { BufferedReader in = new BufferedReader(new FileReader(EMAIL_FILE)); @@ -324,21 +325,6 @@ public final class Settings { return str.toString(); } - private static void saveDefaultEmailText() { - InputStream file = plugin.getResource("email.html"); - StringBuilder str = new StringBuilder(); - try { - BufferedReader in = new BufferedReader(new InputStreamReader(file, Charset.forName("utf-8"))); - String s; - while ((s = in.readLine()) != null) - str.append(s); - in.close(); - Files.touch(EMAIL_FILE); - Files.write(str.toString(), EMAIL_FILE, Charsets.UTF_8); - } catch (Exception ignored) { - } - } - /** * * @param key the key to set