Gameserver Show OnlinePlayers

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
pajington
Posts: 21
Joined: Wed Aug 05, 2009 10:42 am

Gameserver Show OnlinePlayers

Post by pajington »

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"

Code: Select all

 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.
User avatar
jurchiks
Posts: 6769
Joined: Sat Sep 19, 2009 4:16 pm
Location: Eastern Europe

Re: Gameserver Show OnlinePlayers

Post by jurchiks »

It needs to be in a separate class...
Also, your version won't announce anything to anyone, system.out.println prints the text in gameserver console.
Here's the original, and it works: viewtopic.php?f=69&t=13069
Don't try to make things up if you don't know java.
If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.
pajington
Posts: 21
Joined: Wed Aug 05, 2009 10:42 am

Re: Gameserver Show OnlinePlayers

Post by pajington »

y i know that it'll be showed just in console....thanks for the link ;)
Post Reply