This commit is contained in:
Gabriele C 2017-10-23 08:36:49 +02:00
parent cd85c51fbe
commit 39647013b2
5 changed files with 10 additions and 22 deletions

View File

@ -50,9 +50,8 @@ public class LimboService {
*
* @param player the player to process
* @param isRegistered whether or not the player is registered
* @param location the desired player location
*/
public void createLimboPlayer(Player player, boolean isRegistered, Location location) {
public void createLimboPlayer(Player player, boolean isRegistered) {
final String name = player.getName().toLowerCase();
LimboPlayer limboFromDisk = persistence.getLimboPlayer(player);
@ -66,6 +65,7 @@ public class LimboService {
ConsoleLogger.debug("LimboPlayer for `{0}` already present in memory", name);
}
Location location = spawnLoader.getPlayerLocationOrSpawn(player);
LimboPlayer limboPlayer = helper.merge(existingLimbo, limboFromDisk);
limboPlayer = helper.merge(helper.createLimboPlayer(player, isRegistered, location), limboPlayer);
@ -78,16 +78,6 @@ public class LimboService {
persistence.saveLimboPlayer(player, limboPlayer);
}
/**
* Creates a LimboPlayer for the given player and revokes all "limbo data" from the player.
*
* @param player the player to process
* @param isRegistered whether or not the player is registered
*/
public void createLimboPlayer(Player player, boolean isRegistered) {
createLimboPlayer(player, isRegistered, spawnLoader.getPlayerLocationOrSpawn(player));
}
/**
* Returns the limbo player for the given name, or null otherwise.
*

View File

@ -198,7 +198,7 @@ public class PlayerListener implements Listener {
if (!PlayerListener19Spigot.isPlayerSpawnLocationEventCalled()) {
teleportationService.teleportOnJoin(player);
}
management.performJoin(player, player.getLocation());
management.performJoin(player);
teleportationService.teleportNewPlayerToFirstSpawn(player);
}

View File

@ -74,8 +74,8 @@ public class Management {
runTask(() -> asynchronousUnregister.adminUnregister(initiator, name, player));
}
public void performJoin(Player player, Location location) {
runTask(() -> asynchronousJoin.processJoin(player, location));
public void performJoin(Player player) {
runTask(() -> asynchronousJoin.processJoin(player));
}
public void performQuit(Player player) {

View File

@ -76,9 +76,8 @@ public class AsynchronousJoin implements AsynchronousProcess {
* Processes the given player that has just joined.
*
* @param player the player to process
* @param location the desired player location, null if you want to use the current one
*/
public void processJoin(final Player player, Location location) {
public void processJoin(final Player player) {
final String name = player.getName().toLowerCase();
final String ip = PlayerUtils.getPlayerIp(player);
@ -135,7 +134,7 @@ public class AsynchronousJoin implements AsynchronousProcess {
return;
}
processJoinSync(player, isAuthAvailable, location);
processJoinSync(player, isAuthAvailable);
}
private void handlePlayerWithUnmetNameRestriction(Player player, String ip) {
@ -153,13 +152,12 @@ public class AsynchronousJoin implements AsynchronousProcess {
*
* @param player the player to process
* @param isAuthAvailable true if the player is registered, false otherwise
* @param location the desired player location, null if you want to use the current one
*/
private void processJoinSync(Player player, boolean isAuthAvailable, Location location) {
private void processJoinSync(Player player, boolean isAuthAvailable) {
final int registrationTimeout = service.getProperty(RestrictionSettings.TIMEOUT) * TICKS_PER_SECOND;
bukkitService.scheduleSyncTaskFromOptionallyAsyncTask(() -> {
limboService.createLimboPlayer(player, isAuthAvailable, location);
limboService.createLimboPlayer(player, isAuthAvailable);
player.setNoDamageTicks(registrationTimeout);
if (pluginHookService.isEssentialsAvailable() && service.getProperty(HooksSettings.USE_ESSENTIALS_MOTD)) {

View File

@ -496,7 +496,7 @@ public class PlayerListenerTest {
// then
verify(teleportationService).teleportNewPlayerToFirstSpawn(player);
verify(management).performJoin(player, player.getLocation());
verify(management).performJoin(player);
}
@Test