Fixed offline shops that are loaded after server startup.
Contributed by Sahar.
This commit is contained in:
@@ -40,6 +40,7 @@ import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
@@ -283,13 +284,9 @@ public class LoginServerThread extends Thread
|
||||
st.addAttribute(ServerStatus.SERVER_AGE, ServerStatus.SERVER_AGE_ALL);
|
||||
}
|
||||
sendPacket(st);
|
||||
if (L2World.getInstance().getPlayers().size() > 0)
|
||||
final List<String> playerList = L2World.getInstance().getPlayers().stream().filter(player -> !player.isInOfflineMode()).map(L2PcInstance::getAccountName).collect(Collectors.toList());
|
||||
if (!playerList.isEmpty())
|
||||
{
|
||||
final List<String> playerList = new ArrayList<>();
|
||||
for (L2PcInstance player : L2World.getInstance().getPlayers())
|
||||
{
|
||||
playerList.add(player.getAccountName());
|
||||
}
|
||||
sendPacket(new PlayerInGame(playerList));
|
||||
}
|
||||
break;
|
||||
|
@@ -26,7 +26,6 @@ import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.LoginServerThread;
|
||||
import com.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import com.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import com.l2jmobius.gameserver.model.L2ManufactureItem;
|
||||
@@ -232,7 +231,6 @@ public class OfflineTradersTable
|
||||
}
|
||||
|
||||
player.spawnMe(player.getX(), player.getY(), player.getZ());
|
||||
LoginServerThread.getInstance().addGameServerLogin(player.getAccountName(), client);
|
||||
try (PreparedStatement stm_items = con.prepareStatement(LOAD_OFFLINE_ITEMS))
|
||||
{
|
||||
stm_items.setInt(1, player.getObjectId());
|
||||
|
@@ -5929,7 +5929,8 @@ public final class L2PcInstance extends L2Playable
|
||||
|
||||
if (Config.OFFLINE_DISCONNECT_FINISHED && (privateStoreType == PrivateStoreType.NONE) && ((getClient() == null) || getClient().isDetached()))
|
||||
{
|
||||
deleteMe();
|
||||
IdFactory.getInstance().releaseId(getObjectId());
|
||||
Disconnection.of(this).storeMe().deleteMe();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -115,9 +115,12 @@ public final class L2GameClient extends ChannelInboundHandler<L2GameClient>
|
||||
LOGGER_ACCOUNTING.finer("Client Disconnected: " + ctx.channel());
|
||||
|
||||
LoginServerThread.getInstance().sendLogout(getAccountName());
|
||||
IdFactory.getInstance().releaseId(getObjectId());
|
||||
|
||||
Disconnection.of(this).onDisconnection();
|
||||
if ((_activeChar == null) || !_activeChar.isInOfflineMode())
|
||||
{
|
||||
IdFactory.getInstance().releaseId(getObjectId());
|
||||
Disconnection.of(this).onDisconnection();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -29,9 +29,13 @@ import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.commons.network.PacketWriter;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.ExperienceData;
|
||||
import com.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import com.l2jmobius.gameserver.model.CharSelectInfoPackage;
|
||||
import com.l2jmobius.gameserver.model.L2Clan;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import com.l2jmobius.gameserver.network.Disconnection;
|
||||
import com.l2jmobius.gameserver.network.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
|
||||
@@ -186,6 +190,13 @@ public class CharSelectionInfo implements IClientOutgoingPacket
|
||||
if (charInfopackage != null)
|
||||
{
|
||||
characterList.add(charInfopackage);
|
||||
|
||||
final L2PcInstance player = L2World.getInstance().getPlayer(charInfopackage.getObjectId());
|
||||
if (player != null)
|
||||
{
|
||||
IdFactory.getInstance().releaseId(player.getObjectId());
|
||||
Disconnection.of(player).storeMe().deleteMe();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.actor.L2Summon;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import com.l2jmobius.gameserver.network.Disconnection;
|
||||
import com.l2jmobius.gameserver.network.L2GameClient;
|
||||
|
||||
/**
|
||||
@@ -104,6 +103,7 @@ public final class OfflineTradeUtil
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
|
||||
final L2GameClient client = player.getClient();
|
||||
client.close(true);
|
||||
client.setDetached(true);
|
||||
|
||||
player.leaveParty();
|
||||
@@ -141,7 +141,7 @@ public final class OfflineTradeUtil
|
||||
OfflineTradersTable.onTransaction(player, false, true);
|
||||
}
|
||||
|
||||
Disconnection.of(player).storeMe().close(false);
|
||||
player.storeMe();
|
||||
LOGGER_ACCOUNTING.info("Entering offline mode, " + client);
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user