mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-22 17:17:37 +00:00
oops
This commit is contained in:
parent
0f76222f90
commit
7d709319c6
@ -3,6 +3,8 @@ package dev.plex.cache;
|
|||||||
import dev.plex.Plex;
|
import dev.plex.Plex;
|
||||||
import dev.plex.player.PlexPlayer;
|
import dev.plex.player.PlexPlayer;
|
||||||
import dev.plex.storage.StorageType;
|
import dev.plex.storage.StorageType;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -49,19 +51,7 @@ public class DataUtils
|
|||||||
*/
|
*/
|
||||||
public static PlexPlayer getPlayer(UUID uuid)
|
public static PlexPlayer getPlayer(UUID uuid)
|
||||||
{
|
{
|
||||||
if (PlayerCache.getPlexPlayerMap().containsKey(uuid))
|
return getPlayer(uuid, true);
|
||||||
{
|
|
||||||
return PlayerCache.getPlexPlayerMap().get(uuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Plex.get().getStorageType() == StorageType.MONGODB)
|
|
||||||
{
|
|
||||||
return Plex.get().getMongoPlayerData().getByUUID(uuid);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return Plex.get().getSqlPlayerData().getByUUID(uuid);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PlexPlayer getPlayer(UUID uuid, boolean loadExtraData)
|
public static PlexPlayer getPlayer(UUID uuid, boolean loadExtraData)
|
||||||
@ -81,8 +71,19 @@ public class DataUtils
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static PlexPlayer getPlayer(String username)
|
||||||
|
{
|
||||||
|
return getPlayer(username, true);
|
||||||
|
}
|
||||||
|
|
||||||
public static PlexPlayer getPlayer(String username, boolean loadExtraData)
|
public static PlexPlayer getPlayer(String username, boolean loadExtraData)
|
||||||
{
|
{
|
||||||
|
Optional<PlexPlayer> plexPlayer = PlayerCache.getPlexPlayerMap().values().stream().filter(player -> player.getName().equalsIgnoreCase(username)).findFirst();
|
||||||
|
if (plexPlayer.isPresent())
|
||||||
|
{
|
||||||
|
return plexPlayer.get();
|
||||||
|
}
|
||||||
|
|
||||||
if (Plex.get().getStorageType() == StorageType.MONGODB)
|
if (Plex.get().getStorageType() == StorageType.MONGODB)
|
||||||
{
|
{
|
||||||
return Plex.get().getMongoPlayerData().getByName(username);
|
return Plex.get().getMongoPlayerData().getByName(username);
|
||||||
|
Loading…
Reference in New Issue
Block a user