#1113 Handle LimboPlayer tasks via LimboService

- Add methods to LimboService for handling messages to make it the only relevant Limbo class for outside classes
  - Move LimboPlayerTaskManager to limbo package and make it package-private
- Create MessageTask and TimeoutTask immediately when LimboPlayer is created
- #1112 MessageTask: improve efficiency by keeping reference to Player
This commit is contained in:
ljacqu
2017-03-07 20:35:48 +01:00
parent 021497b9e6
commit 4bb10c5d6d
15 changed files with 207 additions and 269 deletions
@@ -2,9 +2,9 @@ package fr.xephi.authme.command.executable.captcha;
import fr.xephi.authme.data.CaptchaManager;
import fr.xephi.authme.data.auth.PlayerCache;
import fr.xephi.authme.data.limbo.LimboService;
import fr.xephi.authme.message.MessageKey;
import fr.xephi.authme.service.CommonService;
import fr.xephi.authme.task.LimboPlayerTaskManager;
import org.bukkit.entity.Player;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -38,7 +38,7 @@ public class CaptchaCommandTest {
private CommonService commandService;
@Mock
private LimboPlayerTaskManager limboPlayerTaskManager;
private LimboService limboService;
@Test
public void shouldDetectIfPlayerIsLoggedIn() {
@@ -90,7 +90,7 @@ public class CaptchaCommandTest {
verifyNoMoreInteractions(captchaManager);
verify(commandService).send(player, MessageKey.CAPTCHA_SUCCESS);
verify(commandService).send(player, MessageKey.LOGIN_MESSAGE);
verify(limboPlayerTaskManager).unmuteMessageTask(player);
verify(limboService).unmuteMessageTask(player);
verifyNoMoreInteractions(commandService);
}