Skip to content

Commit 33b5433

Browse files
committed
Update DatabaseLib to version 3.0.0
Breaking changes: - moved packages to 'sql' package - removed or renamed some classes - removed 'new***Task' methods - removed AsyncLib - removed task priorities - updated ConfigLib to version 2
1 parent 6fe16ae commit 33b5433

File tree

71 files changed

+2306
-4344
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+2306
-4344
lines changed

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
language: java
22
jdk:
3-
oraclejdk9
3+
- oraclejdk8
4+
- oraclejdk9
5+
- oraclejdk10
Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,37 @@
11
package de.exlll.databaselib;
22

3-
import de.exlll.asynclib.exec.PluginTaskService;
4-
import de.exlll.asynclib.exec.ServiceConfig;
5-
import de.exlll.asynclib.exec.TaskExecutor;
6-
import de.exlll.asynclib.exec.TaskService;
7-
import de.exlll.databaselib.pool.SqlConnectionPool;
3+
import de.exlll.databaselib.sql.pool.SqlConnectionPool;
84
import org.bukkit.plugin.java.JavaPlugin;
95

106
public final class DatabaseLib extends JavaPlugin {
11-
private static DatabaseController controller;
7+
private static DatabaseLibService databaseLibService;
128

139
@Override
1410
public void onEnable() {
15-
controller = new PluginDatabaseController();
11+
databaseLibService = new DatabaseLibService(getDataFolder());
12+
databaseLibService.onEnable();
1613
}
1714

1815
@Override
1916
public void onDisable() {
20-
if (controller != null) {
21-
controller.stop();
22-
}
17+
databaseLibService.onDisable();
2318
}
2419

20+
/**
21+
* Returns the main pool.
22+
*
23+
* @return the main pool
24+
* @throws IllegalStateException if main pool not initialized
25+
*/
2526
public static SqlConnectionPool getMainPool() {
26-
checkControllerState();
27-
return controller.getPool();
28-
}
29-
30-
public static TaskExecutor getExecutor() {
31-
checkControllerState();
32-
return controller.getService();
33-
}
34-
35-
private static void checkControllerState() {
36-
if (controller == null) {
37-
throw new IllegalStateException("DatabaseLib plugin not initialized.");
38-
}
27+
checkDatabaseLibServiceInitialized();
28+
return databaseLibService.getSqlConnectionPool();
3929
}
4030

41-
private final class PluginDatabaseController extends DatabaseController {
42-
private PluginDatabaseController() {
43-
super(DatabaseLib.this.getDataFolder());
44-
}
45-
46-
@Override
47-
protected TaskService createService(ServiceConfig config) {
48-
return new PluginTaskService(DatabaseLib.this, config);
31+
private static void checkDatabaseLibServiceInitialized() {
32+
if (databaseLibService == null) {
33+
String msg = "The DatabaseLib plugin has not been initialized yet.";
34+
throw new IllegalStateException(msg);
4935
}
5036
}
5137
}

DatabaseLib-Bukkit/src/main/java/de/exlll/databaselib/example/ExamplePlugin.java

Lines changed: 0 additions & 84 deletions
This file was deleted.

DatabaseLib-Bukkit/src/main/java/de/exlll/databaselib/example/ExampleSubmitter.java

Lines changed: 0 additions & 189 deletions
This file was deleted.

0 commit comments

Comments
 (0)