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

Commit

Permalink
*StorageEngine class intialize faltfile storage all time
Browse files Browse the repository at this point in the history
  • Loading branch information
Zolli committed Feb 24, 2013
1 parent 5f9b9b3 commit 7200746
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 28 deletions.
6 changes: 0 additions & 6 deletions resources/sql/h2/createTable.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
9 changes: 1 addition & 8 deletions resources/sql/mysql/createTable.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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 ;
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
6 changes: 0 additions & 6 deletions resources/sql/sqlite/createTable.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
10 changes: 6 additions & 4 deletions src/com/Zolli/EnderCore/EnderCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ public class EnderCore extends JavaPlugin {
*/
public YamlConfiguration config;

/**
* FaltFileStorage object
*/
public YamlConfiguration ffStorage;

/**
* Storage engine class
*/
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions src/com/Zolli/EnderCore/Storage/Storage.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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!");
Expand Down
2 changes: 1 addition & 1 deletion src/com/Zolli/EnderCore/Storage/storageActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

Expand Down

0 comments on commit 7200746

Please sign in to comment.