mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-27 20:57:35 +01:00
Try to restore inventory after register
This commit is contained in:
parent
c3f314c491
commit
83b1055df0
@ -16,6 +16,7 @@ import fr.xephi.authme.cache.limbo.LimboPlayer;
|
||||
import fr.xephi.authme.events.AuthMeTeleportEvent;
|
||||
import fr.xephi.authme.events.LoginEvent;
|
||||
import fr.xephi.authme.events.RegisterTeleportEvent;
|
||||
import fr.xephi.authme.events.RestoreInventoryEvent;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
import fr.xephi.authme.settings.PlayersLogs;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
@ -95,6 +96,14 @@ public class ProcessSyncronousPasswordRegister implements Runnable {
|
||||
player.teleport(tpEvent.getTo());
|
||||
}
|
||||
}
|
||||
if (Settings.protectInventoryBeforeLogInEnabled && limbo.getInventory() != null && limbo.getArmour() != null) {
|
||||
RestoreInventoryEvent event = new RestoreInventoryEvent(player, limbo.getInventory(), limbo.getArmour());
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled() && event.getArmor() != null && event.getInventory() != null) {
|
||||
player.getInventory().setContents(event.getInventory());
|
||||
player.getInventory().setArmorContents(event.getArmor());
|
||||
}
|
||||
}
|
||||
limbo.getTimeoutTaskId().cancel();
|
||||
limbo.getMessageTaskId().cancel();
|
||||
LimboCache.getInstance().deleteLimboPlayer(name);
|
||||
|
Loading…
Reference in New Issue
Block a user