WhiteFace Posted June 25, 2009 Posted June 25, 2009 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 Quote
ExTrEmEDwarf Posted June 25, 2009 Posted June 25, 2009 u just need to c/p this to gameserver/config/altsettings.properties? no further edit on the pack? Continue sharing u'll get my +1 karma :p Quote
WhiteFace Posted June 25, 2009 Author Posted June 25, 2009 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;) Quote
ExTrEmEDwarf Posted June 25, 2009 Posted June 25, 2009 thanks alot, and i would appreciate if u could post a nice guide with screens about how to use maven and eclipse. thnx in advance Quote
WhiteFace Posted June 25, 2009 Author Posted June 25, 2009 in this u need only eclipse try this guide: http://www.maxcheaters.com/forum/index.php?topic=3400.0 Quote
ExTrEmEDwarf Posted June 25, 2009 Posted June 25, 2009 in this u need only eclipse try this guide: http://www.maxcheaters.com/forum/index.php?topic=3400.0 thanks, i didnt notice this post after all my searches. Quote
Horus Posted July 14, 2009 Posted July 14, 2009 CommunityBoard (Alt+B) is causing high CPU using (lags)!! Just do what I did: Caching; ^^ Quote
MasterDisaster Posted July 14, 2009 Posted July 14, 2009 Awesome man thx :D... Really alt+B sux :( Quote
~Sensei~ Posted August 23, 2009 Posted August 23, 2009 idk what pack you use, but with most this is added since idk.. interlude lol if not sooner. Quote
mody405 Posted September 2, 2009 Posted September 2, 2009 nice dude its really good share , im going to try it now ;) Quote
xAddytzu Posted November 25, 2009 Posted November 25, 2009 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"); Quote
Recommended Posts
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.