From 0c6af9856187cf03f40231da3a85ceebf475bb58 Mon Sep 17 00:00:00 2001 From: creatorfromhell Date: Fri, 17 Sep 2021 09:45:26 -0400 Subject: [PATCH] Final polish. --- TNE/changelog.md | 2 +- TNE/src/net/tnemc/core/TNE.java | 20 ++++++++++++++ TNE/src/net/tnemc/resources/config.yml | 36 +------------------------- TNE/src/net/tnemc/resources/data.yml | 2 +- 4 files changed, 23 insertions(+), 37 deletions(-) diff --git a/TNE/changelog.md b/TNE/changelog.md index 826f156e..b0dcaed7 100644 --- a/TNE/changelog.md +++ b/TNE/changelog.md @@ -23,7 +23,7 @@ Fixes - Fixed issue where /money note did not properly work. - Fixed issue where max balance wasn't being enforced. -Planned for 1.1.4 +Planned for 1.2 New Item Currency System // still needs completed - No longer required to declare minor/major diff --git a/TNE/src/net/tnemc/core/TNE.java b/TNE/src/net/tnemc/core/TNE.java index 339ec5de..4b06975f 100644 --- a/TNE/src/net/tnemc/core/TNE.java +++ b/TNE/src/net/tnemc/core/TNE.java @@ -179,6 +179,9 @@ public class TNE extends TNELib implements TabCompleter { public static boolean fawe = true; private boolean firstRun = false; + //used to determine if we should move our database configurations. + private boolean dataFirst = false; + public void onLoad() { if(MISCUtils.serverBlacklist().contains(getServer().getIp())) { blacklisted = true; @@ -351,6 +354,19 @@ public void onEnable() { if(MISCUtils.isOneSix()) useUUID = false; + if(!firstRun && dataFirst) { + logger().info("Moving database configurations to data.yml."); + configurations().setValue("Data.Database.Type", "data", configurations().getValue("Core.Database.Type")); + configurations().setValue("Data.Database.MySQL.Host", "data", configurations().getValue("Core.Database.MySQL.Host")); + configurations().setValue("Data.Database.MySQL.Port", "data", configurations().getValue("Core.Database.MySQL.Port")); + configurations().setValue("Data.Database.MySQL.DB", "data", configurations().getValue("Core.Database.MySQL.DB")); + configurations().setValue("Data.Database.MySQL.User", "data", configurations().getValue("Core.Database.MySQL.User")); + configurations().setValue("Data.Database.MySQL.Password", "data", configurations().getValue("Core.Database.MySQL.Password")); + configurations().setValue("Data.Database.Prefix", "data", configurations().getValue("Core.Database.Prefix")); + configurations().setValue("Data.Database.File", "data", configurations().getValue("Core.Database.File")); + configurations().save(data); + } + TNE.debug("Preparing save manager"); TNESaveManager sManager = new TNESaveManager(new TNEDataManager( configurations().getString("Data.Database.Type", "data").toLowerCase(), @@ -729,6 +745,10 @@ public void initializeConfigurations(boolean item) { TNE.logger().info("Loading Configurations."); mainConfig = new File(getDataFolder(), "config.yml"); dataFile = new File(getDataFolder(), "data.yml"); + if(!dataFile.exists()) { + dataFirst = true; + } + commands = new File(getDataFolder(), "commands.yml"); items = new File(getDataFolder(), "items.yml"); messagesFile = new File(getDataFolder(), "messages.yml"); diff --git a/TNE/src/net/tnemc/resources/config.yml b/TNE/src/net/tnemc/resources/config.yml index 0f651daa..d404258d 100644 --- a/TNE/src/net/tnemc/resources/config.yml +++ b/TNE/src/net/tnemc/resources/config.yml @@ -282,38 +282,4 @@ Core: EnableChangeFee: false #How much it costs to change worlds if ChangeFee is enabled - ChangeFee: 5.0 - - - #All configurations relating to the database - Database: - - #The database type to use. Current options: MySQL, H2. - Type: h2 - - #The prefix to use for TheNewEconomy MySQL and H2 Tables - Prefix: TNE - - #The file to which all the data will be saved if using a file-based database - File: Economy - - #All configurations relating to the MySQL Database - MySQL: - - #The MySQL host - Host: localhost - - #Whether or not to use SSL. - SSL: false - - #The MySQL port - Port: 3306 - - #The MySQL database - DB: TheNewEconomy - - #Your MySQL user's name - User: user - - #Your MySQL user's password - Password: password \ No newline at end of file + ChangeFee: 5.0 \ No newline at end of file diff --git a/TNE/src/net/tnemc/resources/data.yml b/TNE/src/net/tnemc/resources/data.yml index 7ee4e8ed..1cdbac2b 100644 --- a/TNE/src/net/tnemc/resources/data.yml +++ b/TNE/src/net/tnemc/resources/data.yml @@ -4,7 +4,7 @@ Data: Purge: #Whether old data purging is enabled. - Enabled: true + Enabled: false #The amount of days for a user to be logged off before purging their data? Days: 10