Merge 765-teleport-handling into jsoncache-fix
This commit is contained in:
@@ -52,6 +52,7 @@ public class AsynchronousLogout implements AsynchronousProcess {
|
||||
|
||||
limboCache.addPlayerData(player);
|
||||
playerCache.removePlayer(name);
|
||||
// TODO LJ: No more teleport here?
|
||||
database.setUnlogged(name);
|
||||
syncProcessManager.processSyncPlayerLogout(player);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import fr.xephi.authme.process.SyncProcessManager;
|
||||
import fr.xephi.authme.settings.SpawnLoader;
|
||||
import fr.xephi.authme.settings.properties.PluginSettings;
|
||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||
import fr.xephi.authme.util.BukkitService;
|
||||
import fr.xephi.authme.util.Utils;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -44,6 +45,9 @@ public class AsynchronousQuit implements AsynchronousProcess {
|
||||
@Inject
|
||||
private SpawnLoader spawnLoader;
|
||||
|
||||
@Inject
|
||||
private BukkitService bukkitService;
|
||||
|
||||
AsynchronousQuit() {
|
||||
}
|
||||
|
||||
@@ -76,7 +80,7 @@ public class AsynchronousQuit implements AsynchronousProcess {
|
||||
playerCache.removePlayer(name);
|
||||
|
||||
if (plugin.isEnabled() && service.getProperty(PluginSettings.SESSIONS_ENABLED)) {
|
||||
BukkitTask task = plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
||||
BukkitTask task = bukkitService.runTaskLaterAsynchronously(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@@ -2,6 +2,7 @@ package fr.xephi.authme.process.quit;
|
||||
|
||||
import fr.xephi.authme.cache.backup.PlayerDataStorage;
|
||||
import fr.xephi.authme.cache.limbo.LimboCache;
|
||||
import fr.xephi.authme.permission.AuthGroupHandler;
|
||||
import fr.xephi.authme.process.ProcessService;
|
||||
import fr.xephi.authme.process.SynchronousProcess;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -20,6 +21,9 @@ public class ProcessSyncronousPlayerQuit implements SynchronousProcess {
|
||||
@Inject
|
||||
private LimboCache limboCache;
|
||||
|
||||
@Inject
|
||||
private AuthGroupHandler authGroupHandler;
|
||||
|
||||
public void processSyncQuit(Player player) {
|
||||
if (limboCache.hasPlayerData(player.getName().toLowerCase())) { // it mean player is not authenticated
|
||||
limboCache.removeFromCache(player);
|
||||
|
||||
@@ -78,8 +78,6 @@ public class ProcessSyncPasswordRegister implements SynchronousProcess {
|
||||
*/
|
||||
private void requestLogin(Player player) {
|
||||
final String name = player.getName().toLowerCase();
|
||||
Utils.teleportToSpawn(player);
|
||||
|
||||
limboCache.updatePlayerData(player);
|
||||
playerDataTaskManager.registerTimeoutTask(player);
|
||||
playerDataTaskManager.registerMessageTask(name, true);
|
||||
@@ -92,7 +90,6 @@ public class ProcessSyncPasswordRegister implements SynchronousProcess {
|
||||
public void processPasswordRegister(Player player) {
|
||||
final String name = player.getName().toLowerCase();
|
||||
if (limboCache.hasPlayerData(name)) {
|
||||
teleportationService.teleportOnJoin(player);
|
||||
if (service.getProperty(PROTECT_INVENTORY_BEFORE_LOGIN)) {
|
||||
RestoreInventoryEvent event = new RestoreInventoryEvent(player);
|
||||
bukkitService.callEvent(event);
|
||||
|
||||
@@ -14,7 +14,7 @@ import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||
import fr.xephi.authme.task.PlayerDataTaskManager;
|
||||
import fr.xephi.authme.util.Utils;
|
||||
import fr.xephi.authme.util.TeleportationService;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
@@ -43,6 +43,9 @@ public class AsynchronousUnregister implements AsynchronousProcess {
|
||||
@Inject
|
||||
private PlayerDataTaskManager playerDataTaskManager;
|
||||
|
||||
@Inject
|
||||
private TeleportationService teleportationService;
|
||||
|
||||
AsynchronousUnregister() { }
|
||||
|
||||
|
||||
@@ -56,7 +59,7 @@ public class AsynchronousUnregister implements AsynchronousProcess {
|
||||
}
|
||||
|
||||
if (service.getProperty(RegistrationSettings.FORCE)) {
|
||||
Utils.teleportToSpawn(player);
|
||||
teleportationService.teleportOnJoin(player);
|
||||
player.saveData();
|
||||
playerCache.removePlayer(player.getName().toLowerCase());
|
||||
if (!Settings.getRegisteredGroup.isEmpty()) {
|
||||
@@ -68,7 +71,7 @@ public class AsynchronousUnregister implements AsynchronousProcess {
|
||||
playerDataTaskManager.registerMessageTask(name, false);
|
||||
|
||||
service.send(player, MessageKey.UNREGISTERED_SUCCESS);
|
||||
ConsoleLogger.info(player.getDisplayName() + " unregistered himself");
|
||||
ConsoleLogger.info(player.getName() + " unregistered himself");
|
||||
return; // TODO ljacqu 20160612: Why return here? No blind effect? Player not removed from PlayerCache?
|
||||
}
|
||||
if (!Settings.unRegisteredGroup.isEmpty()) {
|
||||
@@ -82,7 +85,7 @@ public class AsynchronousUnregister implements AsynchronousProcess {
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, timeout, 2));
|
||||
}
|
||||
service.send(player, MessageKey.UNREGISTERED_SUCCESS);
|
||||
ConsoleLogger.info(player.getDisplayName() + " unregistered himself");
|
||||
ConsoleLogger.info(player.getName() + " unregistered himself");
|
||||
} else {
|
||||
service.send(player, MessageKey.WRONG_PASSWORD);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user