#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:
@@ -3,18 +3,18 @@ package fr.xephi.authme.process.login;
|
||||
import fr.xephi.authme.TestHelper;
|
||||
import fr.xephi.authme.data.auth.PlayerAuth;
|
||||
import fr.xephi.authme.data.auth.PlayerCache;
|
||||
import fr.xephi.authme.data.limbo.LimboService;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.events.AuthMeAsyncPreLoginEvent;
|
||||
import fr.xephi.authme.message.MessageKey;
|
||||
import fr.xephi.authme.permission.PermissionsManager;
|
||||
import fr.xephi.authme.permission.PlayerStatePermission;
|
||||
import fr.xephi.authme.service.CommonService;
|
||||
import fr.xephi.authme.service.BukkitService;
|
||||
import fr.xephi.authme.service.CommonService;
|
||||
import fr.xephi.authme.settings.properties.DatabaseSettings;
|
||||
import fr.xephi.authme.settings.properties.HooksSettings;
|
||||
import fr.xephi.authme.settings.properties.PluginSettings;
|
||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||
import fr.xephi.authme.task.LimboPlayerTaskManager;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
@@ -58,7 +58,7 @@ public class AsynchronousLoginTest {
|
||||
@Mock
|
||||
private CommonService commonService;
|
||||
@Mock
|
||||
private LimboPlayerTaskManager limboPlayerTaskManager;
|
||||
private LimboService limboService;
|
||||
@Mock
|
||||
private BukkitService bukkitService;
|
||||
@Mock
|
||||
|
||||
@@ -14,7 +14,6 @@ import fr.xephi.authme.service.BukkitService;
|
||||
import fr.xephi.authme.service.CommonService;
|
||||
import fr.xephi.authme.service.TeleportationService;
|
||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||
import fr.xephi.authme.task.LimboPlayerTaskManager;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.junit.BeforeClass;
|
||||
@@ -54,8 +53,6 @@ public class AsynchronousUnregisterTest {
|
||||
@Mock
|
||||
private LimboService limboService;
|
||||
@Mock
|
||||
private LimboPlayerTaskManager limboPlayerTaskManager;
|
||||
@Mock
|
||||
private TeleportationService teleportationService;
|
||||
@Mock
|
||||
private AuthGroupHandler authGroupHandler;
|
||||
@@ -84,7 +81,7 @@ public class AsynchronousUnregisterTest {
|
||||
// then
|
||||
verify(service).send(player, MessageKey.WRONG_PASSWORD);
|
||||
verify(passwordSecurity).comparePassword(userPassword, password, name);
|
||||
verifyZeroInteractions(dataSource, limboPlayerTaskManager, limboService, authGroupHandler, teleportationService);
|
||||
verifyZeroInteractions(dataSource, limboService, authGroupHandler, teleportationService);
|
||||
verify(player, only()).getName();
|
||||
}
|
||||
|
||||
@@ -170,7 +167,7 @@ public class AsynchronousUnregisterTest {
|
||||
verify(dataSource).removeAuth(name);
|
||||
verify(playerCache).removePlayer(name);
|
||||
verify(authGroupHandler).setGroup(player, AuthGroupType.UNREGISTERED);
|
||||
verifyZeroInteractions(teleportationService, limboPlayerTaskManager);
|
||||
verifyZeroInteractions(teleportationService, limboService);
|
||||
verify(bukkitService, never()).runTask(any(Runnable.class));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user