forked from LogBlock/LogBlock
Reverted getConfig() bug workaround due to Bukkit fix
This commit is contained in:
@@ -50,10 +50,7 @@ public class Config extends LoggingEnabledMapping
|
||||
}
|
||||
|
||||
Config(LogBlock logblock) throws DataFormatException, IOException {
|
||||
// TODO Reimplement when Bukkit fixed getConfig()
|
||||
// final ConfigurationSection config = logblock.getConfig();
|
||||
final File cfgFile = new File(logblock.getDataFolder(), "config.yml");
|
||||
final YamlConfiguration config = YamlConfiguration.loadConfiguration(cfgFile);
|
||||
final ConfigurationSection config = logblock.getConfig();
|
||||
final Map<String, Object> def = new HashMap<String, Object>();
|
||||
def.put("version", logblock.getDescription().getVersion());
|
||||
def.put("loggedWorlds", Arrays.asList("world", "world_nether"));
|
||||
@@ -108,9 +105,7 @@ public class Config extends LoggingEnabledMapping
|
||||
for (final Entry<String, Object> e : def.entrySet())
|
||||
if (!config.contains(e.getKey()))
|
||||
config.set(e.getKey(), e.getValue());
|
||||
// TODO Reimplement when Bukkit fixed getConfig()
|
||||
// logblock.saveConfig();
|
||||
config.save(cfgFile);
|
||||
logblock.saveConfig();
|
||||
url = "jdbc:mysql://" + config.getString("mysql.host") + ":" + config.getInt("mysql.port") + "/" + config.getString("mysql.database");
|
||||
user = config.getString("mysql.user");
|
||||
password = config.getString("mysql.password");
|
||||
|
@@ -13,6 +13,7 @@ import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.logging.Level;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
class Updater
|
||||
@@ -24,10 +25,7 @@ class Updater
|
||||
}
|
||||
|
||||
boolean update() {
|
||||
// TODO Reimplement when Bukkit fixed getConfig()
|
||||
// final ConfigurationSection config = logblock.getConfig();
|
||||
final File cfgFile = new File(logblock.getDataFolder(), "config.yml");
|
||||
final YamlConfiguration config = YamlConfiguration.loadConfiguration(cfgFile);
|
||||
final ConfigurationSection config = logblock.getConfig();
|
||||
if (config.getString("version").compareTo(logblock.getDescription().getVersion()) >= 0)
|
||||
return false;
|
||||
if (config.getString("version").compareTo("1.27") < 0) {
|
||||
@@ -140,13 +138,7 @@ class Updater
|
||||
config.set("clearlog.keepLogDays", null);
|
||||
config.set("version", "1.42");
|
||||
}
|
||||
// TODO Reimplement when Bukkit fixed getConfig()
|
||||
// logblock.saveConfig();
|
||||
try {
|
||||
config.save(cfgFile);
|
||||
} catch (final IOException ex) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "[LogBlock Updater] Error: ", ex);
|
||||
}
|
||||
logblock.saveConfig();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user