diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
index d916fcf708..5be93b4071 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
@@ -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);
diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
index 0e07ed87d7..abdbaef34a 100644
--- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
+++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
@@ -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);
diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
deleted file mode 100644
index f4d60552ad..0000000000
--- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
+++ /dev/null
@@ -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 .
- */
-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();
- }
-}
diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/World.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/World.java
index 09579e901c..95e24f8c7b 100644
--- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/World.java
+++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/World.java
@@ -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.
{
diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/ui/SystemPanel.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/ui/SystemPanel.java
index 4c989dfee7..4213892552 100644
--- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/ui/SystemPanel.java
+++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/ui/SystemPanel.java
@@ -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);
diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
index 6b1f9b4a10..d2ceb30cea 100644
--- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
+++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
@@ -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);
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
index d916fcf708..5be93b4071 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
@@ -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);
diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
index 0e07ed87d7..abdbaef34a 100644
--- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
+++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
@@ -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);
diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
deleted file mode 100644
index f4d60552ad..0000000000
--- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
+++ /dev/null
@@ -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 .
- */
-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();
- }
-}
diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/World.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/World.java
index 09579e901c..95e24f8c7b 100644
--- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/World.java
+++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/World.java
@@ -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.
{
diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/ui/SystemPanel.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/ui/SystemPanel.java
index 4c989dfee7..4213892552 100644
--- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/ui/SystemPanel.java
+++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/ui/SystemPanel.java
@@ -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);
diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
index 6b1f9b4a10..d2ceb30cea 100644
--- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
+++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
@@ -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);
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
index d916fcf708..5be93b4071 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
@@ -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);
diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
index 0e07ed87d7..abdbaef34a 100644
--- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
+++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
@@ -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);
diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
deleted file mode 100644
index f4d60552ad..0000000000
--- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
+++ /dev/null
@@ -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 .
- */
-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();
- }
-}
diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/World.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/World.java
index 09579e901c..95e24f8c7b 100644
--- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/World.java
+++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/World.java
@@ -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.
{
diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/ui/SystemPanel.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/ui/SystemPanel.java
index 4c989dfee7..4213892552 100644
--- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/ui/SystemPanel.java
+++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/ui/SystemPanel.java
@@ -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);
diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
index 6b1f9b4a10..d2ceb30cea 100644
--- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
+++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
@@ -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);
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
index d916fcf708..5be93b4071 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
@@ -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);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
index b0f60b771c..4aa4b52873 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
@@ -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);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
deleted file mode 100644
index f4d60552ad..0000000000
--- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
+++ /dev/null
@@ -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 .
- */
-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();
- }
-}
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/World.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/World.java
index 09579e901c..95e24f8c7b 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/World.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/World.java
@@ -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.
{
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/ui/SystemPanel.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/ui/SystemPanel.java
index 4c989dfee7..4213892552 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/ui/SystemPanel.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/ui/SystemPanel.java
@@ -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);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
index 6b1f9b4a10..d2ceb30cea 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
@@ -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);
diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
index d916fcf708..5be93b4071 100644
--- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
+++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
@@ -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);
diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
index b0f60b771c..4aa4b52873 100644
--- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
+++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
@@ -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);
diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
deleted file mode 100644
index f4d60552ad..0000000000
--- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
+++ /dev/null
@@ -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 .
- */
-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();
- }
-}
diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/World.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/World.java
index 09579e901c..95e24f8c7b 100644
--- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/World.java
+++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/World.java
@@ -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.
{
diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/ui/SystemPanel.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/ui/SystemPanel.java
index 4c989dfee7..4213892552 100644
--- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/ui/SystemPanel.java
+++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/ui/SystemPanel.java
@@ -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);
diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
index 6b1f9b4a10..d2ceb30cea 100644
--- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
+++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
@@ -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);
diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
index d916fcf708..5be93b4071 100644
--- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
+++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
@@ -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);
diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
index b0f60b771c..4aa4b52873 100644
--- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
+++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
@@ -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);
diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
deleted file mode 100644
index f4d60552ad..0000000000
--- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
+++ /dev/null
@@ -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 .
- */
-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();
- }
-}
diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/World.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/World.java
index 09579e901c..95e24f8c7b 100644
--- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/World.java
+++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/World.java
@@ -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.
{
diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/ui/SystemPanel.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/ui/SystemPanel.java
index 4c989dfee7..4213892552 100644
--- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/ui/SystemPanel.java
+++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/ui/SystemPanel.java
@@ -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);
diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
index 6b1f9b4a10..d2ceb30cea 100644
--- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
+++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
@@ -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);
diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
index d916fcf708..5be93b4071 100644
--- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
+++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
@@ -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);
diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
index b0f60b771c..4aa4b52873 100644
--- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
+++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
@@ -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);
diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
deleted file mode 100644
index f4d60552ad..0000000000
--- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
+++ /dev/null
@@ -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 .
- */
-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();
- }
-}
diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/World.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/World.java
index 09579e901c..95e24f8c7b 100644
--- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/World.java
+++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/World.java
@@ -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.
{
diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/ui/SystemPanel.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/ui/SystemPanel.java
index 4c989dfee7..4213892552 100644
--- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/ui/SystemPanel.java
+++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/ui/SystemPanel.java
@@ -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);
diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
index 6b1f9b4a10..d2ceb30cea 100644
--- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
+++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
@@ -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);
diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
index d916fcf708..5be93b4071 100644
--- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
+++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
@@ -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);
diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
index b0f60b771c..4aa4b52873 100644
--- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
+++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
@@ -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);
diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
deleted file mode 100644
index f4d60552ad..0000000000
--- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
+++ /dev/null
@@ -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 .
- */
-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();
- }
-}
diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/World.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/World.java
index 09579e901c..95e24f8c7b 100644
--- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/World.java
+++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/World.java
@@ -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.
{
diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/ui/SystemPanel.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/ui/SystemPanel.java
index 4c989dfee7..4213892552 100644
--- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/ui/SystemPanel.java
+++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/ui/SystemPanel.java
@@ -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);
diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
index 6b1f9b4a10..d2ceb30cea 100644
--- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
+++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
@@ -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);
diff --git a/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/managers/PlayerCountManager.java b/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/managers/PlayerCountManager.java
deleted file mode 100644
index 9178299125..0000000000
--- a/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/managers/PlayerCountManager.java
+++ /dev/null
@@ -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 .
- */
-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;
- }
-}
diff --git a/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/model/World.java b/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/model/World.java
index 65db45b228..162d811c63 100644
--- a/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/model/World.java
+++ b/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/model/World.java
@@ -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());
}
}
diff --git a/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/ui/SystemPanel.java b/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/ui/SystemPanel.java
index f9a7319ee3..a40aa86730 100644
--- a/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/ui/SystemPanel.java
+++ b/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/ui/SystemPanel.java
@@ -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);
diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/datatables/OfflineTradeTable.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/datatables/OfflineTradeTable.java
index a8ba31b8db..408d3157a5 100644
--- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/datatables/OfflineTradeTable.java
+++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/datatables/OfflineTradeTable.java
@@ -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)
diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminOnline.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminOnline.java
index d2676ad2f9..9fb7fbaab6 100644
--- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminOnline.java
+++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminOnline.java
@@ -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);
diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
deleted file mode 100644
index f4d60552ad..0000000000
--- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
+++ /dev/null
@@ -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 .
- */
-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();
- }
-}
diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/World.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/World.java
index e3e9cc923b..ceac118dcc 100644
--- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/World.java
+++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/World.java
@@ -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())
diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
index 10d7bfb6eb..c9892eccb3 100644
--- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
+++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
@@ -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)
diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/GameClient.java
index 3aad39927d..ce75cffeb1 100644
--- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/GameClient.java
+++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/GameClient.java
@@ -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> implements
}
OfflineTradeTable.storeOffliner(player);
- PlayerCountManager.getInstance().incOfflineTradeCount();
+ SystemPanel.OFFLINE_TRADE_COUNT++;
return;
}
}
diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ui/SystemPanel.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ui/SystemPanel.java
index 7dc919873d..470ec32bfb 100644
--- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ui/SystemPanel.java
+++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ui/SystemPanel.java
@@ -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);
diff --git a/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java b/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
index d916fcf708..5be93b4071 100644
--- a/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
+++ b/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
@@ -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);
diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
index 0e07ed87d7..abdbaef34a 100644
--- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
+++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
@@ -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);
diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
deleted file mode 100644
index f4d60552ad..0000000000
--- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
+++ /dev/null
@@ -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 .
- */
-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();
- }
-}
diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/World.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/World.java
index 9c7460d3ba..b5119a459e 100644
--- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/World.java
+++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/World.java
@@ -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.
{
diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ui/SystemPanel.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ui/SystemPanel.java
index 6bacd78cf5..93388cb818 100644
--- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ui/SystemPanel.java
+++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ui/SystemPanel.java
@@ -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);
diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
index fdd25e1775..fee903d27c 100644
--- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
+++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
@@ -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);
diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
index d916fcf708..5be93b4071 100644
--- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
+++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
@@ -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);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
index 0e07ed87d7..abdbaef34a 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
@@ -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);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
deleted file mode 100644
index f4d60552ad..0000000000
--- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
+++ /dev/null
@@ -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 .
- */
-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();
- }
-}
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/World.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/World.java
index 9c7460d3ba..b5119a459e 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/World.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/World.java
@@ -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.
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ui/SystemPanel.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ui/SystemPanel.java
index 6bacd78cf5..93388cb818 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ui/SystemPanel.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ui/SystemPanel.java
@@ -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);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
index 5f420e816c..b0c28ecbe0 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
@@ -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);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
index d916fcf708..5be93b4071 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
@@ -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);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
index 0e07ed87d7..abdbaef34a 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
@@ -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);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
deleted file mode 100644
index f4d60552ad..0000000000
--- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
+++ /dev/null
@@ -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 .
- */
-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();
- }
-}
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/World.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/World.java
index 09579e901c..95e24f8c7b 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/World.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/World.java
@@ -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.
{
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/ui/SystemPanel.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/ui/SystemPanel.java
index 4c989dfee7..4213892552 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/ui/SystemPanel.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/ui/SystemPanel.java
@@ -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);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
index 6b1f9b4a10..d2ceb30cea 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
@@ -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);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
index d916fcf708..5be93b4071 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
@@ -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);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
index 0e07ed87d7..abdbaef34a 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
@@ -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);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
deleted file mode 100644
index f4d60552ad..0000000000
--- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
+++ /dev/null
@@ -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 .
- */
-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();
- }
-}
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/World.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/World.java
index 09579e901c..95e24f8c7b 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/World.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/World.java
@@ -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.
{
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/ui/SystemPanel.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/ui/SystemPanel.java
index 4c989dfee7..4213892552 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/ui/SystemPanel.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/ui/SystemPanel.java
@@ -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);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
index 6b1f9b4a10..d2ceb30cea 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
@@ -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);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
index d916fcf708..5be93b4071 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
@@ -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);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
index 0e07ed87d7..abdbaef34a 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
@@ -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);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
deleted file mode 100644
index f4d60552ad..0000000000
--- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
+++ /dev/null
@@ -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 .
- */
-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();
- }
-}
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/World.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/World.java
index 09579e901c..95e24f8c7b 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/World.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/World.java
@@ -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.
{
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/ui/SystemPanel.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/ui/SystemPanel.java
index 4c989dfee7..4213892552 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/ui/SystemPanel.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/ui/SystemPanel.java
@@ -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);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
index 6b1f9b4a10..d2ceb30cea 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
@@ -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);
diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
index d916fcf708..5be93b4071 100644
--- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
+++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
@@ -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);
diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
index 0e07ed87d7..abdbaef34a 100644
--- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
+++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
@@ -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);
diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
deleted file mode 100644
index f4d60552ad..0000000000
--- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
+++ /dev/null
@@ -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 .
- */
-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();
- }
-}
diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/World.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/World.java
index 09579e901c..95e24f8c7b 100644
--- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/World.java
+++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/World.java
@@ -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.
{
diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/ui/SystemPanel.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/ui/SystemPanel.java
index 4c989dfee7..4213892552 100644
--- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/ui/SystemPanel.java
+++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/ui/SystemPanel.java
@@ -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);
diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
index 6b1f9b4a10..d2ceb30cea 100644
--- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
+++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
@@ -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);
diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
index d916fcf708..5be93b4071 100644
--- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
+++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
@@ -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);
diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
index 0e07ed87d7..abdbaef34a 100644
--- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
+++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
@@ -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);
diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
deleted file mode 100644
index f4d60552ad..0000000000
--- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
+++ /dev/null
@@ -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 .
- */
-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();
- }
-}
diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/World.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/World.java
index 09579e901c..95e24f8c7b 100644
--- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/World.java
+++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/World.java
@@ -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.
{
diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/ui/SystemPanel.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/ui/SystemPanel.java
index 4c989dfee7..4213892552 100644
--- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/ui/SystemPanel.java
+++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/ui/SystemPanel.java
@@ -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);
diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
index 6b1f9b4a10..d2ceb30cea 100644
--- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
+++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
@@ -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);
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
index d916fcf708..5be93b4071 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
@@ -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);
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
index 0e07ed87d7..abdbaef34a 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
@@ -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);
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
deleted file mode 100644
index f4d60552ad..0000000000
--- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
+++ /dev/null
@@ -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 .
- */
-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();
- }
-}
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/World.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/World.java
index 09579e901c..95e24f8c7b 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/World.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/World.java
@@ -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.
{
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/ui/SystemPanel.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/ui/SystemPanel.java
index 4c989dfee7..4213892552 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/ui/SystemPanel.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/ui/SystemPanel.java
@@ -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);
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
index 6b1f9b4a10..d2ceb30cea 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
@@ -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);
diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
index d916fcf708..5be93b4071 100644
--- a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
+++ b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/admincommandhandlers/AdminOnline.java
@@ -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);
diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
index 0e07ed87d7..abdbaef34a 100644
--- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
+++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/sql/impl/OfflineTraderTable.java
@@ -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);
diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
deleted file mode 100644
index f4d60552ad..0000000000
--- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/instancemanager/PlayerCountManager.java
+++ /dev/null
@@ -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 .
- */
-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();
- }
-}
diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/World.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/World.java
index 09579e901c..95e24f8c7b 100644
--- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/World.java
+++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/World.java
@@ -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.
{
diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/ui/SystemPanel.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/ui/SystemPanel.java
index 4c989dfee7..4213892552 100644
--- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/ui/SystemPanel.java
+++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/ui/SystemPanel.java
@@ -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);
diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
index 6b1f9b4a10..d2ceb30cea 100644
--- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
+++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/util/OfflineTradeUtil.java
@@ -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);