Vkouk Posted February 3, 2010 Posted February 3, 2010 Well,hi.What to say?Since i am starting practise with java this is my first code,soon i'll try to make more and better codes...I made it for l2j interlude but with some modifications could be for gracia too.A note:Since i have tested petemezi's code and doesn't work,i did again.I hope you like it :).Just press .online in game and will see how many players are online. Index: java/net/sf/l2j/gameserver/GameServer.java =================================================================== --- java/net/sf/l2j/gameserver/GameServer.java (revision 147) +++ java/net/sf/l2j/gameserver/GameServer.java (working copy) @@ -209,6 +209,7 @@ import net.sf.l2j.gameserver.handler.usercommandhandlers.PartyInfo; import net.sf.l2j.gameserver.handler.usercommandhandlers.Time; import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Banking; +import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Online; import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Wedding; import net.sf.l2j.gameserver.handler.voicedcommandhandlers.stats; import net.sf.l2j.gameserver.idfactory.IdFactory; @@ -625,8 +626,10 @@ if(Config.BANKING_SYSTEM_ENABLED) _voicedCommandHandler.registerVoicedCommandHandler(new Banking()); + + if(Config.ONLINE_PLAYERS) + _voicedCommandHandler.registerVoicedCommandHandler(new Online()); - _log.config("VoicedCommandHandler: Loaded " + _voicedCommandHandler.size() + " handlers."); Index: java/net/sf/l2j/Config.java =================================================================== --- java/net/sf/l2j/Config.java (revision 147) +++ java/net/sf/l2j/Config.java (working copy) @@ -963,6 +963,7 @@ public static boolean ALT_GAME_FLAGED_PLAYER_CAN_USE_GK; public static boolean SHOW_WELCOME_HTML_ON_PLAYER_LOGIN; public static int TRADE_UNITS; + public static boolean ONLINE_PLAYERS; /** Custom Project Modifications - End */ /** FloodProtector - Start */ @@ -2069,6 +2070,7 @@ STARTING_TITLE = L2JModSettings.getProperty("StartingTitle", "Something"); SHOW_WELCOME_HTML_ON_PLAYER_LOGIN = Boolean.parseBoolean(L2JModSettings.getProperty("ShowWelcomeHtmlOnLogin", "False")); TRADE_UNITS = Integer.parseInt(L2JModSettings.getProperty("TradeUnits", "250")); + ONLINE_PLAYERS = Boolean.parseBoolean(L2JModSettings.getProperty("OnlinePLayers", "False")); /** Custom Project Modifications - End */ Index: java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Online.java =================================================================== --- java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Online.java (revision 0) +++ java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Online.java (revision 0) @@ -0,0 +1,39 @@ +/* This program is free software; you can redistribute it and/or modify */ +package net.sf.l2j.gameserver.handler.voicedcommandhandlers; + + +import net.sf.l2j.gameserver.handler.IVoicedCommandHandler; +import net.sf.l2j.gameserver.model.L2World; +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; + +/** +* +* @author +* +* this class... +* shows the amount of online players to any1 who calls it. +*/ +public class Online implements IVoicedCommandHandler +{ + + +private static final String[] VOICED_COMMANDS = { "online" }; + +public boolean useVoicedCommand(String command, L2PcInstance player, String target) +{ +if (command.equalsIgnoreCase("online")) +{ + player.sendMessage("======<Online Players>======"); + player.sendMessage("There are "+L2World.getInstance().getAllPlayers().size()+" players online"); + player.sendMessage("======================="); +}return true; + +} + + + +public String[] getVoicedCommandList() +{ + return VOICED_COMMANDS; +} +} \ No newline at end of file Index: java/config/l2jmods.properties =================================================================== --- java/config/l2jmods.properties (revision 147) +++ java/config/l2jmods.properties (working copy) @@ -289,3 +289,8 @@ # This Will Not Alow The Players To Trade From Too Far # NOTE: DO NOT PUT 0 !!! TradeUnits = 250 + +# Allows user to use .online Command +# Displays The Number of The Players That are Currently Online. +# Default : False +OnlinePLayers = False Tested And absolutely working. Ventic
Commodus Posted February 3, 2010 Posted February 3, 2010 Simple & easy to create it. Keep working bro ^^
Freyr Posted February 3, 2010 Posted February 3, 2010 Well nice... Keep practising in java ^^ I want to see you soon promoted :)
Vkouk Posted February 3, 2010 Author Posted February 3, 2010 Simple & easy to create it. Keep working bro ^^ I know.Very easy.But i want to thanks some teachers like Coyote-Krash-MaestroLuke(thanks brothers) Well nice... Keep practising in java ^^ I want to see you soon promoted :) ofc.on saturday i will buy book for java.so i can practise more.promoted?what do you mean?to l2jdev?No i don't want this position.I am fine with my gold membership
Freyr Posted February 3, 2010 Posted February 3, 2010 I know.Very easy.But i want to thanks some teachers like Coyote-Krash-MaestroLuke(thanks brothers)ofc.on saturday i will buy book for java.so i can practise more.promoted?what do you mean?to l2jdev?No i don't want this position.I am fine with my gold membership i mean to promote your skills more :)
Vkouk Posted February 3, 2010 Author Posted February 3, 2010 i mean to promote your skills more :) my fault then.Yep sure.I'll try for something cool.
Kяaσh Posted February 3, 2010 Posted February 3, 2010 Cool share ventic , you learn fast :) thanks for sharing with us
Vkouk Posted February 3, 2010 Author Posted February 3, 2010 Cool share ventic , you learn fast :) thanks for sharing with us Not really.I need more practise.Btw thanks brother.
CriticalError Posted February 6, 2010 Posted February 6, 2010 wow really nice work mate thanks a lot for sharing this :;)
Vkouk Posted February 6, 2010 Author Posted February 6, 2010 wow really nice work mate thanks a lot for sharing this :;) thanks a lot CE and welcome back ;)
`Peter Posted February 10, 2010 Posted February 10, 2010 I am fine with my gold membership Actually you are not, obviously because of your inactivity. Anyway, this is shared already since 2008.
Vkouk Posted February 10, 2010 Author Posted February 10, 2010 Actually you are not, obviously because of your inactivity. Anyway, this is shared already since 2008. axaxaxaxaxa inactivity?how do you know that?you have 17 posts and you can tell me that i am inactive.log off plz.
`Peter Posted February 12, 2010 Posted February 12, 2010 axaxaxaxaxa inactivity?how do you know that?you have 17 posts and you can tell me that i am inactive.log off plz. ^^, i know everything.
Vkouk Posted February 12, 2010 Author Posted February 12, 2010 ^^, i know everything. Are you maxtor? :O
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now