mirror of
https://github.com/WiIIiam278/HuskSync.git
synced 2025-12-23 00:29:18 +00:00
feat: Add support for MongoDB data storage (#250)
* Started impl for mongo * added docs * refactor of the mongo code, made mongodb artifacts download at run time, tested and working * complete all change requests * remove mongo and bson from relocations as they arnt needed * changed the config * updated docs * not null not null not null not null not null not null not null not null not null not null not null not null not null not null not null not null not null not null not null not null not null not null not null not null --------- Co-authored-by: William <will27528@gmail.com>
This commit is contained in:
@@ -43,6 +43,7 @@ import net.william278.husksync.data.Data;
|
||||
import net.william278.husksync.data.Identifier;
|
||||
import net.william278.husksync.data.Serializer;
|
||||
import net.william278.husksync.database.Database;
|
||||
import net.william278.husksync.database.MongoDbDatabase;
|
||||
import net.william278.husksync.database.MySqlDatabase;
|
||||
import net.william278.husksync.event.BukkitEventDispatcher;
|
||||
import net.william278.husksync.hook.PlanHook;
|
||||
@@ -162,7 +163,11 @@ public class BukkitHuskSync extends JavaPlugin implements HuskSync, BukkitTask.S
|
||||
|
||||
// Initialize the database
|
||||
initialize(getSettings().getDatabase().getType().getDisplayName() + " database connection", (plugin) -> {
|
||||
this.database = new MySqlDatabase(this);
|
||||
this.database = switch (settings.getDatabase().getType()) {
|
||||
case MYSQL, MARIADB -> new MySqlDatabase(this);
|
||||
case MONGO -> new MongoDbDatabase(this);
|
||||
default -> throw new IllegalStateException("Invalid database type");
|
||||
};
|
||||
this.database.initialize();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user