mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-22 09:07:37 +00:00
add option to load extra data when retrieving by username
This commit is contained in:
parent
9557737915
commit
0f76222f90
@ -81,7 +81,7 @@ public class DataUtils
|
||||
}
|
||||
}
|
||||
|
||||
public static PlexPlayer getPlayer(String username)
|
||||
public static PlexPlayer getPlayer(String username, boolean loadExtraData)
|
||||
{
|
||||
if (Plex.get().getStorageType() == StorageType.MONGODB)
|
||||
{
|
||||
@ -89,7 +89,7 @@ public class DataUtils
|
||||
}
|
||||
else
|
||||
{
|
||||
return Plex.get().getSqlPlayerData().getByName(username);
|
||||
return Plex.get().getSqlPlayerData().getByName(username, loadExtraData);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ public class SQLPlayerData
|
||||
return this.getByUUID(uuid, true);
|
||||
}
|
||||
|
||||
public PlexPlayer getByName(String username)
|
||||
public PlexPlayer getByName(String username, boolean loadExtraData)
|
||||
{
|
||||
PlexPlayer player = PlayerCache.getPlexPlayerMap().values().stream().filter(plexPlayer -> plexPlayer.getName().equalsIgnoreCase(username)).findFirst().orElse(null);
|
||||
if (player != null)
|
||||
@ -130,7 +130,7 @@ public class SQLPlayerData
|
||||
ResultSet set = statement.executeQuery();
|
||||
while (set.next())
|
||||
{
|
||||
PlexPlayer plexPlayer = new PlexPlayer(UUID.fromString(set.getString("uuid")));
|
||||
PlexPlayer plexPlayer = new PlexPlayer(UUID.fromString(set.getString("uuid")), loadExtraData);
|
||||
String loginMSG = set.getString("login_msg");
|
||||
String prefix = set.getString("prefix");
|
||||
String rankName = set.getString("rank").toUpperCase();
|
||||
@ -160,6 +160,11 @@ public class SQLPlayerData
|
||||
return null;
|
||||
}
|
||||
|
||||
public PlexPlayer getByName(String username)
|
||||
{
|
||||
return getByName(username, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the player from cache or from the SQL database
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user