mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Allow synchronous save on logout
This is intended for plugins that have foreknowledge of a logout happening (e.g. a BungeeCord server hop about to happen), so that they can tell mcMMO to save the data, and the new server will be able to pull the profile correctly from the database.
This commit is contained in:
parent
f4406bd9cf
commit
5db09bf45c
@ -885,13 +885,19 @@ public class McMMOPlayer {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is called by PlayerQuitEvent to tear down the mcMMOPlayer.
|
* This method is called by PlayerQuitEvent to tear down the mcMMOPlayer.
|
||||||
|
*
|
||||||
|
* @param syncSave if true, data is saved synchronously
|
||||||
*/
|
*/
|
||||||
public void logout() {
|
public void logout(boolean syncSave) {
|
||||||
Player thisPlayer = getPlayer();
|
Player thisPlayer = getPlayer();
|
||||||
resetAbilityMode();
|
resetAbilityMode();
|
||||||
BleedTimerTask.bleedOut(thisPlayer);
|
BleedTimerTask.bleedOut(thisPlayer);
|
||||||
|
|
||||||
getProfile().scheduleAsyncSave();
|
if (syncSave) {
|
||||||
|
getProfile().save();
|
||||||
|
} else {
|
||||||
|
getProfile().scheduleAsyncSave();
|
||||||
|
}
|
||||||
|
|
||||||
UserManager.remove(thisPlayer);
|
UserManager.remove(thisPlayer);
|
||||||
ScoreboardManager.teardownPlayer(thisPlayer);
|
ScoreboardManager.teardownPlayer(thisPlayer);
|
||||||
|
@ -359,7 +359,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
mcMMOPlayer.logout();
|
mcMMOPlayer.logout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user