ModsJava
DBManager
Lightweight Database Manager for servers and plugins. Free Minecraft Java mod for 1.7, 1.8, 1.9.
⬇ Download on Spigot
This plugin is a lightweight database manager for your servers and plugins.
It provides on one side an easy configurable database credential file which combines several database informations for one or more plugins and on the other side an easy to use API for developers to integrate the system into their plugin and get access to the configurated database.
You can use this solution for your server, if you hate it to configure many several configs in different folders in case your database credentials or settings has been changed.
- Manage several database credentials in one file
- Contains a smart error logging system
- Easy to use and smart API for developers
- Use modern standards like prepared statements
Only Spigot-Version:
1. Download the plugin
2. Put it in your plugin folder.
3. Restart your server.
4. Check with /dbm if the plugin is loaded.
5. And have fun.
BungeeCord-Version:
1. You have to put the 'DBManagerBungee.jar' into your bungeecord proxy-server plugins folder.
2. Restart your proxy-server.
3. Put the 'DBManagerSlave.jar' into each of your bukkit/spigot server plugins folder
4. Restart your bukkit/spigot server.
5. Go into the DBManagerSlave folder and edit your config.yml
6. You have to put the path to the 'DBManager' folder which is located in your proxy-server plugins folder
7. Then restart your bukkit/spigot server and have fun.
Code (Text):
/dbm - Shows you all commands
/dbm reload - Reloads the configuration file
/dbm create [PluginName] - Create a database section for a plugin
/dbm reload - Reloads the configuration file
/dbm create [PluginName] - Create a database section for a plugin
At the moment there is only one permission:
- dbmanager.create
It allows anyone to create a new database section
This is an example config.yml with one database section for explanation.
The config.yml will be generated automatically. But you have to create the sections manually with the ingame command /nbm create [PluginName]
Code (Text):
Credentials:
BanManager: # Example Pluginname (Must be the actual Pluginname)
Enabled: true # Enables the connection
UseSSL: false # Enables ssl as connection protocol (default: false)
Database: database # Name of the database
Hostname: localhost # Name of the host
Port: '3306' # Port of the database (default: 3306)
Username: root # Name of the user
Password: 'password' # Password of the user
BanManager: # Example Pluginname (Must be the actual Pluginname)
Enabled: true # Enables the connection
UseSSL: false # Enables ssl as connection protocol (default: false)
Database: database # Name of the database
Hostname: localhost # Name of the host
Port: '3306' # Port of the database (default: 3306)
Username: root # Name of the user
Password: 'password' # Password of the user
This part is only interessting for developers who want to get access to databases which can be configured in the manager.
If you are using the API you have to put the manager as dependency in your plugin.yml like this:
Code (Text):
// Example plugin.yml
name: BanManager
version: 1.0
author: muckmuck96
main: me.muckmuck96.BanManager
depend: [DBManager]
name: BanManager
version: 1.0
author: muckmuck96
main: me.muckmuck96.BanManager
depend: [DBManager]
Code (Text):
// Parameters:
// plugin: This should be your plugin instance
// sql: This is your sql query
// values: Here you can insert several values for your query
// Return: HashMap<Integer, Object>()
DBMAPI.executeQuery(Plugin plugin, String sql, Object... values);
// For UPDATE, INSERT & DELETE is no special usage required
// Example usage
// Update
int id = 1;
DBMAPI.executeQuery(this, "DELETE FROM table WHERE id = ?", id);
// Insert
DBMAPI.executeQuery(this, "INSERT INTO table (username, uuid, kills) VALUES (?, ?, ?)", "muckmuck96", "UUID", 10);
// Delete
int id = 1;
DBMAPI.executeQuery(this, "DELETE FROM table WHERE id = ?", id);
// For SELECT exist a rule to use it
// Rule: By using 'SELECT * FROM table WHERE id = ?' the first value have to be the column_key which you wanna fetch from the query
HashMap<Integer, Object> result = DBMAPI.executeQuery(Plugin plugin, String sql, Object... values);
// Example usage:
// Select
int id = 1;
HashMap<Integer, Object> result = DBMAPI.executeQuery(this, "SELECT * FROM table WHERE id = ?", "username", id);
// There are 4 states you can fetch from the map
// The Integer is 0 (ERROR), 1 (RESULT_OBJECT), 2 (SUCCESS), 3 (RESULTSET)
// So if you get 1 you can fetch the object from the map
if(result.containsKey(1)){
String username = (String) result.get(1);
}
// If you get 0 you can fetch the exception object from the map
if(result.containsKey(0)){
Exception error = (Exception) result.get(0);
}
// At 2 you just get a success message
// If you get 3 you can fetch the resultset from the map
if(result.containsKey(3)){
ResultSet resultSet = (ResultSet) result.get(3);
}
- Implement posibility to fetch multiple column tuples by the API
- Add more databases like SQLite
- Create tutorial video for usage
Spoiler: Show all screenshots
Command /dbm executed:
How an error looks like in the console:
So if the plugin throws an error it look like this and sometimes you got an message too. The full stacktrace can be found in the "errors" folder in the shown file under the ID: 4 in this example.
This makes the console fancier by getting errors.
How an error looks like in the console:
So if the plugin throws an error it look like this and sometimes you got an message too. The full stacktrace can be found in the "errors" folder in the shown file under the ID: 4 in this example.
This makes the console fancier by getting errors.
If you get any errors or problems with the plugin make sure you checked the console for any error messages. This should solve the most problems. But if there is still an issue please write it down in the discussion and I'll fix it as soon as possible.
Another method is to connect to this TeamSpeak Server: flosing.de and ask for muckmuck
DBManager is a free Minecraft Java mod. Compatible with Minecraft 1.7, 1.8, 1.9, 1.10 and newer. Downloaded 210 times (via Spigot). Download it and open it directly in the game.