Package dev.plex.storage.player

# Class MongoPlayerData

java.lang.Object
dev.plex.storage.player.MongoPlayerData

public class MongoPlayerData extends Object
Mongo fetching utilities for players

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `private final dev.morphia.Datastore`
  `datastore`
  The datastore object / database

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MongoPlayerData()`
  Creates an instance of the player data

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `exists(String username)`
  `boolean`
  `exists(UUID uuid)`
  Checks whether the player exists in mongo's database
  `PlexPlayer`
  `getByIP(String ip)`
  Gets the player from cache or from mongo's database
  `PlexPlayer`
  `getByName(String username)`
  `PlexPlayer`
  `getByUUID(UUID uuid)`
  Gets the player from cache or from mongo's database
  `List<PlexPlayer>`
  `getPlayers()`
  `void`
  `save(PlexPlayer plexPlayer)`
  Saves the player's information in the database
  `void`
  `update(PlexPlayer player)`
  Updates a player's information in the mongo database

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### datastore

    private final dev.morphia.Datastore datastore
    The datastore object / database

- ## Constructor Details

  - ### MongoPlayerData

    public MongoPlayerData()
    Creates an instance of the player data

- ## Method Details

  - ### exists

    public boolean exists(UUID uuid)
    Checks whether the player exists in mongo's database
    Parameters:
      `uuid` - The unique ID of the player
    Returns:
      true if the player was found

  - ### exists

    public boolean exists(String username)

  - ### getByUUID

    public PlexPlayer getByUUID(UUID uuid)
    Gets the player from cache or from mongo's database
    Parameters:
      `uuid` - The unique ID of the player
    Returns:
      a PlexPlayer object
    See Also:
      - `PlexPlayer`

  - ### getByName

    public PlexPlayer getByName(String username)

  - ### getByIP

    public PlexPlayer getByIP(String ip)
    Gets the player from cache or from mongo's database
    Parameters:
      `ip` - The IP address of the player.
    Returns:
      a PlexPlayer object
    See Also:
      - `PlexPlayer`

  - ### update

    public void update(PlexPlayer player)
    Updates a player's information in the mongo database
    Parameters:
      `player` - The PlexPlayer object
    See Also:
      - `PlexPlayer`

  - ### getPlayers

    public List<PlexPlayer> getPlayers()

  - ### save

    public void save(PlexPlayer plexPlayer)
    Saves the player's information in the database
    Parameters:
      `plexPlayer` - The PlexPlayer object
    See Also:
      - `PlexPlayer`