Jump to content

Recommended Posts

Posted

/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jfrozen.gameserver.model.entity;

import com.l2jfrozen.Config;
import com.l2jfrozen.gameserver.model.L2World;
import com.l2jfrozen.gameserver.thread.ThreadPoolManager;



/**
* 
* @author Debian
*
*/

public class AnnounceOnlinePlayers
{
    public static void getInstance()
    {
        ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable()
        {
            @Override
            public void run()
            {
                Announce();
            }
        }, 0,Config.ANNOUNCE_ONLINE_PLAYERS_DELAY * 1000);
     }
    
    public static void Announce()
    {
        int NumberofPlayers = L2World.getInstance().getAllPlayers().size();

        if (NumberofPlayers == 1)
            Announcements.getInstance().announceToAll(NumberofPlayers + " player is online.");
        else
            Announcements.getInstance().announceToAll(NumberofPlayers + " players are online.");
    }
}

Code Fixed For L2JFrozen

Posted

/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jfrozen.gameserver.model.entity;

import com.l2jfrozen.Config;
import com.l2jfrozen.gameserver.model.L2World;
import com.l2jfrozen.gameserver.thread.ThreadPoolManager;



/**
* 
* @author Debian
*
*/

public class AnnounceOnlinePlayers
{
    public static void getInstance()
    {
        ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable()
        {
            @Override
            public void run()
            {
                Announce();
            }
        }, 0,Config.ANNOUNCE_ONLINE_PLAYERS_DELAY * 1000);
     }
    
    public static void Announce()
    {
        int NumberofPlayers = L2World.getInstance().getAllPlayers().size();

        if (NumberofPlayers == 1)
            Announcements.getInstance().announceToAll(NumberofPlayers + " player is online.");
        else
            Announcements.getInstance().announceToAll(NumberofPlayers + " players are online.");
    }
}

Code Fixed For L2JFrozen

 

Thanks !!!  :gusta:  :gusta:  :gusta:

  • 3 years later...
Posted

AnnounceOnlinePlayers.java

package net.sf.l2j.gameserver.model.entity;

import net.sf.l2j.commons.concurrent.ThreadPool;

import net.sf.l2j.Config;
import net.sf.l2j.gameserver.model.World;
import net.sf.l2j.gameserver.util.Broadcast;

public class AnnounceOnlinePlayers
{
	public static void getInstance()
	{
		ThreadPool.scheduleAtFixedRate(new Runnable()
		{
			@Override
			public void run()
			{
				Announce();
			}
		}, 0, Config.ANNOUNCE_ONLINE_PLAYERS_DELAY * 1000);
	}

	protected static void Announce()
	{
		int NumberofPlayers = World.getInstance().getPlayers().size();
		
		if (NumberofPlayers == 1)
			Broadcast.announceToOnlinePlayers(NumberofPlayers + " player is online.");
		else
			Broadcast.announceToOnlinePlayers(NumberofPlayers + " player are online.");
	}
}
  • 2 months later...
Posted

Can be shortcuted to:

ThreadPool.scheduleAtFixedRate(() -> Broadcast.announceToOnlinePlayers(World.getInstance().getPlayers().size() + " online player(s)."), 0, Config.ANNOUNCE_ONLINE_PLAYERS_DELAY * 1000);

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • Top Up the Way You Like — PayPal is Back with Us! We're excited to announce that we now accept PayPal again! That means even more ways to fund your balance in our store Available Payment Methods: ➡ Cryptocurrency (USDT, BTC, ETH, LTC, and more) ➡ Crypto Bot in Telegram ➡ Telegram Stars ➡ Bank Cards ➡ Lolz Balance ➡ Binance Pay ➡ Crystal Pay — crystalpay.io ➡ Wata (Bank Cards) ➡ Payeer ➡ AliPay ➡ PayPal (Friends & Family only) Also Available on the Website: ➡ Binance Gift Cards ➡ Google Pay/Apple Pay Promo Code: PAYPAL5 (5% Discount) How to Buy: ➡ Online Store: Click ➡ Telegram Bot: Click Other Services: ➡ SMM Panel: Click Returning customers enjoy extra discounts and promo codes! Support: ➡ Telegram: https://t.me/solomon_bog ➡ Telegram Channel: https://t.me/accsforyou_shop ➡ Discord: https://discord.gg/y9AStFFsrh ➡ WhatsApp: https://wa.me/79051904467 ➡ ✉ Email: solomonbog@socnet.store You can also use these contacts to: — Get consultation on wholesale purchases — Establish a partnership (Current partners: https://socnet.bgng.io/partners) — Become our supplier SocNet — Your Store for Digital Goods & Premium Subscriptions
    • Top Up the Way You Like — PayPal is Back with Us! We're excited to announce that we now accept PayPal again! That means even more ways to fund your balance in our store Available Payment Methods: ➡ Cryptocurrency (USDT, BTC, ETH, LTC, and more) ➡ Crypto Bot in Telegram ➡ Telegram Stars ➡ Bank Cards ➡ Lolz Balance ➡ Binance Pay ➡ Crystal Pay — crystalpay.io ➡ Wata (Bank Cards) ➡ Payeer ➡ AliPay ➡ PayPal (Friends & Family only) Also Available on the Website: ➡ Binance Gift Cards ➡ Google Pay/Apple Pay Promo Code: PAYPAL5 (5% Discount) How to Buy: ➡ Online Store: Click ➡ Telegram Bot: Click Other Services: ➡ SMM Panel: Click Returning customers enjoy extra discounts and promo codes! Support: ➡ Telegram: https://t.me/solomon_bog ➡ Telegram Channel: https://t.me/accsforyou_shop ➡ Discord: https://discord.gg/y9AStFFsrh ➡ WhatsApp: https://wa.me/79051904467 ➡ ✉ Email: solomonbog@socnet.store You can also use these contacts to: — Get consultation on wholesale purchases — Establish a partnership (Current partners: https://socnet.bgng.io/partners) — Become our supplier SocNet — Your Store for Digital Goods & Premium Subscriptions
    • We are taking new orders. Kindly DM us on Telegram!
    • Dear friends, Just a reminder - our Open Beta Test begins today at 18:00! Join us to explore the world together, test the update, and help us make it even better. See you in game!    The Chronicle 4 client is now available for download.
    • I tried mate with a fresh Freya, H5, H5 part 5, and always the same issue. I can't enter inside the Game, as it appears black. I. Can hear sound and so on from the starting location and quest, but I can't see a thing I installed the chinese language on windows, and still does not work , I always get black screen when i try to enter into the game after selecting the characters. I hear sounds, environment and so on, but i can see anything Also tried with a fresh freya client as well, i can see the english words and so on, but i cant enter inside the game...i dont understand whats going wrong
  • 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