Created
August 16, 2018 11:44
-
-
Save theresajayne/13b18bebf2db7fd5fe1a131345f82b5c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Get config from Config in plugin | |
String type =plugin.getConfig().getString(CONFIG_DATABASE_TYPE); | |
this.host = (String) plugin.getConfig().getString(CONFIG_DATABASE_IP); | |
this.port = String.valueOf(plugin.getConfig().getString(CONFIG_DATABASE_PORT)); | |
this.username = (String) plugin.getConfig().getString(CONFIG_DATABASE_USER_NAME); | |
this.password = (String) plugin.getConfig().getString(CONFIG_DATABASE_PASSWORD); | |
String name = (String) plugin.getConfig().getString(CONFIG_DATABASE_NAME); | |
this.prefix = (String) plugin.getConfig().getString(CONFIG_DATABASE_PREFIX); | |
if (plugin.getConfig().getString(CONFIG_DATABASE_TYPE).toUpperCase().equals("MYSQL")) { | |
dbUrl = "jdbc:mysql://" + this.host + ":" + this.port + "/" + name; | |
} else if (plugin.getConfig().getString(CONFIG_DATABASE_TYPE).toUpperCase().equals("SQLITE")) { | |
dbUrl = "jdbc:sqlite:" + "plugins/PayDay/" + name + ".db"; | |
} else { | |
plugin.getLogger().error("DATABASE CONFIGURATION MISSING"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment