- send blank inventory on logout if protect inventory is enabled.
- added reload support for protect inventory option.
This commit is contained in:
@@ -46,8 +46,9 @@ public class AsynchronousLogout {
|
||||
|
||||
public void process() {
|
||||
preLogout();
|
||||
if (!canLogout)
|
||||
if (!canLogout) {
|
||||
return;
|
||||
}
|
||||
final Player p = player;
|
||||
BukkitScheduler scheduler = p.getServer().getScheduler();
|
||||
PlayerAuth auth = PlayerCache.getInstance().getAuth(name);
|
||||
@@ -66,11 +67,11 @@ public class AsynchronousLogout {
|
||||
Utils.teleportToSpawn(p);
|
||||
}
|
||||
});
|
||||
if (LimboCache.getInstance().hasLimboPlayer(name))
|
||||
if (LimboCache.getInstance().hasLimboPlayer(name)) {
|
||||
LimboCache.getInstance().deleteLimboPlayer(name);
|
||||
}
|
||||
LimboCache.getInstance().addLimboPlayer(player);
|
||||
Utils.setGroup(player, GroupType.NOTLOGGEDIN);
|
||||
|
||||
scheduler.scheduleSyncDelayedTask(plugin, new ProcessSyncronousPlayerLogout(p, plugin));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,14 +43,18 @@ public class ProcessSyncronousPlayerLogout implements Runnable {
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
if (plugin.sessions.containsKey(name))
|
||||
if (plugin.sessions.containsKey(name)) {
|
||||
plugin.sessions.get(name).cancel();
|
||||
plugin.sessions.remove(name);
|
||||
int delay = Settings.getRegistrationTimeout * 20;
|
||||
plugin.sessions.remove(name);
|
||||
}
|
||||
if (Settings.protectInventoryBeforeLogInEnabled) {
|
||||
plugin.inventoryProtector.sendBlankInventoryPacket(player);
|
||||
}
|
||||
int timeOut = Settings.getRegistrationTimeout * 20;
|
||||
int interval = Settings.getWarnMessageInterval;
|
||||
BukkitScheduler sched = player.getServer().getScheduler();
|
||||
if (delay != 0) {
|
||||
BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), delay);
|
||||
if (timeOut != 0) {
|
||||
BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), timeOut);
|
||||
LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id);
|
||||
}
|
||||
BukkitTask msgT = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), interval));
|
||||
|
||||
Reference in New Issue
Block a user