diff --git a/src/main/java/me/night/nullvalkyrie/Main.java b/src/main/java/me/night/nullvalkyrie/Main.java index 6635e0c..d20e8ec 100644 --- a/src/main/java/me/night/nullvalkyrie/Main.java +++ b/src/main/java/me/night/nullvalkyrie/Main.java @@ -18,7 +18,7 @@ public final class Main extends JavaPlugin { @Override public void onEnable() { EnchantmentManager.register(); - new DatabaseManager(); + new DatabaseManager().connect(); new CommandManager(); Bukkit.getPluginManager().registerEvents(new ServerEvents(), this); Bukkit.getPluginManager().registerEvents(new InventoryListener(), this); diff --git a/src/main/java/me/night/nullvalkyrie/database/DatabaseManager.java b/src/main/java/me/night/nullvalkyrie/database/DatabaseManager.java index 8275c0f..79c2edf 100644 --- a/src/main/java/me/night/nullvalkyrie/database/DatabaseManager.java +++ b/src/main/java/me/night/nullvalkyrie/database/DatabaseManager.java @@ -5,11 +5,9 @@ import org.bson.Document; public class DatabaseManager { public static MongoDatabase database; - - public DatabaseManager() { + public void connect() { database = MongoClients.create(System.getenv("MONGODB_URI")).getDatabase("NullValkyrie"); } - public MongoCollection getMinersDB() { return database.getCollection("miners"); }