Skip to content

Commit a55ba8f

Browse files
committed
feat database #4
1 parent 0d378a8 commit a55ba8f

18 files changed

Lines changed: 592 additions & 571 deletions

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,5 +157,10 @@
157157
<version>1.7</version>
158158
<scope>provided</scope>
159159
</dependency>
160+
<dependency>
161+
<groupId>com.zaxxer</groupId>
162+
<artifactId>HikariCP</artifactId>
163+
<version>5.0.1</version>
164+
</dependency>
160165
</dependencies>
161166
</project>

src/main/java/com/github/elic0de/battleroyale/BattleRoyale.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
import com.github.elic0de.battleroyale.hook.VaultEconomyHook;
1010
import com.github.elic0de.battleroyale.listener.CompassListener;
1111
import com.github.elic0de.battleroyale.listener.EventListener;
12+
import com.github.elic0de.battleroyale.user.GameUserData;
1213
import com.github.elic0de.battleroyale.user.GameUserManager;
14+
import com.github.elic0de.battleroyale.utils.annoData.AnnoData;
1315
import lombok.Getter;
1416
import net.william278.annotaml.Annotaml;
1517
import org.bukkit.Bukkit;
@@ -34,6 +36,9 @@ public final class BattleRoyale extends JavaPlugin {
3436
private Settings settings;
3537

3638
private List<Hook> hooks = new ArrayList<>();
39+
40+
private AnnoData database;
41+
3742
@Override
3843
public void onLoad() {
3944
instance = this;
@@ -44,17 +49,17 @@ public void onEnable() {
4449
loadConfig();
4550

4651
hooks = new ArrayList<>();
52+
game = new Game();
53+
database = new AnnoData();
54+
database.createTable(GameUserData.class);
4755

4856
registerCommands();
4957
registerEconomyHook();
50-
5158
loadHooks();
5259

5360
Bukkit.getPluginManager().registerEvents(new EventListener(), this);
5461
Bukkit.getPluginManager().registerEvents(new CompassListener(), this);
5562

56-
game = new Game();
57-
5863
GameUserManager.getOnlineUsers().forEach(player -> game.join(player));
5964
}
6065

@@ -72,6 +77,7 @@ public void onDisable() {
7277
// Plugin shutdown logic
7378
GameUserManager.getOnlineUsers().forEach(player -> game.leave(player));
7479
game.reset();
80+
database.close();
7581
//Bukkit.getScheduler().cancelTasks(this);
7682
}
7783

src/main/java/com/github/elic0de/battleroyale/database/Database.java

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

src/main/java/com/github/elic0de/battleroyale/database/MySqlDatabase.java

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

0 commit comments

Comments
 (0)