Dropped player count manager.
This commit is contained in:
parent
755e00e30e
commit
38cb67fad2
@ -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;
|
||||
|
||||
/**
|
||||
@ -93,7 +93,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);
|
||||
|
@ -27,7 +27,6 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.ManufactureItem;
|
||||
import org.l2jmobius.gameserver.model.TradeItem;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
@ -35,6 +34,7 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.holders.SellBuffHolder;
|
||||
import org.l2jmobius.gameserver.network.Disconnection;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
public class OfflineTraderTable
|
||||
{
|
||||
@ -294,7 +294,6 @@ public class OfflineTraderTable
|
||||
player.setOnlineStatus(true, true);
|
||||
player.restoreEffects();
|
||||
player.broadcastUserInfo();
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
nTraders++;
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -307,7 +306,9 @@ public class OfflineTraderTable
|
||||
}
|
||||
}
|
||||
|
||||
SystemPanel.OFFLINE_TRADE_COUNT = nTraders;
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + nTraders + " offline traders.");
|
||||
|
||||
if (!Config.STORE_OFFLINE_TRADE_IN_REALTIME)
|
||||
{
|
||||
try (Statement stm1 = con.createStatement())
|
||||
@ -446,7 +447,7 @@ public class OfflineTraderTable
|
||||
|
||||
public static synchronized void removeTrader(int traderObjId)
|
||||
{
|
||||
PlayerCountManager.getInstance().decOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT--;
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
@ -32,7 +32,6 @@ import org.l2jmobius.gameserver.ai.CreatureAI;
|
||||
import org.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
@ -149,8 +148,6 @@ public class World
|
||||
|
||||
if (object.isPlayer())
|
||||
{
|
||||
PlayerCountManager.getInstance().incConnectedCount();
|
||||
|
||||
final PlayerInstance newPlayer = (PlayerInstance) object;
|
||||
if (newPlayer.isTeleporting()) // TODO: Drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
@ -187,8 +184,6 @@ public class World
|
||||
_allObjects.remove(object.getObjectId());
|
||||
if (object.isPlayer())
|
||||
{
|
||||
PlayerCountManager.getInstance().decConnectedCount();
|
||||
|
||||
final PlayerInstance player = (PlayerInstance) object;
|
||||
if (player.isTeleporting()) // TODO: Drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
@ -121,9 +124,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().getPlayers().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);
|
||||
|
@ -20,12 +20,12 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.OfflineTraderTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
/**
|
||||
* @author lord_rex
|
||||
@ -100,7 +100,7 @@ public class OfflineTradeUtil
|
||||
return false;
|
||||
}
|
||||
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT++;
|
||||
|
||||
final GameClient client = player.getClient();
|
||||
client.close(true);
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
@ -93,7 +93,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);
|
||||
|
@ -27,7 +27,6 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.ManufactureItem;
|
||||
import org.l2jmobius.gameserver.model.TradeItem;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
@ -35,6 +34,7 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.holders.SellBuffHolder;
|
||||
import org.l2jmobius.gameserver.network.Disconnection;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
public class OfflineTraderTable
|
||||
{
|
||||
@ -294,7 +294,6 @@ public class OfflineTraderTable
|
||||
player.setOnlineStatus(true, true);
|
||||
player.restoreEffects();
|
||||
player.broadcastUserInfo();
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
nTraders++;
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -307,7 +306,9 @@ public class OfflineTraderTable
|
||||
}
|
||||
}
|
||||
|
||||
SystemPanel.OFFLINE_TRADE_COUNT = nTraders;
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + nTraders + " offline traders.");
|
||||
|
||||
if (!Config.STORE_OFFLINE_TRADE_IN_REALTIME)
|
||||
{
|
||||
try (Statement stm1 = con.createStatement())
|
||||
@ -446,7 +447,7 @@ public class OfflineTraderTable
|
||||
|
||||
public static synchronized void removeTrader(int traderObjId)
|
||||
{
|
||||
PlayerCountManager.getInstance().decOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT--;
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
@ -32,7 +32,6 @@ import org.l2jmobius.gameserver.ai.CreatureAI;
|
||||
import org.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
@ -149,8 +148,6 @@ public class World
|
||||
|
||||
if (object.isPlayer())
|
||||
{
|
||||
PlayerCountManager.getInstance().incConnectedCount();
|
||||
|
||||
final PlayerInstance newPlayer = (PlayerInstance) object;
|
||||
if (newPlayer.isTeleporting()) // TODO: Drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
@ -187,8 +184,6 @@ public class World
|
||||
_allObjects.remove(object.getObjectId());
|
||||
if (object.isPlayer())
|
||||
{
|
||||
PlayerCountManager.getInstance().decConnectedCount();
|
||||
|
||||
final PlayerInstance player = (PlayerInstance) object;
|
||||
if (player.isTeleporting()) // TODO: Drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
@ -121,9 +124,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().getPlayers().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);
|
||||
|
@ -20,12 +20,12 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.OfflineTraderTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
/**
|
||||
* @author lord_rex
|
||||
@ -100,7 +100,7 @@ public class OfflineTradeUtil
|
||||
return false;
|
||||
}
|
||||
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT++;
|
||||
|
||||
final GameClient client = player.getClient();
|
||||
client.close(true);
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
@ -93,7 +93,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);
|
||||
|
@ -27,7 +27,6 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.ManufactureItem;
|
||||
import org.l2jmobius.gameserver.model.TradeItem;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
@ -35,6 +34,7 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.holders.SellBuffHolder;
|
||||
import org.l2jmobius.gameserver.network.Disconnection;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
public class OfflineTraderTable
|
||||
{
|
||||
@ -294,7 +294,6 @@ public class OfflineTraderTable
|
||||
player.setOnlineStatus(true, true);
|
||||
player.restoreEffects();
|
||||
player.broadcastUserInfo();
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
nTraders++;
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -307,7 +306,9 @@ public class OfflineTraderTable
|
||||
}
|
||||
}
|
||||
|
||||
SystemPanel.OFFLINE_TRADE_COUNT = nTraders;
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + nTraders + " offline traders.");
|
||||
|
||||
if (!Config.STORE_OFFLINE_TRADE_IN_REALTIME)
|
||||
{
|
||||
try (Statement stm1 = con.createStatement())
|
||||
@ -446,7 +447,7 @@ public class OfflineTraderTable
|
||||
|
||||
public static synchronized void removeTrader(int traderObjId)
|
||||
{
|
||||
PlayerCountManager.getInstance().decOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT--;
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
@ -32,7 +32,6 @@ import org.l2jmobius.gameserver.ai.CreatureAI;
|
||||
import org.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
@ -149,8 +148,6 @@ public class World
|
||||
|
||||
if (object.isPlayer())
|
||||
{
|
||||
PlayerCountManager.getInstance().incConnectedCount();
|
||||
|
||||
final PlayerInstance newPlayer = (PlayerInstance) object;
|
||||
if (newPlayer.isTeleporting()) // TODO: Drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
@ -187,8 +184,6 @@ public class World
|
||||
_allObjects.remove(object.getObjectId());
|
||||
if (object.isPlayer())
|
||||
{
|
||||
PlayerCountManager.getInstance().decConnectedCount();
|
||||
|
||||
final PlayerInstance player = (PlayerInstance) object;
|
||||
if (player.isTeleporting()) // TODO: Drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
@ -121,9 +124,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().getPlayers().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);
|
||||
|
@ -20,12 +20,12 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.OfflineTraderTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
/**
|
||||
* @author lord_rex
|
||||
@ -100,7 +100,7 @@ public class OfflineTradeUtil
|
||||
return false;
|
||||
}
|
||||
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT++;
|
||||
|
||||
final GameClient client = player.getClient();
|
||||
client.close(true);
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
@ -93,7 +93,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);
|
||||
|
@ -30,13 +30,13 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.TradeItem;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.holders.SellBuffHolder;
|
||||
import org.l2jmobius.gameserver.network.Disconnection;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
public class OfflineTraderTable
|
||||
{
|
||||
@ -298,7 +298,6 @@ public class OfflineTraderTable
|
||||
player.setOnlineStatus(true, true);
|
||||
player.restoreEffects();
|
||||
player.broadcastUserInfo();
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
nTraders++;
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -311,7 +310,9 @@ public class OfflineTraderTable
|
||||
}
|
||||
}
|
||||
|
||||
SystemPanel.OFFLINE_TRADE_COUNT = nTraders;
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + nTraders + " offline traders.");
|
||||
|
||||
if (!Config.STORE_OFFLINE_TRADE_IN_REALTIME)
|
||||
{
|
||||
try (Statement stm1 = con.createStatement())
|
||||
@ -450,7 +451,7 @@ public class OfflineTraderTable
|
||||
|
||||
public static synchronized void removeTrader(int traderObjId)
|
||||
{
|
||||
PlayerCountManager.getInstance().decOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT--;
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
@ -32,7 +32,6 @@ import org.l2jmobius.gameserver.ai.CreatureAI;
|
||||
import org.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
@ -149,8 +148,6 @@ public class World
|
||||
|
||||
if (object.isPlayer())
|
||||
{
|
||||
PlayerCountManager.getInstance().incConnectedCount();
|
||||
|
||||
final PlayerInstance newPlayer = (PlayerInstance) object;
|
||||
if (newPlayer.isTeleporting()) // TODO: Drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
@ -187,8 +184,6 @@ public class World
|
||||
_allObjects.remove(object.getObjectId());
|
||||
if (object.isPlayer())
|
||||
{
|
||||
PlayerCountManager.getInstance().decConnectedCount();
|
||||
|
||||
final PlayerInstance player = (PlayerInstance) object;
|
||||
if (player.isTeleporting()) // TODO: Drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
@ -121,9 +124,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().getPlayers().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);
|
||||
|
@ -20,12 +20,12 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.OfflineTraderTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
/**
|
||||
* @author lord_rex
|
||||
@ -100,7 +100,7 @@ public class OfflineTradeUtil
|
||||
return false;
|
||||
}
|
||||
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT++;
|
||||
|
||||
final GameClient client = player.getClient();
|
||||
client.close(true);
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
@ -93,7 +93,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);
|
||||
|
@ -30,13 +30,13 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.TradeItem;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.holders.SellBuffHolder;
|
||||
import org.l2jmobius.gameserver.network.Disconnection;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
public class OfflineTraderTable
|
||||
{
|
||||
@ -298,7 +298,6 @@ public class OfflineTraderTable
|
||||
player.setOnlineStatus(true, true);
|
||||
player.restoreEffects();
|
||||
player.broadcastUserInfo();
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
nTraders++;
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -311,7 +310,9 @@ public class OfflineTraderTable
|
||||
}
|
||||
}
|
||||
|
||||
SystemPanel.OFFLINE_TRADE_COUNT = nTraders;
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + nTraders + " offline traders.");
|
||||
|
||||
if (!Config.STORE_OFFLINE_TRADE_IN_REALTIME)
|
||||
{
|
||||
try (Statement stm1 = con.createStatement())
|
||||
@ -450,7 +451,7 @@ public class OfflineTraderTable
|
||||
|
||||
public static synchronized void removeTrader(int traderObjId)
|
||||
{
|
||||
PlayerCountManager.getInstance().decOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT--;
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
@ -32,7 +32,6 @@ import org.l2jmobius.gameserver.ai.CreatureAI;
|
||||
import org.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
@ -149,8 +148,6 @@ public class World
|
||||
|
||||
if (object.isPlayer())
|
||||
{
|
||||
PlayerCountManager.getInstance().incConnectedCount();
|
||||
|
||||
final PlayerInstance newPlayer = (PlayerInstance) object;
|
||||
if (newPlayer.isTeleporting()) // TODO: Drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
@ -187,8 +184,6 @@ public class World
|
||||
_allObjects.remove(object.getObjectId());
|
||||
if (object.isPlayer())
|
||||
{
|
||||
PlayerCountManager.getInstance().decConnectedCount();
|
||||
|
||||
final PlayerInstance player = (PlayerInstance) object;
|
||||
if (player.isTeleporting()) // TODO: Drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
@ -121,9 +124,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().getPlayers().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);
|
||||
|
@ -20,12 +20,12 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.OfflineTraderTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
/**
|
||||
* @author lord_rex
|
||||
@ -100,7 +100,7 @@ public class OfflineTradeUtil
|
||||
return false;
|
||||
}
|
||||
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT++;
|
||||
|
||||
final GameClient client = player.getClient();
|
||||
client.close(true);
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
@ -93,7 +93,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);
|
||||
|
@ -30,13 +30,13 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.TradeItem;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.holders.SellBuffHolder;
|
||||
import org.l2jmobius.gameserver.network.Disconnection;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
public class OfflineTraderTable
|
||||
{
|
||||
@ -298,7 +298,6 @@ public class OfflineTraderTable
|
||||
player.setOnlineStatus(true, true);
|
||||
player.restoreEffects();
|
||||
player.broadcastUserInfo();
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
nTraders++;
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -311,7 +310,9 @@ public class OfflineTraderTable
|
||||
}
|
||||
}
|
||||
|
||||
SystemPanel.OFFLINE_TRADE_COUNT = nTraders;
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + nTraders + " offline traders.");
|
||||
|
||||
if (!Config.STORE_OFFLINE_TRADE_IN_REALTIME)
|
||||
{
|
||||
try (Statement stm1 = con.createStatement())
|
||||
@ -450,7 +451,7 @@ public class OfflineTraderTable
|
||||
|
||||
public static synchronized void removeTrader(int traderObjId)
|
||||
{
|
||||
PlayerCountManager.getInstance().decOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT--;
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
@ -32,7 +32,6 @@ import org.l2jmobius.gameserver.ai.CreatureAI;
|
||||
import org.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
@ -149,8 +148,6 @@ public class World
|
||||
|
||||
if (object.isPlayer())
|
||||
{
|
||||
PlayerCountManager.getInstance().incConnectedCount();
|
||||
|
||||
final PlayerInstance newPlayer = (PlayerInstance) object;
|
||||
if (newPlayer.isTeleporting()) // TODO: Drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
@ -187,8 +184,6 @@ public class World
|
||||
_allObjects.remove(object.getObjectId());
|
||||
if (object.isPlayer())
|
||||
{
|
||||
PlayerCountManager.getInstance().decConnectedCount();
|
||||
|
||||
final PlayerInstance player = (PlayerInstance) object;
|
||||
if (player.isTeleporting()) // TODO: Drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
@ -121,9 +124,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().getPlayers().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);
|
||||
|
@ -20,12 +20,12 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.OfflineTraderTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
/**
|
||||
* @author lord_rex
|
||||
@ -100,7 +100,7 @@ public class OfflineTradeUtil
|
||||
return false;
|
||||
}
|
||||
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT++;
|
||||
|
||||
final GameClient client = player.getClient();
|
||||
client.close(true);
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
@ -93,7 +93,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);
|
||||
|
@ -30,13 +30,13 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.TradeItem;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.holders.SellBuffHolder;
|
||||
import org.l2jmobius.gameserver.network.Disconnection;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
public class OfflineTraderTable
|
||||
{
|
||||
@ -298,7 +298,6 @@ public class OfflineTraderTable
|
||||
player.setOnlineStatus(true, true);
|
||||
player.restoreEffects();
|
||||
player.broadcastUserInfo();
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
nTraders++;
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -311,7 +310,9 @@ public class OfflineTraderTable
|
||||
}
|
||||
}
|
||||
|
||||
SystemPanel.OFFLINE_TRADE_COUNT = nTraders;
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + nTraders + " offline traders.");
|
||||
|
||||
if (!Config.STORE_OFFLINE_TRADE_IN_REALTIME)
|
||||
{
|
||||
try (Statement stm1 = con.createStatement())
|
||||
@ -450,7 +451,7 @@ public class OfflineTraderTable
|
||||
|
||||
public static synchronized void removeTrader(int traderObjId)
|
||||
{
|
||||
PlayerCountManager.getInstance().decOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT--;
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
@ -32,7 +32,6 @@ import org.l2jmobius.gameserver.ai.CreatureAI;
|
||||
import org.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
@ -149,8 +148,6 @@ public class World
|
||||
|
||||
if (object.isPlayer())
|
||||
{
|
||||
PlayerCountManager.getInstance().incConnectedCount();
|
||||
|
||||
final PlayerInstance newPlayer = (PlayerInstance) object;
|
||||
if (newPlayer.isTeleporting()) // TODO: Drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
@ -187,8 +184,6 @@ public class World
|
||||
_allObjects.remove(object.getObjectId());
|
||||
if (object.isPlayer())
|
||||
{
|
||||
PlayerCountManager.getInstance().decConnectedCount();
|
||||
|
||||
final PlayerInstance player = (PlayerInstance) object;
|
||||
if (player.isTeleporting()) // TODO: Drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
@ -121,9 +124,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().getPlayers().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);
|
||||
|
@ -20,12 +20,12 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.OfflineTraderTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
/**
|
||||
* @author lord_rex
|
||||
@ -100,7 +100,7 @@ public class OfflineTradeUtil
|
||||
return false;
|
||||
}
|
||||
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT++;
|
||||
|
||||
final GameClient client = player.getClient();
|
||||
client.close(true);
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
@ -93,7 +93,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);
|
||||
|
@ -30,13 +30,13 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.TradeItem;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.holders.SellBuffHolder;
|
||||
import org.l2jmobius.gameserver.network.Disconnection;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
public class OfflineTraderTable
|
||||
{
|
||||
@ -298,7 +298,6 @@ public class OfflineTraderTable
|
||||
player.setOnlineStatus(true, true);
|
||||
player.restoreEffects();
|
||||
player.broadcastUserInfo();
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
nTraders++;
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -311,7 +310,9 @@ public class OfflineTraderTable
|
||||
}
|
||||
}
|
||||
|
||||
SystemPanel.OFFLINE_TRADE_COUNT = nTraders;
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + nTraders + " offline traders.");
|
||||
|
||||
if (!Config.STORE_OFFLINE_TRADE_IN_REALTIME)
|
||||
{
|
||||
try (Statement stm1 = con.createStatement())
|
||||
@ -450,7 +451,7 @@ public class OfflineTraderTable
|
||||
|
||||
public static synchronized void removeTrader(int traderObjId)
|
||||
{
|
||||
PlayerCountManager.getInstance().decOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT--;
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
@ -32,7 +32,6 @@ import org.l2jmobius.gameserver.ai.CreatureAI;
|
||||
import org.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
@ -149,8 +148,6 @@ public class World
|
||||
|
||||
if (object.isPlayer())
|
||||
{
|
||||
PlayerCountManager.getInstance().incConnectedCount();
|
||||
|
||||
final PlayerInstance newPlayer = (PlayerInstance) object;
|
||||
if (newPlayer.isTeleporting()) // TODO: Drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
@ -187,8 +184,6 @@ public class World
|
||||
_allObjects.remove(object.getObjectId());
|
||||
if (object.isPlayer())
|
||||
{
|
||||
PlayerCountManager.getInstance().decConnectedCount();
|
||||
|
||||
final PlayerInstance player = (PlayerInstance) object;
|
||||
if (player.isTeleporting()) // TODO: Drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
@ -121,9 +124,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().getPlayers().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);
|
||||
|
@ -20,12 +20,12 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.OfflineTraderTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
/**
|
||||
* @author lord_rex
|
||||
@ -100,7 +100,7 @@ public class OfflineTradeUtil
|
||||
return false;
|
||||
}
|
||||
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT++;
|
||||
|
||||
final GameClient client = player.getClient();
|
||||
client.close(true);
|
||||
|
@ -1,66 +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.managers;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class PlayerCountManager
|
||||
{
|
||||
private static volatile int connectedCount = 0;
|
||||
private static volatile int maxConnectedCount = 0;
|
||||
|
||||
protected PlayerCountManager()
|
||||
{
|
||||
}
|
||||
|
||||
public int getConnectedCount()
|
||||
{
|
||||
return connectedCount;
|
||||
}
|
||||
|
||||
public int getMaxConnectedCount()
|
||||
{
|
||||
return maxConnectedCount;
|
||||
}
|
||||
|
||||
public synchronized void incConnectedCount()
|
||||
{
|
||||
connectedCount++;
|
||||
maxConnectedCount = Math.max(maxConnectedCount, connectedCount);
|
||||
}
|
||||
|
||||
public void decConnectedCount()
|
||||
{
|
||||
connectedCount--;
|
||||
}
|
||||
|
||||
public static PlayerCountManager getInstance()
|
||||
{
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final PlayerCountManager INSTANCE = new PlayerCountManager();
|
||||
}
|
||||
|
||||
public void setConnectedCount(int count)
|
||||
{
|
||||
connectedCount = count;
|
||||
}
|
||||
}
|
@ -23,7 +23,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.l2jmobius.gameserver.managers.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
@ -88,7 +87,6 @@ public class World
|
||||
}
|
||||
element.addKnownObject(object);
|
||||
}
|
||||
PlayerCountManager.getInstance().incConnectedCount();
|
||||
}
|
||||
else if ((_allPlayers.size() != 0) && !(object instanceof PetInstance) && !(object instanceof ItemInstance))
|
||||
{
|
||||
@ -123,10 +121,6 @@ public class World
|
||||
if (object instanceof PlayerInstance)
|
||||
{
|
||||
_allPlayers.remove(((PlayerInstance) object).getName().toLowerCase());
|
||||
|
||||
// TODO: Make sure the normal way works.
|
||||
// PlayerCountManager.getInstance().decConnectedCount();
|
||||
PlayerCountManager.getInstance().setConnectedCount(_allPlayers.size());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,6 @@ import javax.swing.border.LineBorder;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.GameServer;
|
||||
import org.l2jmobius.gameserver.managers.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.util.Locator;
|
||||
|
||||
@ -41,7 +40,10 @@ import org.l2jmobius.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()
|
||||
{
|
||||
@ -117,8 +119,13 @@ public class SystemPanel extends JPanel
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
lblConnected.setText("Connected: " + World.getInstance().getAllPlayers().size());
|
||||
lblMaxConnected.setText("Max connected: " + PlayerCountManager.getInstance().getMaxConnectedCount());
|
||||
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);
|
||||
lblElapsedTime.setText("Elapsed: " + getDurationBreakdown(System.currentTimeMillis() - START_TIME));
|
||||
}
|
||||
}, 1000, 1000);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
@ -93,7 +93,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);
|
||||
|
@ -27,7 +27,6 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.ManufactureItem;
|
||||
import org.l2jmobius.gameserver.model.TradeItem;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
@ -35,6 +34,7 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.holders.SellBuffHolder;
|
||||
import org.l2jmobius.gameserver.network.Disconnection;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
public class OfflineTraderTable
|
||||
{
|
||||
@ -294,7 +294,6 @@ public class OfflineTraderTable
|
||||
player.setOnlineStatus(true, true);
|
||||
player.restoreEffects();
|
||||
player.broadcastUserInfo();
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
nTraders++;
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -307,7 +306,9 @@ public class OfflineTraderTable
|
||||
}
|
||||
}
|
||||
|
||||
SystemPanel.OFFLINE_TRADE_COUNT = nTraders;
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + nTraders + " offline traders.");
|
||||
|
||||
if (!Config.STORE_OFFLINE_TRADE_IN_REALTIME)
|
||||
{
|
||||
try (Statement stm1 = con.createStatement())
|
||||
@ -446,7 +447,7 @@ public class OfflineTraderTable
|
||||
|
||||
public static synchronized void removeTrader(int traderObjId)
|
||||
{
|
||||
PlayerCountManager.getInstance().decOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT--;
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
@ -31,7 +31,6 @@ import org.l2jmobius.gameserver.ai.CreatureAI;
|
||||
import org.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
@ -145,8 +144,6 @@ public class World
|
||||
|
||||
if (object.isPlayer())
|
||||
{
|
||||
PlayerCountManager.getInstance().incConnectedCount();
|
||||
|
||||
final PlayerInstance newPlayer = (PlayerInstance) object;
|
||||
if (newPlayer.isTeleporting()) // TODO: Drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
@ -183,8 +180,6 @@ public class World
|
||||
_allObjects.remove(object.getObjectId());
|
||||
if (object.isPlayer())
|
||||
{
|
||||
PlayerCountManager.getInstance().decConnectedCount();
|
||||
|
||||
final PlayerInstance player = (PlayerInstance) object;
|
||||
if (player.isTeleporting()) // TODO: Drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
@ -121,9 +124,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().getPlayers().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);
|
||||
|
@ -20,12 +20,12 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.OfflineTraderTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.olympiad.Olympiad;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
/**
|
||||
* @author lord_rex
|
||||
@ -100,7 +100,7 @@ public class OfflineTradeUtil
|
||||
return false;
|
||||
}
|
||||
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT++;
|
||||
|
||||
final GameClient client = player.getClient();
|
||||
client.close(true);
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
@ -93,7 +93,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);
|
||||
|
@ -27,7 +27,6 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.ManufactureItem;
|
||||
import org.l2jmobius.gameserver.model.TradeItem;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
@ -35,6 +34,7 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.holders.SellBuffHolder;
|
||||
import org.l2jmobius.gameserver.network.Disconnection;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
public class OfflineTraderTable
|
||||
{
|
||||
@ -294,7 +294,6 @@ public class OfflineTraderTable
|
||||
player.setOnlineStatus(true, true);
|
||||
player.restoreEffects();
|
||||
player.broadcastUserInfo();
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
nTraders++;
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -307,7 +306,9 @@ public class OfflineTraderTable
|
||||
}
|
||||
}
|
||||
|
||||
SystemPanel.OFFLINE_TRADE_COUNT = nTraders;
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + nTraders + " offline traders.");
|
||||
|
||||
if (!Config.STORE_OFFLINE_TRADE_IN_REALTIME)
|
||||
{
|
||||
try (Statement stm1 = con.createStatement())
|
||||
@ -446,7 +447,7 @@ public class OfflineTraderTable
|
||||
|
||||
public static synchronized void removeTrader(int traderObjId)
|
||||
{
|
||||
PlayerCountManager.getInstance().decOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT--;
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
@ -31,7 +31,6 @@ import org.l2jmobius.gameserver.ai.CreatureAI;
|
||||
import org.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
@ -145,8 +144,6 @@ public class World
|
||||
|
||||
if (object.isPlayer())
|
||||
{
|
||||
PlayerCountManager.getInstance().incConnectedCount();
|
||||
|
||||
final PlayerInstance newPlayer = (PlayerInstance) object;
|
||||
if (newPlayer.isTeleporting()) // TODO: Drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
@ -183,8 +180,6 @@ public class World
|
||||
_allObjects.remove(object.getObjectId());
|
||||
if (object.isPlayer())
|
||||
{
|
||||
PlayerCountManager.getInstance().decConnectedCount();
|
||||
|
||||
final PlayerInstance player = (PlayerInstance) object;
|
||||
if (player.isTeleporting()) // TODO: Drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
@ -121,9 +124,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().getPlayers().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);
|
||||
|
@ -20,12 +20,12 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.OfflineTraderTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
/**
|
||||
* @author lord_rex
|
||||
@ -100,7 +100,7 @@ public class OfflineTradeUtil
|
||||
return false;
|
||||
}
|
||||
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT++;
|
||||
|
||||
final GameClient client = player.getClient();
|
||||
client.close(true);
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
@ -93,7 +93,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);
|
||||
|
@ -27,7 +27,6 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.ManufactureItem;
|
||||
import org.l2jmobius.gameserver.model.TradeItem;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
@ -35,6 +34,7 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.holders.SellBuffHolder;
|
||||
import org.l2jmobius.gameserver.network.Disconnection;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
public class OfflineTraderTable
|
||||
{
|
||||
@ -294,7 +294,6 @@ public class OfflineTraderTable
|
||||
player.setOnlineStatus(true, true);
|
||||
player.restoreEffects();
|
||||
player.broadcastUserInfo();
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
nTraders++;
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -307,7 +306,9 @@ public class OfflineTraderTable
|
||||
}
|
||||
}
|
||||
|
||||
SystemPanel.OFFLINE_TRADE_COUNT = nTraders;
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + nTraders + " offline traders.");
|
||||
|
||||
if (!Config.STORE_OFFLINE_TRADE_IN_REALTIME)
|
||||
{
|
||||
try (Statement stm1 = con.createStatement())
|
||||
@ -446,7 +447,7 @@ public class OfflineTraderTable
|
||||
|
||||
public static synchronized void removeTrader(int traderObjId)
|
||||
{
|
||||
PlayerCountManager.getInstance().decOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT--;
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
@ -32,7 +32,6 @@ import org.l2jmobius.gameserver.ai.CreatureAI;
|
||||
import org.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
@ -149,8 +148,6 @@ public class World
|
||||
|
||||
if (object.isPlayer())
|
||||
{
|
||||
PlayerCountManager.getInstance().incConnectedCount();
|
||||
|
||||
final PlayerInstance newPlayer = (PlayerInstance) object;
|
||||
if (newPlayer.isTeleporting()) // TODO: Drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
@ -187,8 +184,6 @@ public class World
|
||||
_allObjects.remove(object.getObjectId());
|
||||
if (object.isPlayer())
|
||||
{
|
||||
PlayerCountManager.getInstance().decConnectedCount();
|
||||
|
||||
final PlayerInstance player = (PlayerInstance) object;
|
||||
if (player.isTeleporting()) // TODO: Drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
@ -121,9 +124,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().getPlayers().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);
|
||||
|
@ -20,12 +20,12 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.OfflineTraderTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
/**
|
||||
* @author lord_rex
|
||||
@ -100,7 +100,7 @@ public class OfflineTradeUtil
|
||||
return false;
|
||||
}
|
||||
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT++;
|
||||
|
||||
final GameClient client = player.getClient();
|
||||
client.close(true);
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
@ -93,7 +93,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);
|
||||
|
@ -27,7 +27,6 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.ManufactureItem;
|
||||
import org.l2jmobius.gameserver.model.TradeItem;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
@ -35,6 +34,7 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.holders.SellBuffHolder;
|
||||
import org.l2jmobius.gameserver.network.Disconnection;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
public class OfflineTraderTable
|
||||
{
|
||||
@ -294,7 +294,6 @@ public class OfflineTraderTable
|
||||
player.setOnlineStatus(true, true);
|
||||
player.restoreEffects();
|
||||
player.broadcastUserInfo();
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
nTraders++;
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -307,7 +306,9 @@ public class OfflineTraderTable
|
||||
}
|
||||
}
|
||||
|
||||
SystemPanel.OFFLINE_TRADE_COUNT = nTraders;
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + nTraders + " offline traders.");
|
||||
|
||||
if (!Config.STORE_OFFLINE_TRADE_IN_REALTIME)
|
||||
{
|
||||
try (Statement stm1 = con.createStatement())
|
||||
@ -446,7 +447,7 @@ public class OfflineTraderTable
|
||||
|
||||
public static synchronized void removeTrader(int traderObjId)
|
||||
{
|
||||
PlayerCountManager.getInstance().decOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT--;
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
@ -32,7 +32,6 @@ import org.l2jmobius.gameserver.ai.CreatureAI;
|
||||
import org.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
@ -149,8 +148,6 @@ public class World
|
||||
|
||||
if (object.isPlayer())
|
||||
{
|
||||
PlayerCountManager.getInstance().incConnectedCount();
|
||||
|
||||
final PlayerInstance newPlayer = (PlayerInstance) object;
|
||||
if (newPlayer.isTeleporting()) // TODO: Drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
@ -187,8 +184,6 @@ public class World
|
||||
_allObjects.remove(object.getObjectId());
|
||||
if (object.isPlayer())
|
||||
{
|
||||
PlayerCountManager.getInstance().decConnectedCount();
|
||||
|
||||
final PlayerInstance player = (PlayerInstance) object;
|
||||
if (player.isTeleporting()) // TODO: Drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
@ -121,9 +124,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().getPlayers().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);
|
||||
|
@ -20,12 +20,12 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.OfflineTraderTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
/**
|
||||
* @author lord_rex
|
||||
@ -100,7 +100,7 @@ public class OfflineTradeUtil
|
||||
return false;
|
||||
}
|
||||
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT++;
|
||||
|
||||
final GameClient client = player.getClient();
|
||||
client.close(true);
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
@ -93,7 +93,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);
|
||||
|
@ -27,7 +27,6 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.ManufactureItem;
|
||||
import org.l2jmobius.gameserver.model.TradeItem;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
@ -35,6 +34,7 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.holders.SellBuffHolder;
|
||||
import org.l2jmobius.gameserver.network.Disconnection;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
public class OfflineTraderTable
|
||||
{
|
||||
@ -294,7 +294,6 @@ public class OfflineTraderTable
|
||||
player.setOnlineStatus(true, true);
|
||||
player.restoreEffects();
|
||||
player.broadcastUserInfo();
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
nTraders++;
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -307,7 +306,9 @@ public class OfflineTraderTable
|
||||
}
|
||||
}
|
||||
|
||||
SystemPanel.OFFLINE_TRADE_COUNT = nTraders;
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + nTraders + " offline traders.");
|
||||
|
||||
if (!Config.STORE_OFFLINE_TRADE_IN_REALTIME)
|
||||
{
|
||||
try (Statement stm1 = con.createStatement())
|
||||
@ -446,7 +447,7 @@ public class OfflineTraderTable
|
||||
|
||||
public static synchronized void removeTrader(int traderObjId)
|
||||
{
|
||||
PlayerCountManager.getInstance().decOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT--;
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
@ -32,7 +32,6 @@ import org.l2jmobius.gameserver.ai.CreatureAI;
|
||||
import org.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
@ -149,8 +148,6 @@ public class World
|
||||
|
||||
if (object.isPlayer())
|
||||
{
|
||||
PlayerCountManager.getInstance().incConnectedCount();
|
||||
|
||||
final PlayerInstance newPlayer = (PlayerInstance) object;
|
||||
if (newPlayer.isTeleporting()) // TODO: Drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
@ -187,8 +184,6 @@ public class World
|
||||
_allObjects.remove(object.getObjectId());
|
||||
if (object.isPlayer())
|
||||
{
|
||||
PlayerCountManager.getInstance().decConnectedCount();
|
||||
|
||||
final PlayerInstance player = (PlayerInstance) object;
|
||||
if (player.isTeleporting()) // TODO: Drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
@ -121,9 +124,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().getPlayers().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);
|
||||
|
@ -20,12 +20,12 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.OfflineTraderTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
/**
|
||||
* @author lord_rex
|
||||
@ -100,7 +100,7 @@ public class OfflineTradeUtil
|
||||
return false;
|
||||
}
|
||||
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT++;
|
||||
|
||||
final GameClient client = player.getClient();
|
||||
client.close(true);
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
@ -93,7 +93,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);
|
||||
|
@ -27,7 +27,6 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.ManufactureItem;
|
||||
import org.l2jmobius.gameserver.model.TradeItem;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
@ -35,6 +34,7 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.holders.SellBuffHolder;
|
||||
import org.l2jmobius.gameserver.network.Disconnection;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
public class OfflineTraderTable
|
||||
{
|
||||
@ -294,7 +294,6 @@ public class OfflineTraderTable
|
||||
player.setOnlineStatus(true, true);
|
||||
player.restoreEffects();
|
||||
player.broadcastUserInfo();
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
nTraders++;
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -307,7 +306,9 @@ public class OfflineTraderTable
|
||||
}
|
||||
}
|
||||
|
||||
SystemPanel.OFFLINE_TRADE_COUNT = nTraders;
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + nTraders + " offline traders.");
|
||||
|
||||
if (!Config.STORE_OFFLINE_TRADE_IN_REALTIME)
|
||||
{
|
||||
try (Statement stm1 = con.createStatement())
|
||||
@ -446,7 +447,7 @@ public class OfflineTraderTable
|
||||
|
||||
public static synchronized void removeTrader(int traderObjId)
|
||||
{
|
||||
PlayerCountManager.getInstance().decOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT--;
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
@ -32,7 +32,6 @@ import org.l2jmobius.gameserver.ai.CreatureAI;
|
||||
import org.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
@ -149,8 +148,6 @@ public class World
|
||||
|
||||
if (object.isPlayer())
|
||||
{
|
||||
PlayerCountManager.getInstance().incConnectedCount();
|
||||
|
||||
final PlayerInstance newPlayer = (PlayerInstance) object;
|
||||
if (newPlayer.isTeleporting()) // TODO: Drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
@ -187,8 +184,6 @@ public class World
|
||||
_allObjects.remove(object.getObjectId());
|
||||
if (object.isPlayer())
|
||||
{
|
||||
PlayerCountManager.getInstance().decConnectedCount();
|
||||
|
||||
final PlayerInstance player = (PlayerInstance) object;
|
||||
if (player.isTeleporting()) // TODO: Drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
@ -121,9 +124,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().getPlayers().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);
|
||||
|
@ -20,12 +20,12 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.OfflineTraderTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
/**
|
||||
* @author lord_rex
|
||||
@ -100,7 +100,7 @@ public class OfflineTradeUtil
|
||||
return false;
|
||||
}
|
||||
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT++;
|
||||
|
||||
final GameClient client = player.getClient();
|
||||
client.close(true);
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
@ -93,7 +93,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);
|
||||
|
@ -27,7 +27,6 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.ManufactureItem;
|
||||
import org.l2jmobius.gameserver.model.TradeItem;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
@ -35,6 +34,7 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.holders.SellBuffHolder;
|
||||
import org.l2jmobius.gameserver.network.Disconnection;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
public class OfflineTraderTable
|
||||
{
|
||||
@ -294,7 +294,6 @@ public class OfflineTraderTable
|
||||
player.setOnlineStatus(true, true);
|
||||
player.restoreEffects();
|
||||
player.broadcastUserInfo();
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
nTraders++;
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -307,7 +306,9 @@ public class OfflineTraderTable
|
||||
}
|
||||
}
|
||||
|
||||
SystemPanel.OFFLINE_TRADE_COUNT = nTraders;
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + nTraders + " offline traders.");
|
||||
|
||||
if (!Config.STORE_OFFLINE_TRADE_IN_REALTIME)
|
||||
{
|
||||
try (Statement stm1 = con.createStatement())
|
||||
@ -446,7 +447,7 @@ public class OfflineTraderTable
|
||||
|
||||
public static synchronized void removeTrader(int traderObjId)
|
||||
{
|
||||
PlayerCountManager.getInstance().decOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT--;
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
@ -32,7 +32,6 @@ import org.l2jmobius.gameserver.ai.CreatureAI;
|
||||
import org.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
@ -149,8 +148,6 @@ public class World
|
||||
|
||||
if (object.isPlayer())
|
||||
{
|
||||
PlayerCountManager.getInstance().incConnectedCount();
|
||||
|
||||
final PlayerInstance newPlayer = (PlayerInstance) object;
|
||||
if (newPlayer.isTeleporting()) // TODO: Drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
@ -187,8 +184,6 @@ public class World
|
||||
_allObjects.remove(object.getObjectId());
|
||||
if (object.isPlayer())
|
||||
{
|
||||
PlayerCountManager.getInstance().decConnectedCount();
|
||||
|
||||
final PlayerInstance player = (PlayerInstance) object;
|
||||
if (player.isTeleporting()) // TODO: Drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
@ -121,9 +124,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().getPlayers().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);
|
||||
|
@ -20,12 +20,12 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.OfflineTraderTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PlayerCountManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.olympiad.OlympiadManager;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.ui.SystemPanel;
|
||||
|
||||
/**
|
||||
* @author lord_rex
|
||||
@ -100,7 +100,7 @@ public class OfflineTradeUtil
|
||||
return false;
|
||||
}
|
||||
|
||||
PlayerCountManager.getInstance().incOfflineTradeCount();
|
||||
SystemPanel.OFFLINE_TRADE_COUNT++;
|
||||
|
||||
final GameClient client = player.getClient();
|
||||
client.close(true);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user