add option to enable extra data such as punishments (default is yes)

This commit is contained in:
Taah
2022-05-05 18:41:11 -07:00
parent b23b7c0c1b
commit c9da0177ad
4 changed files with 48 additions and 15 deletions

View File

@ -67,7 +67,7 @@ public class SQLPlayerData
* @return a PlexPlayer object
* @see PlexPlayer
*/
public PlexPlayer getByUUID(UUID uuid)
public PlexPlayer getByUUID(UUID uuid, boolean loadExtraData)
{
if (PlayerCache.getPlexPlayerMap().containsKey(uuid))
{
@ -79,7 +79,7 @@ public class SQLPlayerData
PreparedStatement statement = con.prepareStatement(SELECT);
statement.setString(1, uuid.toString());
ResultSet set = statement.executeQuery();
PlexPlayer plexPlayer = new PlexPlayer(uuid);
PlexPlayer plexPlayer = new PlexPlayer(uuid, loadExtraData);
while (set.next())
{
String name = set.getString("name");
@ -111,6 +111,11 @@ public class SQLPlayerData
return null;
}
public PlexPlayer getByUUID(UUID uuid)
{
return this.getByUUID(uuid, true);
}
public PlexPlayer getByName(String username)
{
PlexPlayer player = PlayerCache.getPlexPlayerMap().values().stream().filter(plexPlayer -> plexPlayer.getName().equalsIgnoreCase(username)).findFirst().orElse(null);