mirror of
https://github.com/YouHaveTrouble/PreventStabby.git
synced 2026-05-12 05:16:55 +00:00
Implement SQL database and refactor onEnable method
In this commit, an SQLite database is set up in the onEnable method of the PreventStabby class, which will be used to store plugin data. To facilitate this, java.io.File is being imported. By doing this, we ensure that the database file exists and is connected to as soon as the plugin is enabled.
This commit is contained in:
@@ -12,6 +12,8 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.command.PluginCommand;
|
import org.bukkit.command.PluginCommand;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
public final class PreventStabby extends JavaPlugin {
|
public final class PreventStabby extends JavaPlugin {
|
||||||
|
|
||||||
private static PreventStabby plugin;
|
private static PreventStabby plugin;
|
||||||
@@ -24,6 +26,8 @@ public final class PreventStabby extends JavaPlugin {
|
|||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
plugin = this;
|
plugin = this;
|
||||||
reloadPluginConfig();
|
reloadPluginConfig();
|
||||||
|
File dbFile = new File("plugins/PreventStabby");
|
||||||
|
sqLite = new DatabaseSQLite("jdbc:sqlite:plugins/PreventStabby/database.db", dbFile, getLogger());
|
||||||
playerManager = new PlayerManager(this);
|
playerManager = new PlayerManager(this);
|
||||||
|
|
||||||
// Register listeners TODO
|
// Register listeners TODO
|
||||||
|
|||||||
Reference in New Issue
Block a user