Jump to content

[Share]Online player(s) in gs


xAddytzu

Recommended Posts

System.out.println(L2World.getInstance().getAllPlayers().size()+ " online players");
+Announcements.getInstance().announceToAll(L2World.getInstance().getAllPlayers().size()+ " online players");

Link to comment
Share on other sites

Nice.. very good code , Tested and work fine ;) .. I was looking for gameserver code , it helps you .. you dont need login to see players online.. easy and good :D..

Link to comment
Share on other sites

  • 4 months later...
  • 2 weeks later...

Greetings guys, i am newbie in l2j so be patient with me please, if i write this code into java/com/l2jserver/gameserver/gameserver.java i cannot save it and i get an error : "The public type OnlinePlayers must be defined in its own file"

package com.l2jserver.gameserver;

import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.model.L2World;

public class OnlinePlayers
{
private static OnlinePlayers _instance;
class AnnounceOnline implements Runnable
{
	public void run()
	{
		System.out.println(L2World.getInstance().getAllPlayers().size()+ " online players");
		ThreadPoolManager.getInstance().scheduleGeneral(new AnnounceOnline(), 300000); //Delay between system.out.printin 300000=5min
	}
}
private OnlinePlayers()
{
	ThreadPoolManager.getInstance().scheduleGeneral(new AnnounceOnline(), 180000); //Schedule load
}
public static OnlinePlayers getInstance()
{
	if (_instance == null)
		_instance = new OnlinePlayers();
	return _instance;
}
}

 

what's the problem please ?

-and then, after i will compile it through build.xml I need just to copy l2jserver.jar from "build" folder to gameserver folder ?

Thanks.

 

Link to comment
Share on other sites

  • 2 weeks later...

Greetings guys, i am newbie in l2j so be patient with me please, if i write this code into java/com/l2jserver/gameserver/gameserver.java i cannot save it and i get an error : "The public type OnlinePlayers must be defined in its own file"

...

 

what's the problem please ?

-and then, after i will compile it through build.xml I need just to copy l2jserver.jar from "build" folder to gameserver folder ?

Thanks.

You must put at java/com/l2jserver/gameserver and create a new java file with name OnlinePlayers.java and write inside the code that xAddytzu shared.

 

About upgrade your pack with the fix,you will copy paste from build.xml of gameserver the l2jserver.jar and paste at your pack gameserver/libs

Link to comment
Share on other sites

  • 4 weeks later...

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.




×
×
  • Create New...