Dropped player count manager.
This commit is contained in:
@ -25,7 +25,6 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.LoginServerThread;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.ManufactureItem;
|
||||
import org.l2jmobius.gameserver.model.ManufactureList;
|
||||
import org.l2jmobius.gameserver.model.TradeList.TradeItem;
|
||||
@ -34,6 +33,7 @@ import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.GameClient.GameClientState;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
/**
|
||||
* @author Shyla
|
||||
@ -275,7 +275,6 @@ public class OfflineTradeTable
|
||||
player.setOnlineStatus(true);
|
||||
player.restoreEffects();
|
||||
player.broadcastUserInfo();
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
nTraders++;
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -289,6 +288,7 @@ public class OfflineTradeTable
|
||||
}
|
||||
rs.close();
|
||||
stm.close();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT = nTraders;
|
||||
LOGGER.info("Loaded " + nTraders + " offline traders.");
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -20,11 +20,11 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.l2jmobius.gameserver.handler.IAdminCommandHandler;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
import org.l2jmobius.gameserver.util.BuilderUtil;
|
||||
|
||||
/**
|
||||
@ -95,7 +95,7 @@ public class AdminOnline implements IAdminCommandHandler
|
||||
BuilderUtil.sendSysMessage(activeChar, "Total count: " + total);
|
||||
BuilderUtil.sendSysMessage(activeChar, "Total online: " + online);
|
||||
BuilderUtil.sendSysMessage(activeChar, "Total offline: " + offline);
|
||||
BuilderUtil.sendSysMessage(activeChar, "Max connected: " + PlayerCountManager.getInstance().getMaxConnectedCount());
|
||||
BuilderUtil.sendSysMessage(activeChar, "Max connected: " + SystemPanel.MAX_CONNECTED_COUNT);
|
||||
BuilderUtil.sendSysMessage(activeChar, "Unique IPs: " + ips.size());
|
||||
BuilderUtil.sendSysMessage(activeChar, "In peace zone: " + peace);
|
||||
BuilderUtil.sendSysMessage(activeChar, "Not in peace zone: " + notPeace);
|
||||
|
@ -1,77 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.instancemanager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class PlayerCountManager
|
||||
{
|
||||
private static volatile int connectedCount = 0;
|
||||
private static volatile int maxConnectedCount = 0;
|
||||
private static volatile int offlineTradeCount = 0;
|
||||
|
||||
protected PlayerCountManager()
|
||||
{
|
||||
}
|
||||
|
||||
public int getConnectedCount()
|
||||
{
|
||||
return connectedCount;
|
||||
}
|
||||
|
||||
public int getMaxConnectedCount()
|
||||
{
|
||||
return maxConnectedCount;
|
||||
}
|
||||
|
||||
public int getOfflineTradeCount()
|
||||
{
|
||||
return offlineTradeCount;
|
||||
}
|
||||
|
||||
public synchronized void incConnectedCount()
|
||||
{
|
||||
connectedCount++;
|
||||
maxConnectedCount = Math.max(maxConnectedCount, connectedCount);
|
||||
}
|
||||
|
||||
public void decConnectedCount()
|
||||
{
|
||||
connectedCount--;
|
||||
}
|
||||
|
||||
public void incOfflineTradeCount()
|
||||
{
|
||||
offlineTradeCount++;
|
||||
}
|
||||
|
||||
public synchronized void decOfflineTradeCount()
|
||||
{
|
||||
offlineTradeCount = Math.max(0, offlineTradeCount - 1);
|
||||
}
|
||||
|
||||
public static PlayerCountManager getInstance()
|
||||
{
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final PlayerCountManager INSTANCE = new PlayerCountManager();
|
||||
}
|
||||
}
|
@ -23,10 +23,10 @@ import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.21.2.5.2.7 $ $Date: 2005/03/27 15:29:32 $
|
||||
@ -286,8 +286,6 @@ public class World
|
||||
{
|
||||
if (object instanceof PlayerInstance)
|
||||
{
|
||||
PlayerCountManager.getInstance().incConnectedCount();
|
||||
|
||||
final PlayerInstance player = (PlayerInstance) object;
|
||||
final PlayerInstance tmp = _allPlayers.get(player.getName().toLowerCase());
|
||||
if ((tmp != null) && (tmp != player)) // just kick the player previous instance
|
||||
@ -446,10 +444,9 @@ public class World
|
||||
// If selected WorldObject is a NcIntance, remove it from WorldObjectHashSet(PlayerInstance) _allPlayers of World
|
||||
if (object instanceof PlayerInstance)
|
||||
{
|
||||
PlayerCountManager.getInstance().decConnectedCount();
|
||||
if (object.getActingPlayer().isInOfflineMode())
|
||||
{
|
||||
PlayerCountManager.getInstance().decOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT--;
|
||||
}
|
||||
|
||||
if (!((PlayerInstance) object).isTeleporting())
|
||||
|
@ -83,7 +83,6 @@ import org.l2jmobius.gameserver.instancemanager.DuelManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.FishingZoneManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.FortSiegeManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.QuestManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
|
||||
import org.l2jmobius.gameserver.model.AccessLevel;
|
||||
@ -226,6 +225,7 @@ import org.l2jmobius.gameserver.network.serverpackets.TradePressOwnOk;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.TradeStart;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.UserInfo;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
import org.l2jmobius.gameserver.util.Broadcast;
|
||||
import org.l2jmobius.gameserver.util.FloodProtectors;
|
||||
import org.l2jmobius.gameserver.util.IllegalPlayerAction;
|
||||
@ -7473,7 +7473,7 @@ public class PlayerInstance extends Playable
|
||||
store();
|
||||
if (Config.OFFLINE_DISCONNECT_FINISHED)
|
||||
{
|
||||
PlayerCountManager.getInstance().decOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT--;
|
||||
deleteMe();
|
||||
|
||||
if (_client != null)
|
||||
|
@ -41,7 +41,6 @@ import org.l2jmobius.gameserver.LoginServerThread.SessionKey;
|
||||
import org.l2jmobius.gameserver.datatables.OfflineTradeTable;
|
||||
import org.l2jmobius.gameserver.datatables.SkillTable;
|
||||
import org.l2jmobius.gameserver.datatables.sql.ClanTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.CharSelectInfoPackage;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
@ -56,6 +55,7 @@ import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.GameServerPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ServerClose;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
import org.l2jmobius.gameserver.util.EventData;
|
||||
import org.l2jmobius.gameserver.util.FloodProtectors;
|
||||
|
||||
@ -752,7 +752,7 @@ public class GameClient extends MMOClient<MMOConnection<GameClient>> implements
|
||||
}
|
||||
|
||||
OfflineTradeTable.storeOffliner(player);
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT++;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ import javax.swing.border.LineBorder;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.GameServer;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.util.Locator;
|
||||
|
||||
/**
|
||||
@ -39,7 +39,10 @@ import org.l2jmobius.gameserver.util.Locator;
|
||||
*/
|
||||
public class SystemPanel extends JPanel
|
||||
{
|
||||
static final long START_TIME = System.currentTimeMillis();
|
||||
private static final long START_TIME = System.currentTimeMillis();
|
||||
|
||||
public static volatile int MAX_CONNECTED_COUNT = 0;
|
||||
public static volatile int OFFLINE_TRADE_COUNT = 0;
|
||||
|
||||
public SystemPanel()
|
||||
{
|
||||
@ -128,9 +131,14 @@ public class SystemPanel extends JPanel
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
lblConnected.setText("Connected: " + PlayerCountManager.getInstance().getConnectedCount());
|
||||
lblMaxConnected.setText("Max connected: " + PlayerCountManager.getInstance().getMaxConnectedCount());
|
||||
lblOfflineShops.setText("Offline trade: " + PlayerCountManager.getInstance().getOfflineTradeCount());
|
||||
final int playerCount = World.getInstance().getAllPlayers().size();
|
||||
if (MAX_CONNECTED_COUNT < playerCount)
|
||||
{
|
||||
MAX_CONNECTED_COUNT = playerCount;
|
||||
}
|
||||
lblConnected.setText("Connected: " + playerCount);
|
||||
lblMaxConnected.setText("Max connected: " + MAX_CONNECTED_COUNT);
|
||||
lblOfflineShops.setText("Offline trade: " + OFFLINE_TRADE_COUNT);
|
||||
lblElapsedTime.setText("Elapsed: " + getDurationBreakdown(System.currentTimeMillis() - START_TIME));
|
||||
}
|
||||
}, 1000, 1000);
|
||||
|
Reference in New Issue
Block a user