Guest User

Untitled

a guest
Aug 16th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. //Get config from Config in plugin
  2. String type =plugin.getConfig().getString(CONFIG_DATABASE_TYPE);
  3. this.host = (String) plugin.getConfig().getString(CONFIG_DATABASE_IP);
  4. this.port = String.valueOf(plugin.getConfig().getString(CONFIG_DATABASE_PORT));
  5. this.username = (String) plugin.getConfig().getString(CONFIG_DATABASE_USER_NAME);
  6. this.password = (String) plugin.getConfig().getString(CONFIG_DATABASE_PASSWORD);
  7. String name = (String) plugin.getConfig().getString(CONFIG_DATABASE_NAME);
  8. this.prefix = (String) plugin.getConfig().getString(CONFIG_DATABASE_PREFIX);
  9. if (plugin.getConfig().getString(CONFIG_DATABASE_TYPE).toUpperCase().equals("MYSQL")) {
  10. dbUrl = "jdbc:mysql://" + this.host + ":" + this.port + "/" + name;
  11. } else if (plugin.getConfig().getString(CONFIG_DATABASE_TYPE).toUpperCase().equals("SQLITE")) {
  12. dbUrl = "jdbc:sqlite:" + "plugins/PayDay/" + name + ".db";
  13. } else {
  14. plugin.getLogger().error("DATABASE CONFIGURATION MISSING");
  15. }
Add Comment
Please, Sign In to add comment