-
Notifications
You must be signed in to change notification settings - Fork 557
Expand file tree
/
Copy pathProcessSyncPlayerQuit.java
More file actions
48 lines (38 loc) · 1.44 KB
/
ProcessSyncPlayerQuit.java
File metadata and controls
48 lines (38 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package fr.xephi.authme.process.quit;
import fr.xephi.authme.data.limbo.LimboService;
import fr.xephi.authme.process.SynchronousProcess;
import fr.xephi.authme.service.CommonService;
import fr.xephi.authme.service.SpectateLoginService;
import fr.xephi.authme.settings.commandconfig.CommandManager;
import fr.xephi.authme.settings.properties.RestrictionSettings;
import org.bukkit.entity.Player;
import javax.inject.Inject;
public class ProcessSyncPlayerQuit implements SynchronousProcess {
@Inject
private CommonService service;
@Inject
private LimboService limboService;
@Inject
private CommandManager commandManager;
@Inject
private SpectateLoginService spectateLoginService;
/**
* Processes a player having quit.
*
* @param player the player that left
* @param wasLoggedIn true if the player was logged in when leaving, false otherwise
*/
public void processSyncQuit(Player player, boolean wasLoggedIn) {
if (wasLoggedIn) {
commandManager.runCommandsOnLogout(player);
} else {
if (service.getProperty(RestrictionSettings.SPECTATE_STAND_LOGIN)
|| spectateLoginService.hasStand(player)) {
spectateLoginService.removeStand(player);
}
limboService.restoreData(player);
player.saveData(); // #1238: Speed is sometimes not restored properly
}
player.leaveVehicle();
}
}