DBManager is a plugin that allows server owners to save their database credentials in a single config file, that can be used by other plugins.
Idea by @The_Doctors_Life
If you're a server owner:
A config would look like this: database: <database>
username: <username>
password: <password>
host: <host>
port: <port>
# wether it's a mysql database or not
mysql: <true/false>
If you’d like to have plugin_x use another database, you have to specify that in exceptions.yml:
plugin_x: plugin_x.yml
Now you’d have to create another file called plugin_x.yml:
database: <database>
username: <username>
password: <password>
host: <host>
port: <port>
# wether it's a mysql database or not
mysql: <true/false>
…where you enter the data plugin_x needs.
If you're a developer
Let's say you have a plugin that would use my DBManager.jar as library. You would simply use the `DBManager` class to access the database. If your plugin uses a mysql database, you can simply get a connection object by writing this code:DBManager dbManager = DBManager.getInstance();
Connection connection = dbManager.getConnection(plugin);
However, if your plugin does not use mysql, you have to establish the connection on your own.
DBManager dbManager = DBManager.getInstance();
String database = dbManager.getDatabase(plugin);
String username = dbManager.getUsername(plugin);
String password = dbManager.getPassword(plugin);
String host = dbManager.getHost(plugin);
int port = dbManager.getPort(plugin);
Download v1.2_0: Dropbox - Error
Download v1.2_0 (API): Dropbox - Error
GitHub: GitHub - MrMysteri0us/DBManager: A simple Sponge database-credential/data-manager.