mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-09-06 20:28:06 +02:00
Fix possible race condition on login processing
(Fixes Xephi/AuthMeReloaded#619)
This commit is contained in:
parent
2f850eed08
commit
bea43b3140
@ -103,12 +103,12 @@ public class AuthMeInventoryPacketAdapter extends PacketAdapter {
|
||||
|
||||
ItemStack[] completeInventory = new ItemStack[inventorySize];
|
||||
|
||||
System.arraycopy(playerCrafting, 0, completeInventory, 0, playerCrafting.length);
|
||||
System.arraycopy(armorContents, 0, completeInventory, CRAFTING_SIZE, armorContents.length);
|
||||
System.arraycopy(playerCrafting, 0, completeInventory, 0, CRAFTING_SIZE);
|
||||
System.arraycopy(armorContents, 0, completeInventory, CRAFTING_SIZE, ARMOR_SIZE);
|
||||
|
||||
// storedInventory and hotbar
|
||||
System.arraycopy(storedInventory, 0, completeInventory, CRAFTING_SIZE + ARMOR_SIZE, storedInventory.length);
|
||||
System.arraycopy(hotbar, 0, completeInventory, CRAFTING_SIZE + ARMOR_SIZE + MAIN_SIZE, hotbar.length);
|
||||
System.arraycopy(storedInventory, 0, completeInventory, CRAFTING_SIZE + ARMOR_SIZE, MAIN_SIZE);
|
||||
System.arraycopy(hotbar, 0, completeInventory, CRAFTING_SIZE + ARMOR_SIZE + MAIN_SIZE, HOTBAR_SIZE);
|
||||
|
||||
if (offHandSupported) {
|
||||
completeInventory[OFF_HAND_POSITION] = player.getInventory().getItemInOffHand();
|
||||
|
@ -5,6 +5,7 @@ import fr.xephi.authme.ConsoleLogger;
|
||||
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.cache.limbo.LimboPlayer;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.events.AuthMeAsyncPreLoginEvent;
|
||||
import fr.xephi.authme.output.MessageKey;
|
||||
@ -88,14 +89,16 @@ public class AsynchronousLogin implements Process {
|
||||
PlayerAuth pAuth = database.getAuth(name);
|
||||
if (pAuth == null) {
|
||||
service.send(player, MessageKey.USER_NOT_REGISTERED);
|
||||
if (LimboCache.getInstance().hasLimboPlayer(name)) {
|
||||
LimboCache.getInstance().getLimboPlayer(name).getMessageTask().cancel();
|
||||
|
||||
LimboPlayer limboPlayer = LimboCache.getInstance().getLimboPlayer(name);
|
||||
if (limboPlayer != null) {
|
||||
limboPlayer.getMessageTask().cancel();
|
||||
String[] msg = service.getProperty(RegistrationSettings.USE_EMAIL_REGISTRATION)
|
||||
? service.retrieveMessage(MessageKey.REGISTER_EMAIL_MESSAGE)
|
||||
: service.retrieveMessage(MessageKey.REGISTER_MESSAGE);
|
||||
BukkitTask messageTask = service.runTask(
|
||||
new MessageTask(plugin, name, msg, service.getProperty(RegistrationSettings.MESSAGE_INTERVAL)));
|
||||
LimboCache.getInstance().getLimboPlayer(name).setMessageTask(messageTask);
|
||||
limboPlayer.setMessageTask(messageTask);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user