mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-27 19:24:44 +02:00
SQLDatabaseManager optimizations, async profile loading -t00thpick1, zreed
This commit changes our shared connection into a connection pool utility to prevent thread locks from multiple actions attempting to access the database at the same time. In additon, profile loading has been moved off the main thread at login time, to allieviate the performance issues caused by it. Fixes #2138, Fixes #2119, Fixes #1982, Fixes #1953
This commit is contained in:
@ -18,16 +18,12 @@ public final class UserManager {
|
||||
private UserManager() {}
|
||||
|
||||
/**
|
||||
* Add a new user.
|
||||
* Track a new user.
|
||||
*
|
||||
* @param player The player to create a user record for
|
||||
* @return the player's {@link McMMOPlayer} object
|
||||
* @param mcMMOPlayer the player profile to start tracking
|
||||
*/
|
||||
public static McMMOPlayer addUser(Player player) {
|
||||
McMMOPlayer mcMMOPlayer = new McMMOPlayer(player);
|
||||
player.setMetadata(mcMMO.playerDataKey, new FixedMetadataValue(mcMMO.p, mcMMOPlayer));
|
||||
|
||||
return mcMMOPlayer;
|
||||
public static void track(McMMOPlayer mcMMOPlayer) {
|
||||
mcMMOPlayer.getPlayer().setMetadata(mcMMO.playerDataKey, new FixedMetadataValue(mcMMO.p, mcMMOPlayer));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user