Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

Commit

Permalink
Final polish.
Browse files Browse the repository at this point in the history
  • Loading branch information
creatorfromhell committed Sep 17, 2021
1 parent d7a43ab commit 0c6af98
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 37 deletions.
2 changes: 1 addition & 1 deletion TNE/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions TNE/src/net/tnemc/core/TNE.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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");
Expand Down
36 changes: 1 addition & 35 deletions TNE/src/net/tnemc/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
ChangeFee: 5.0
2 changes: 1 addition & 1 deletion TNE/src/net/tnemc/resources/data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0c6af98

Please sign in to comment.