- Remove unnecessary @Inject on field.

- Teleport player to spawn immediately on PlayerLoginEvent.
- Only save authenticated player's location on quit.
- Fix player's last location get reset if fail to login.
This commit is contained in:
DNx5
2016-06-29 20:25:01 +07:00
parent 609b148157
commit 22a4ef93bf
7 changed files with 88 additions and 62 deletions
@@ -4,12 +4,12 @@ import fr.xephi.authme.AuthMe;
import fr.xephi.authme.cache.SessionManager;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.cache.limbo.LimboCache;
import fr.xephi.authme.datasource.CacheDataSource;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.process.AsynchronousProcess;
import fr.xephi.authme.process.ProcessService;
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.Utils;
@@ -35,15 +35,15 @@ public class AsynchronousQuit implements AsynchronousProcess {
@Inject
private PlayerCache playerCache;
@Inject
private LimboCache limboCache;
@Inject
private SyncProcessManager syncProcessManager;
@Inject
private SessionManager sessionManager;
@Inject
private SpawnLoader spawnLoader;
AsynchronousQuit() {
}
@@ -55,10 +55,9 @@ public class AsynchronousQuit implements AsynchronousProcess {
final String name = player.getName().toLowerCase();
String ip = Utils.getPlayerIp(player);
if (playerCache.isAuthenticated(name)) {
if (service.getProperty(RestrictionSettings.SAVE_QUIT_LOCATION)) {
Location loc = player.getLocation();
Location loc = player.isDead() ? spawnLoader.getSpawnLocation(player) : player.getLocation();
PlayerAuth auth = PlayerAuth.builder()
.name(name).location(loc)
.realName(player.getName()).build();