mirror of
https://github.com/plexusorg/Plex.git
synced 2025-07-06 17:36:43 +00:00
Remove deprecated BasicDAO and dev.morphia and replace it with the proper dependency
This commit is contained in:
@ -2,10 +2,10 @@ package me.totalfreedom.plex.storage;
|
||||
|
||||
import com.mongodb.MongoClient;
|
||||
import com.mongodb.MongoClientURI;
|
||||
import dev.morphia.Datastore;
|
||||
import dev.morphia.Morphia;
|
||||
import me.totalfreedom.plex.Plex;
|
||||
import me.totalfreedom.plex.player.PlexPlayer;
|
||||
import org.mongodb.morphia.Datastore;
|
||||
import org.mongodb.morphia.Morphia;
|
||||
|
||||
public class MongoConnection
|
||||
{
|
||||
@ -33,7 +33,7 @@ public class MongoConnection
|
||||
Morphia morphia = new Morphia();
|
||||
Datastore datastore = morphia.createDatastore(client, database);
|
||||
|
||||
datastore.getMapper().addMappedClass(PlexPlayer.class);
|
||||
morphia.map(PlexPlayer.class);
|
||||
datastore.ensureIndexes();
|
||||
|
||||
plugin.setStorageType(StorageType.MONGO);
|
||||
|
@ -37,7 +37,9 @@ public class SQLConnection
|
||||
}
|
||||
|
||||
try {
|
||||
connection.prepareStatement("CREATE TABLE IF NOT EXISTS `players` (\n" +
|
||||
if (connection != null)
|
||||
{
|
||||
connection.prepareStatement("CREATE TABLE IF NOT EXISTS `players` (\n" +
|
||||
"\t`uuid` VARCHAR(46),\n" +
|
||||
"\t`name` VARCHAR(18),\n" +
|
||||
"\t`login_msg` VARCHAR(256),\n" +
|
||||
@ -47,6 +49,7 @@ public class SQLConnection
|
||||
"\t`coins` BIGINT,\n" +
|
||||
"\tPRIMARY KEY (`uuid`)\n" +
|
||||
");").execute();
|
||||
}
|
||||
} catch (SQLException throwables) {
|
||||
throwables.printStackTrace();
|
||||
}
|
||||
|
Reference in New Issue
Block a user