Class DatabaseManager

java.lang.Object
com.fren_gor.ultimateAdvancementAPI.database.DatabaseManager

public final class DatabaseManager extends Object
The database manager. It handles the connection to the database and caches the requested values to improve performances.

The caching system caches teams using TeamProgressions and keeps a link between each online player and the associated TeamProgression. Two players who are part of the same team will always be associated to the same TeamProgression object. More formally, the object returned by getTeamProgression(Player) is the same if and only the players are members of the same team:

 TeamProgression teamP1 = getProgression(playerOne);
 TeamProgression teamP2 = getProgression(playerTwo);
 if (teamP1.contains(p2)) { // Players are members of the same team
    assert teamP1 == teamP2;
 } else { // Players are in two separate teams
    assert teamP1 != teamP2;
 }
By default, players are kept in cache until they quit. However, this behavior can be overridden through the loadOfflinePlayer(UUID, CacheFreeingOption) method, which forces a player to stay in cache even if they quit. If the player is not online, they'll be loaded.

There is, however, a limit on the maximum amount of requests a plugin can do. For more information, see getLoadingRequestsAmount(Plugin, UUID, CacheFreeingOption.Option).

This class is thread safe.