mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-22 17:17:37 +00:00
h
This commit is contained in:
parent
de663b1548
commit
f9630c9597
6
pom.xml
6
pom.xml
@ -47,9 +47,9 @@
|
|||||||
|
|
||||||
<!-- DATABASING -->
|
<!-- DATABASING -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>dev.morphia.morphia</groupId>
|
<groupId>org.mongodb.morphia</groupId>
|
||||||
<artifactId>morphia-core</artifactId>
|
<artifactId>morphia</artifactId>
|
||||||
<version>2.0.2</version>
|
<version>1.3.2</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package me.totalfreedom.plex.cache;
|
package me.totalfreedom.plex.cache;
|
||||||
|
|
||||||
import dev.morphia.query.Query;
|
|
||||||
import dev.morphia.query.UpdateOperations;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import me.totalfreedom.plex.Plex;
|
import me.totalfreedom.plex.Plex;
|
||||||
import me.totalfreedom.plex.player.PlexPlayer;
|
import me.totalfreedom.plex.player.PlexPlayer;
|
||||||
|
import org.mongodb.morphia.query.Query;
|
||||||
|
import org.mongodb.morphia.query.UpdateOperations;
|
||||||
|
|
||||||
public class MongoPlayerData
|
public class MongoPlayerData
|
||||||
{
|
{
|
||||||
@ -17,10 +17,9 @@ public class MongoPlayerData
|
|||||||
|
|
||||||
public boolean exists(UUID uuid)
|
public boolean exists(UUID uuid)
|
||||||
{
|
{
|
||||||
|
|
||||||
Query<PlexPlayer> query = plexPlayerDAO.createQuery();
|
Query<PlexPlayer> query = plexPlayerDAO.createQuery();
|
||||||
|
|
||||||
return query.field("uuid").exists().field("uuid").equal(uuid.toString()).find().tryNext() != null;
|
return query.field("uuid").exists().field("uuid").equal(uuid.toString()).get() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlexPlayer getByUUID(UUID uuid)
|
public PlexPlayer getByUUID(UUID uuid)
|
||||||
@ -31,7 +30,7 @@ public class MongoPlayerData
|
|||||||
return PlayerCache.getPlexPlayerMap().get(uuid);
|
return PlayerCache.getPlexPlayerMap().get(uuid);
|
||||||
}
|
}
|
||||||
Query<PlexPlayer> query2 = plexPlayerDAO.createQuery().field("uuid").exists().field("uuid").equal(uuid.toString());
|
Query<PlexPlayer> query2 = plexPlayerDAO.createQuery().field("uuid").exists().field("uuid").equal(uuid.toString());
|
||||||
return query2.first();
|
return query2.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(PlexPlayer player)
|
public void update(PlexPlayer player)
|
||||||
@ -44,7 +43,7 @@ public class MongoPlayerData
|
|||||||
updateOps.set("name", player.getName());
|
updateOps.set("name", player.getName());
|
||||||
updateOps.set("loginMSG", player.getLoginMSG());
|
updateOps.set("loginMSG", player.getLoginMSG());
|
||||||
updateOps.set("prefix", player.getPrefix());
|
updateOps.set("prefix", player.getPrefix());
|
||||||
updateOps.set("rank", player.getRank() == null ? "" : player.getRank().name().toLowerCase());
|
updateOps.set("rank", player.getRank().toLowerCase());
|
||||||
updateOps.set("ips", player.getIps());
|
updateOps.set("ips", player.getIps());
|
||||||
updateOps.set("coins", player.getCoins());
|
updateOps.set("coins", player.getCoins());
|
||||||
plexPlayerDAO.update(filter, updateOps);
|
plexPlayerDAO.update(filter, updateOps);
|
||||||
|
Loading…
Reference in New Issue
Block a user