[Download][API] DBManager v1.2_0 | One config, all plugins!

Uh, I have a problem with your API.

Why not: dbManager.getConnection(plugin)?

1 Like

So, you want me to create a connection object for you and request the plugin main class as a parameter? I can do that once I’m home.

Edit: Finished.

Looks good. I will perhaps softdepend this :smiley: (something is wrong with this sentence). But I recommend to make a new database for every plugin. Plugins may use flyaway, that needs an untouched database. Why not make the config like this:

username: '<username>'
password: '<password>'
url: '<url>' 
databases:
    superplugin: 'superplugindb'

Softdepend on :slight_smile: Now it’s correct :3

Off-topic
@GameplayJDK I am aware of that, but since Java 8 isn’t globally supported yet, I’ll try to get the most out of Rhino (Rhino is a bit faster that the builtin JS engine)

I’m not too fluent with SnakeYAML so I don’t know how it handles nested values.

But trust me, as soon as Sponge is out, I will do it like that.

1 Like

Update: You can now use the plugin object instead of the name. (Check GitHub)

Off-topic
@Exstar Possibly you could distribute the jar, for people who don’t have JRE8… I’m not familiar with the distribution rules :wink:

1 Like

I’m working on a MySQLManager class.
All connections will be set up by DBManager, you’ll be able to use the DBManager.getConnection(plugin) method to get the connection you need.

Version 1.2_0 available for download!

Made a logo. Do you like it? :3

2 Likes

Maybe,what’s in it for me?

It would be better to have a ā€œsharedā€ library that you can embed in your plugin, instead of a separate plugin.

Also, you can register your db as a service.

I’ll probably change that on a future date.

Some additions:

How adding a service will work:

//arguments: service class, service instance, replaceable, owner
ServiceManager.setProvider(DBManager.getClass(), dBManagerInstance, true, dbManagerPlugin)

Right now there is no way to get the ServiceManager from Game, but it’s much better than DBManager.getInstance();.

You probably want to shoot me a PR. :wink:
Not that I couldn’t do it on my own, but… meh.

Awesome! :smile:

With permission of the author I added it to my maven repo:

<repository>
    <id>thomas15v-repo</id>
    <url>http://repo.thomas15v.net/plugins</url>
</repository>
<dependency>
    <groupId>de.mrmysteri0us</groupId>
    <artifactId>DBManager</artifactId>
    <version>1.2</version>
</dependency>

And yeah I messed up the ci build a bit xD. If the server crashes (what sometimes happens if a sponge build triggers). Shoot me a PM.

1 Like

Sorry for a stupid question but what is plugin in String database = dbManager.getDatabase(plugin);? I’m assuming it’s a string of the plugin name?

Edit: Answer below.