diff --git a/API/.idea/workspace.xml b/API/.idea/workspace.xml index 10c07231..1c0b217a 100644 --- a/API/.idea/workspace.xml +++ b/API/.idea/workspace.xml @@ -10,14 +10,7 @@ - - - - - - - - + - + - - + + @@ -145,7 +138,7 @@ - + @@ -172,8 +165,8 @@ - - + + @@ -194,10 +187,10 @@ - + - + @@ -210,6 +203,15 @@ + + + + + + + + + @@ -323,12 +325,12 @@ @@ -562,7 +564,7 @@ - + @@ -627,7 +629,7 @@ - + @@ -814,13 +816,6 @@ - - - - - - - @@ -978,13 +973,6 @@ - - - - - - - @@ -1007,17 +995,17 @@ - + - - - - - - - - - + + + + + + + + + @@ -1028,22 +1016,23 @@ - + - - + + - - - - + + + + + - + @@ -1055,6 +1044,19 @@ + + + + + + + + + + + + + diff --git a/API/out/artifacts/Atlas_jar/Atlas.jar b/API/out/artifacts/Atlas_jar/Atlas.jar index af1ae319..9efbcdb7 100644 Binary files a/API/out/artifacts/Atlas_jar/Atlas.jar and b/API/out/artifacts/Atlas_jar/Atlas.jar differ diff --git a/API/out/production/Atlas/cc/funkemunky/api/database/Database.class b/API/out/production/Atlas/cc/funkemunky/api/database/Database.class index b1a0ba0b..65372ea9 100644 Binary files a/API/out/production/Atlas/cc/funkemunky/api/database/Database.class and b/API/out/production/Atlas/cc/funkemunky/api/database/Database.class differ diff --git a/API/out/production/Atlas/cc/funkemunky/api/database/flatfile/FlatfileDatabase.class b/API/out/production/Atlas/cc/funkemunky/api/database/flatfile/FlatfileDatabase.class index 420d178b..bc5a3bb9 100644 Binary files a/API/out/production/Atlas/cc/funkemunky/api/database/flatfile/FlatfileDatabase.class and b/API/out/production/Atlas/cc/funkemunky/api/database/flatfile/FlatfileDatabase.class differ diff --git a/API/out/production/Atlas/cc/funkemunky/api/database/mongo/MongoDatabase.class b/API/out/production/Atlas/cc/funkemunky/api/database/mongo/MongoDatabase.class index 167eb8d9..af651a12 100644 Binary files a/API/out/production/Atlas/cc/funkemunky/api/database/mongo/MongoDatabase.class and b/API/out/production/Atlas/cc/funkemunky/api/database/mongo/MongoDatabase.class differ diff --git a/API/src/cc/funkemunky/api/database/Database.java b/API/src/cc/funkemunky/api/database/Database.java index b7ef3520..7781e3d4 100644 --- a/API/src/cc/funkemunky/api/database/Database.java +++ b/API/src/cc/funkemunky/api/database/Database.java @@ -12,11 +12,14 @@ public abstract class Database { private String name; private Plugin plugin; + private DatabaseType type; private Map databaseValues; - public Database(String name, Plugin plugin) { + public Database(String name, Plugin plugin, DatabaseType type) { this.name = name; this.plugin = plugin; + this.type = type; + databaseValues = new ConcurrentHashMap<>(); } diff --git a/API/src/cc/funkemunky/api/database/flatfile/FlatfileDatabase.java b/API/src/cc/funkemunky/api/database/flatfile/FlatfileDatabase.java index d8af47d0..1edf6f72 100644 --- a/API/src/cc/funkemunky/api/database/flatfile/FlatfileDatabase.java +++ b/API/src/cc/funkemunky/api/database/flatfile/FlatfileDatabase.java @@ -1,6 +1,7 @@ package cc.funkemunky.api.database.flatfile; import cc.funkemunky.api.database.Database; +import cc.funkemunky.api.database.DatabaseType; import cc.funkemunky.api.utils.FunkeFile; import cc.funkemunky.api.utils.MiscUtils; import lombok.Getter; @@ -12,7 +13,7 @@ public class FlatfileDatabase extends Database { private FunkeFile file; public FlatfileDatabase(String name, Plugin plugin) { - super(name, plugin); + super(name, plugin, DatabaseType.FLATFILE); file = new FunkeFile(plugin, "databases", name + ".txt"); } diff --git a/API/src/cc/funkemunky/api/database/mongo/MongoDatabase.java b/API/src/cc/funkemunky/api/database/mongo/MongoDatabase.java index ccd0fca0..699813c1 100644 --- a/API/src/cc/funkemunky/api/database/mongo/MongoDatabase.java +++ b/API/src/cc/funkemunky/api/database/mongo/MongoDatabase.java @@ -2,6 +2,7 @@ import cc.funkemunky.api.Atlas; import cc.funkemunky.api.database.Database; +import cc.funkemunky.api.database.DatabaseType; import cc.funkemunky.api.mongo.Mongo; import com.mongodb.Block; import com.mongodb.client.MongoCollection; @@ -15,7 +16,7 @@ public class MongoDatabase extends Database { private MongoCollection collection; public MongoDatabase(String name, Plugin plugin) { - super(name, plugin); + super(name, plugin, DatabaseType.MONGO); collection = Atlas.getInstance().getMongo().getMongoDatabase().getCollection(name); } @@ -31,7 +32,7 @@ public void loadDatabase() { public void saveDatabase() { Map> toSort = new HashMap<>(); getDatabaseValues().keySet().forEach(key -> { - String[] toFormat = key.split("."); + String[] toFormat = key.split(";"); Map objects = toSort.getOrDefault(toFormat[0], new HashMap<>());