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

    • someone ban again this piece of shit this guy is a virus we should make an antikara or karabytes
    • 🍂 The cost on Vibe-sms is dropping, like autumn leaves falling from the trees.     It’s a little sad to watch the last days of summer fade away with its warmth, but that’s how the world works  every season has its own rules. The same goes for our prices: they are gradually but steadily going down, opening up new opportunities and great deals. 💸   🌍 USA is already at the minimum, and Europe, Asia, and dozens of other countries will follow soon. Don’t miss out  fresh rates are waiting for you!   Website link — https://vibe-sms.net/ Our Telegram channel — https://t.me/vibe_sms
    • You didn't tell me anywhere that you wanted core.jar as proof, I have everything ready for an independent developer to review. All the conversations, all your edits. I won't settle anything with you, so you can threaten me again and damage my name.
    • So what? Did i say anything wrong? You have no idea what source/compile is. I still wait for your .jar or source to be posted since you say i destroyed the compiled version of yours. Why you don't post it? Are you afraid that people will just see few addon lines and you did not even know that your source and compiled had different things? I should not even waste 2 minute to fix your raidboss_spawnlist thing.    Your mentally ill. What you posted is our primary deal nothing against me.  Because all he does is post whatever i write as if i hide and i did not say any mod to join and check my discord. i want him actual post something against me or any offenses i did. I also requested him several hours ago to post his .jar where my code "HACKED" his server but he wont post.    Nobody should allow open a random topic and cause issues to other's life without proofs. I demand punishment and soon unless he post evidence that i hurt his server or left him or did not make what he asked. 
  • 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