i was selling this. now its for free i don't want to sell it any more.
take a look here:
L2PcInstance.java
public class PingP implements Runnable
{
@Override
public void run()
{
try
{
ping("www.google.gr");
}
catch (Exception e)
{
e.printStackTrace();
}
ThreadPoolManager.getInstance().scheduleGeneral(new PingP(), 4 * 1000);
}
public void ping(String addr) throws Exception
{
final Socket socket = new Socket();
final long startTime = System.currentTimeMillis();
socket.connect(new InetSocketAddress(addr, 80));
final long endTime = System.currentTimeMillis();
final int ping = ((int) (endTime-startTime));
sendPacket(new ExShowScreenMessage(1,0,ExShowScreenMessage.SMPOS.TOP_RIGHT,false,1,0,0,false,9999,false,"Ping: " + ping));
socket.close();
}
}
public void startPing()
{
ThreadPoolManager.getInstance().scheduleGeneral(new PingP(), 4 * 1000);
}
EntreWorld.java
activeChar.startPing();
tips: just change the ip(put your server no-ip) and the port. also you can change the style you can put it in a window at the top(right) of the screen(like pc bang points) or dunno do anything you want i just gave the idea. :)