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