#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:
@@ -1,7 +1,6 @@
|
||||
package fr.xephi.authme.process.quit;
|
||||
|
||||
import fr.xephi.authme.data.limbo.LimboPlayerStorage;
|
||||
import fr.xephi.authme.data.limbo.LimboCache;
|
||||
import fr.xephi.authme.data.limbo.LimboService;
|
||||
import fr.xephi.authme.process.SynchronousProcess;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -11,22 +10,10 @@ import javax.inject.Inject;
|
||||
public class ProcessSyncronousPlayerQuit implements SynchronousProcess {
|
||||
|
||||
@Inject
|
||||
private LimboPlayerStorage limboPlayerStorage;
|
||||
|
||||
@Inject
|
||||
private LimboCache limboCache;
|
||||
private LimboService limboService;
|
||||
|
||||
public void processSyncQuit(Player player) {
|
||||
if (limboCache.hasPlayerData(player.getName())) { // it mean player is not authenticated
|
||||
limboCache.restoreData(player);
|
||||
limboCache.removeFromCache(player);
|
||||
} else {
|
||||
// Save player's data, so we could retrieve it later on player next join
|
||||
if (!limboPlayerStorage.hasData(player)) {
|
||||
limboPlayerStorage.saveData(player);
|
||||
}
|
||||
}
|
||||
|
||||
limboService.restoreData(player);
|
||||
player.leaveVehicle();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user