Use Bukkit API to extract "email.html" from plugin file.

This commit is contained in:
DNx5 2016-01-02 06:16:35 +07:00
parent 071800481a
commit 266c979319

View File

@ -310,8 +310,9 @@ public final class Settings {
} }
private static String loadEmailText() { private static String loadEmailText() {
if (!EMAIL_FILE.exists()) if (!EMAIL_FILE.exists()) {
saveDefaultEmailText(); plugin.saveResource("email.html", false);
}
StringBuilder str = new StringBuilder(); StringBuilder str = new StringBuilder();
try { try {
BufferedReader in = new BufferedReader(new FileReader(EMAIL_FILE)); BufferedReader in = new BufferedReader(new FileReader(EMAIL_FILE));
@ -324,21 +325,6 @@ public final class Settings {
return str.toString(); 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 * @param key the key to set