mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-09 04:02:10 +01:00
Hotfix: it was shit, sorry
This commit is contained in:
parent
a614d3e554
commit
a7a4a511e7
@ -1,9 +1,12 @@
|
||||
package fr.xephi.authme.settings;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
|
||||
public class Messages extends CustomConfiguration {
|
||||
@ -24,11 +27,13 @@ public class Messages extends CustomConfiguration {
|
||||
* @param filename
|
||||
* The filename to open
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public final void loadDefaults(File file) {
|
||||
if (!file.exists())
|
||||
InputStream stream = AuthMe.getInstance().getResource(file.getName());
|
||||
if (stream == null)
|
||||
return;
|
||||
|
||||
setDefaults(YamlConfiguration.loadConfiguration(file));
|
||||
setDefaults(YamlConfiguration.loadConfiguration(stream));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -7,6 +7,7 @@ import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@ -102,7 +103,7 @@ public final class Settings extends YamlConfiguration {
|
||||
if (exists()) {
|
||||
load();
|
||||
} else {
|
||||
loadDefaults(file);
|
||||
loadDefaults(file.getName());
|
||||
load();
|
||||
}
|
||||
configFile = (YamlConfiguration) plugin.getConfig();
|
||||
@ -685,7 +686,7 @@ public final class Settings extends YamlConfiguration {
|
||||
|
||||
public final void reload() {
|
||||
load();
|
||||
loadDefaults(file);
|
||||
loadDefaults(file.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -717,11 +718,13 @@ public final class Settings extends YamlConfiguration {
|
||||
* @param filename
|
||||
* The filename to open
|
||||
*/
|
||||
public final void loadDefaults(File file) {
|
||||
if (!file.exists())
|
||||
@SuppressWarnings("deprecation")
|
||||
public final void loadDefaults(String filename) {
|
||||
InputStream stream = plugin.getResource(filename);
|
||||
if (stream == null)
|
||||
return;
|
||||
|
||||
setDefaults(YamlConfiguration.loadConfiguration(file));
|
||||
setDefaults(YamlConfiguration.loadConfiguration(stream));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user