diff --git a/resources/sql/h2/createTable.sql b/resources/sql/h2/createTable.sql index 8bce111..406c99b 100644 --- a/resources/sql/h2/createTable.sql +++ b/resources/sql/h2/createTable.sql @@ -3,10 +3,4 @@ CREATE TABLE IF NOT EXISTS players ( playerName VARCHAR(32), dragonDefeated TINYINT, specialTags TEXT -); - -CREATE TABLE IF NOT EXISTS settings ( - id INT auto_increment, - key VARCHAR(64), - value VARCHAR(64) ); \ No newline at end of file diff --git a/resources/sql/mysql/createTable.sql b/resources/sql/mysql/createTable.sql index cbe4364..6142cc2 100644 --- a/resources/sql/mysql/createTable.sql +++ b/resources/sql/mysql/createTable.sql @@ -4,11 +4,4 @@ CREATE TABLE IF NOT EXISTS `players` ( `dragonDefeated` tinyint(1) NOT NULL, `specialTags` text NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; - -CREATE TABLE IF NOT EXISTS `settings` ( - `id` int(10) NOT NULL AUTO_INCREMENT, - `key` varchar(64) NOT NULL, - `value` varchar(64) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; \ No newline at end of file +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; \ No newline at end of file diff --git a/resources/sql/sqlite/createTable.sql b/resources/sql/sqlite/createTable.sql index 45d66b9..5c1ca35 100644 --- a/resources/sql/sqlite/createTable.sql +++ b/resources/sql/sqlite/createTable.sql @@ -3,10 +3,4 @@ CREATE TABLE IF NOT EXISTS players ( playerName VARCHAR(32), dragonDefeated TINYINT, specialTags TEXT -); - -CREATE TABLE IF NOT EXISTS settings ( - id INTEGER PRIMARY KEY, - key VARCHAR(64), - value VARCHAR(64) ); \ No newline at end of file diff --git a/src/com/Zolli/EnderCore/EnderCore.java b/src/com/Zolli/EnderCore/EnderCore.java index 34ad7dc..0252ec9 100644 --- a/src/com/Zolli/EnderCore/EnderCore.java +++ b/src/com/Zolli/EnderCore/EnderCore.java @@ -65,6 +65,11 @@ public class EnderCore extends JavaPlugin { */ public YamlConfiguration config; + /** + * FaltFileStorage object + */ + public YamlConfiguration ffStorage; + /** * Storage engine class */ @@ -127,6 +132,7 @@ public void onEnable() { this.dbAction = new storageActions(this.storage); this.local = new localizationManager(this); this.command = new commandHandler(this); + this.ffStorage = this.storage.getFlatFileStorage(); /* Registering listeners and commands */ this.registerListeners(); @@ -173,10 +179,6 @@ public Configuration initializeFlatfile() { return this.storageConfig; } - public EnderCore getCore() { - return this; - } - /** * Get all worlds and get the main world name and nether name * Save the config when main world name contains the default value diff --git a/src/com/Zolli/EnderCore/Storage/Storage.java b/src/com/Zolli/EnderCore/Storage/Storage.java index 27b01e5..8c13dd9 100644 --- a/src/com/Zolli/EnderCore/Storage/Storage.java +++ b/src/com/Zolli/EnderCore/Storage/Storage.java @@ -120,10 +120,10 @@ public storageEngine getSelectedEngine() { } /** - * Return the flat file storage object - * @return Flat file storage object + * Return the initialized YamlConfiguration object + * @return FaltFile storage object */ - public YamlConfiguration getFfStorage() { + public YamlConfiguration getFlatFileStorage() { return this.ffStorage; } @@ -173,6 +173,7 @@ private void initializeDriver() { File driver = new File("./lib" + File.separator + this.selectedEngine.getFileName()); this.loadExternalDriver(driver); Class.forName("com.mysql.jdbc.Driver"); + this.ffStorage = this.plugin.initializeFlatfile().config; logger.log(Level.INFO, "Initialized MySQL storage engine!"); } catch (Exception e) { e.printStackTrace(); @@ -182,6 +183,7 @@ private void initializeDriver() { File driver = new File("./lib" + File.separator + this.selectedEngine.getFileName()); this.loadExternalDriver(driver); Class.forName("org.sqlite.JDBC"); + this.ffStorage = this.plugin.initializeFlatfile().config; logger.log(Level.INFO, "Initialized SQLite storage engine!"); } catch (Exception e) { e.printStackTrace(); @@ -191,6 +193,7 @@ private void initializeDriver() { File driver = new File("./lib" + File.separator + this.selectedEngine.getFileName()); this.loadExternalDriver(driver); Class.forName("org.h2.Driver"); + this.ffStorage = this.plugin.initializeFlatfile().config; logger.log(Level.INFO, "Initialized H2 Database storage engine!"); } catch (Exception e) { logger.log(Level.WARNING, "H2 Dtabase driver not found!"); diff --git a/src/com/Zolli/EnderCore/Storage/storageActions.java b/src/com/Zolli/EnderCore/Storage/storageActions.java index f8129d2..167bc40 100644 --- a/src/com/Zolli/EnderCore/Storage/storageActions.java +++ b/src/com/Zolli/EnderCore/Storage/storageActions.java @@ -29,7 +29,7 @@ public storageActions(Storage s) { conn = this.storage.getConnection(); if(selectedEngine.equals(storageEngine.FLATFILE)) { - this.ffStorage = storage.getFfStorage(); + this.ffStorage = storage.getFlatFileStorage(); } }