#1113 Create LimboService (work in progress)

- Introduce new LimboService with a higher level abstraction for outside classes to trigger LimboPlayer actions
- Add methods to LimboPlayerTaskManager for muting the MessagesTask safely
This commit is contained in:
ljacqu
2017-03-05 19:25:35 +01:00
parent 6db778387d
commit 22ccf582b8
21 changed files with 171 additions and 115 deletions
@@ -1,8 +1,8 @@
package fr.xephi.authme.process.login;
import fr.xephi.authme.data.auth.PlayerAuth;
import fr.xephi.authme.data.limbo.LimboCache;
import fr.xephi.authme.data.limbo.LimboPlayer;
import fr.xephi.authme.data.limbo.LimboService;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.events.LoginEvent;
import fr.xephi.authme.events.RestoreInventoryEvent;
@@ -31,7 +31,7 @@ public class ProcessSyncPlayerLogin implements SynchronousProcess {
private BungeeService bungeeService;
@Inject
private LimboCache limboCache;
private LimboService limboService;
@Inject
private BukkitService bukkitService;
@@ -65,14 +65,14 @@ public class ProcessSyncPlayerLogin implements SynchronousProcess {
public void processPlayerLogin(Player player) {
final String name = player.getName().toLowerCase();
final LimboPlayer limbo = limboCache.getPlayerData(name);
final LimboPlayer limbo = limboService.getLimboPlayer(name);
// Limbo contains the State of the Player before /login
if (limbo != null) {
limboCache.restoreData(player);
limboCache.deletePlayerData(player);
limboService.restoreData(player);
// do we really need to use location from database for now?
// because LimboCache#restoreData teleport player to last location.
}
// TODO #1113: Need to set group before deleting limboPlayer??
commonService.setGroup(player, AuthGroupType.LOGGED_IN);
if (commonService.getProperty(PROTECT_INVENTORY_BEFORE_LOGIN)) {