Jump to content

Recommended Posts

Posted

i searched and i didnt find it so this will help,so

it shows in game when logging in number of player online and is configurable often it should autoanounce this status...is better to use when new CB is fixed..

 

CommunityBoard (Alt+B) is causing high CPU using (lags)!!

 

Index: config/altsettings.properties

===================================================================

--- config/altsettings.properties      (revision 2073)

+++ config/altsettings.properties      (working copy)

-115,3 +115,8 @@

 

# Maximum contribution per player during festival

AltMaxPlayerContrib = 1000000

+

+#Show Online Players number at startup

+ShowOnlinePlayersAtStartup = True

+#Set time interval to announce online players number (0 - don't announce)

+OnlinePlayersAnnounceInterval = 900000

Index: net/sf/l2j/Config.java

===================================================================

--- net/sf/l2j/Config.java      (revision 2073)

+++ net/sf/l2j/Config.java      (working copy)

-809,8 +809,11 @@

    /** Recipebook limits */

    public static int DWARF_RECIPE_LIMIT;

    public static int COMMON_RECIPE_LIMIT; 

-

   

+    /** Show Online Players announce */

+    public static boolean ONLINE_PLAYERS_AT_STARTUP;

+    public static int  ONLINE_PLAYERS_ANNOUNCE_INTERVAL;

+   

    /**

      * This class initializes all global variables for configuration.<br>

      * If key doesn't appear in properties file, a default value is setting on by this class.

-1250,6 +1253,8 @@

                ALT_GAME_REQUIRE_CLAN_CASTLE                        = Boolean.parseBoolean(altSettings.getProperty("AltRequireClanCastle", "False"));

                ALT_FESTIVAL_MIN_PLAYER                            = Integer.parseInt(altSettings.getProperty("AltFestivalMinPlayer", "5"));

                ALT_MAXIMUM_PLAYER_CONTRIB                          = Integer.parseInt(altSettings.getProperty("AltMaxPlayerContrib", "1000000"));

+                ONLINE_PLAYERS_AT_STARTUP = Boolean.parseBoolean(altSettings.getProperty("ShowOnlinePlayersAtStartup","True"));

+                ONLINE_PLAYERS_ANNOUNCE_INTERVAL = Integer.parseInt(altSettings.getProperty("OnlinePlayersAnnounceInterval","900000"));

               

                ALT_CLAN_MEMBERS_FOR_WAR    = Integer.parseInt(altSettings.getProperty("AltClanMembersForWar", "15"));

                }

Index: net/sf/l2j/gameserver/clientpackets/EnterWorld.java

===================================================================

--- net/sf/l2j/gameserver/clientpackets/EnterWorld.java (revision 2073)

+++ net/sf/l2j/gameserver/clientpackets/EnterWorld.java (working copy)

-207,7 +207,14 @@

       

        Announcements.getInstance().showAnnouncements(activeChar);

        SevenSigns.getInstance().sendCurrentPeriodMsg(activeChar);

-

+       

+        if(Config.ONLINE_PLAYERS_AT_STARTUP)

+        {

+            sm = new SystemMessage(SystemMessage.S1_S2);

+            sm.addString("Players online: ");

+            sm.addNumber(L2World.getInstance().getAllPlayers().size());

+            sendPacket(sm);

+        }

              Quest.playerEnter(activeChar);

 

              String serverNews = HtmCache.getInstance().getHtm("data/html/servnews.htm");

Index: net/sf/l2j/gameserver/GameServer.java

===================================================================

--- net/sf/l2j/gameserver/GameServer.java      (revision 2073)

+++ net/sf/l2j/gameserver/GameServer.java      (working copy)

-312,8 +312,12 @@

 

        // Spawn the Orators/Preachers if in the Seal Validation period.

        _sevenSignsEngine.spawnSevenSignsNPC();

+       

+        // Start to announce online players number

+        if(Config.ONLINE_PLAYERS_ANNOUNCE_INTERVAL > 0)

+        OnlinePlayers.getInstance();

 

-              _log.config("AutoChatHandler: Loaded " + _autoChatHandler.size() + " handlers in total.");

+        _log.config("AutoChatHandler: Loaded " + _autoChatHandler.size() + " handlers in total.");

              _log.config("AutoSpawnHandler: Loaded " + _autoSpawnHandler.size() + " handlers in total.");

 

              _itemHandler = ItemHandler.getInstance();

Index: net/sf/l2j/gameserver/OnlinePlayers.java

===================================================================

--- net/sf/l2j/gameserver/OnlinePlayers.java    (revision 0)

+++ net/sf/l2j/gameserver/OnlinePlayers.java    (revision 0)

-0,0 +1,30 @@

+package net.sf.l2j.gameserver;

+

+

+import net.sf.l2j.gameserver.model.L2World;

+import net.sf.l2j.Config;

+

+public class OnlinePlayers

+{

+    private static OnlinePlayers _instance;

+

+    class AnnounceOnline implements Runnable

+    {

+        public void run()

+        {

+            Announcements.getInstance().announceToAll("There is: "+L2World.getInstance().getAllPlayers().size()+" online players");

+            ThreadPoolManager.getInstance().scheduleGeneral(new AnnounceOnline(), Config.ONLINE_PLAYERS_ANNOUNCE_INTERVAL);

+        }       

+    }

+   

+    public static OnlinePlayers getInstance()

+    {

+        if ( _instance == null )

+            _instance = new OnlinePlayers();

+        return _instance;

+    }

+    private OnlinePlayers()

+    {

+        ThreadPoolManager.getInstance().scheduleGeneral(new AnnounceOnline(), Config.ONLINE_PLAYERS_ANNOUNCE_INTERVAL);

+    }

+}

\ No newline at end of file

 

then go:

 

OnlinePlayers.java

 

package net.sf.l2j.gameserver;

 

 

import net.sf.l2j.gameserver.model.L2World;

import net.sf.l2j.Config;

 

public class OnlinePlayers

{

    private static OnlinePlayers _instance;

 

    class AnnounceOnline implements Runnable

    {

        public void run()

        {

            Announcements.getInstance().announceToAll("There is: "+L2World.getInstance().getAllPlayers().size()+" online players");

            ThreadPoolManager.getInstance().scheduleGeneral(new AnnounceOnline(), Config.ONLINE_PLAYERS_ANNOUNCE_INTERVAL);

        }       

    }

   

    public static OnlinePlayers getInstance()

    {

        if ( _instance == null )

            _instance = new OnlinePlayers();

        return _instance;

    }

    private OnlinePlayers()

    {

        ThreadPoolManager.getInstance().scheduleGeneral(new AnnounceOnline(), Config.ONLINE_PLAYERS_ANNOUNCE_INTERVAL);

    }

}

 

if u find any errors post here thanks

Posted

if i understand what u mean first u go:

Index: config/altsettings.properties

then

Index: net/sf/l2j/Config.java

then

Index: net/sf/l2j/gameserver/clientpackets/EnterWorld.java

then

Index: net/sf/l2j/gameserver/GameServer.java

then

Index: net/sf/l2j/gameserver/OnlinePlayers.java

 

and u are done;)

  • 3 weeks later...
  • 1 month later...
  • 2 weeks later...
  • 2 months later...
Posted

if (L2World.getInstance().getAllPlayers().size() < 2)

Announcements.getInstance().announceToAll("There is: "+L2World.getInstance().getAllPlayers().size()+" online player");

else

Announcements.getInstance().announceToAll("There are: "+L2World.getInstance().getAllPlayers().size()+" online players");

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



  • Posts

    • Dear friends, we are glad to present our new service — KYC verification for any platforms!️ We verify crypto exchanges, marketplaces, social networks, hosting providers, casinos, and other legitimate websites. Verification is done using a passport or driver’s license. Services engaged in illegal activity are not supported. Available countries: Eastern Europe: Russia, Ukraine, Belarus, Uzbekistan, Armenia, Kyrgyzstan, Kazakhstan — $30–33 European Union (Western Europe, often Latvia and Estonia) — $80–88 Africa: Nigeria, Kenya — $30–33 If you need both registration and verification of your account, an additional 10% fee is applied to the transaction amount. Contact us to request KYC verification or for other support inquiries: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store Active SOCNET Store Links: Digital Goods Store (Website): Go Store Telegram Bot: Go – convenient access to the store via Telegram messenger. Telegram Bot for purchasing Telegram Stars: Go – fast and profitable way to buy Telegram Stars. SMM Panel: Go – promote your social media accounts. We would like to present you the current list of promotions and special offers for purchasing our products and services: 1. Promo code OCTOBER2025 (8% discount) for purchases in our store (Website, Bot) during September! You can also use the first-time promo code SOCNET (15% discount). 2. Get $1 credited to your store balance or a 10–20% discount — simply post your username after registration on our website in the following format: "SEND ME BONUS, MY USERNAME IS..." – post it in our forum thread! 3. Get $1 for your first SMM Panel trial — just open a support ticket titled “Get Trial Bonus” on our website (Support). 4. Weekly Telegram Stars giveaways in our Telegram channel and in our Telegram bot for Star purchases! News: ➡ Telegram Channel: https://t.me/accsforyou_shop ➡ WhatsApp Channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord Server: https://discord.gg/y9AStFFsrh
    • Dear friends, we are glad to present our new service — KYC verification for any platforms!️ We verify crypto exchanges, marketplaces, social networks, hosting providers, casinos, and other legitimate websites. Verification is done using a passport or driver’s license. Services engaged in illegal activity are not supported. Available countries: Eastern Europe: Russia, Ukraine, Belarus, Uzbekistan, Armenia, Kyrgyzstan, Kazakhstan — $30–33 European Union (Western Europe, often Latvia and Estonia) — $80–88 Africa: Nigeria, Kenya — $30–33 If you need both registration and verification of your account, an additional 10% fee is applied to the transaction amount. Contact us to request KYC verification or for other support inquiries: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store Active SOCNET Store Links: Digital Goods Store (Website): Go Store Telegram Bot: Go – convenient access to the store via Telegram messenger. Telegram Bot for purchasing Telegram Stars: Go – fast and profitable way to buy Telegram Stars. SMM Panel: Go – promote your social media accounts. We would like to present you the current list of promotions and special offers for purchasing our products and services: 1. Promo code OCTOBER2025 (8% discount) for purchases in our store (Website, Bot) during September! You can also use the first-time promo code SOCNET (15% discount). 2. Get $1 credited to your store balance or a 10–20% discount — simply post your username after registration on our website in the following format: "SEND ME BONUS, MY USERNAME IS..." – post it in our forum thread! 3. Get $1 for your first SMM Panel trial — just open a support ticket titled “Get Trial Bonus” on our website (Support). 4. Weekly Telegram Stars giveaways in our Telegram channel and in our Telegram bot for Star purchases! News: ➡ Telegram Channel: https://t.me/accsforyou_shop ➡ WhatsApp Channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord Server: https://discord.gg/y9AStFFsrh
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock