i need a little help, me and a friend are writing a Runescape private server, the base is almost done but for some reason the server just wont run.
im getting a run error cant find main.
code:
package lf;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Scanner;
import lf.item.Item;
import lf.util.HostThrottle;
public class Server implements Runnable {
public Server() {
}
public static final int cycleTime = 600;
public static void main(String args[]) throws Throwable {
if (args.length != 3) {
System.out.println("Usage: [OnSource_password] [OnSource_port] [startup_wait]");
return;
}
OnSource.init(args[0], args[1], args[2]);
Thread t = new Thread() {
@Override
public void run() {
Scanner in = new Scanner(System.in);
while (true) {
try {
String[] args = in.nextLine().split(" ");
args[0] = args[0].toLowerCase();
if (args[0].startsWith("stop")) {
System.out.println("Stopping server...");
playerHandler.update(Integer.parseInt(args[1]));
Thread.sleep(Integer.parseInt(args[1]) * 1000);
Server.stopServer = true;
Server.join(250L);
System.out.println("Server stopped.");
}
} catch (Throwable t) {
t.printStackTrace();
}
}
}
};
t.setDaemon(true);
t.start();
try {
Item.initDefs();
clientHandler = new Server();
(new Thread(clientHandler)).start();
playerHandler = new PlayerHandler();
while (!stopServer) {
long start = System.nanoTime();
try {
playerHandler.process();
} finally {
long time = 600L - ((System.nanoTime() - start) / 1000000L);
if (time > 0L) {
Thread.sleep(time);
}
}
}
} finally {
playerHandler.destruct();
clientHandler.destruct();
down = true;
}
}
public static boolean down;
public static Server clientHandler;
public static ServerSocket clientListener;
public static boolean stopServer = false;
public static boolean stopListener;
public static final int GAME_PORT = 43593;
public static PlayerHandler playerHandler;
public static void join(long step) throws InterruptedException {
while (!Server.down) {
Thread.sleep(step);
}
}
public void run() {
HostThrottle ht = new HostThrottle(3);
ServerSocket ss = null;
try {
try {
ss = new ServerSocket(GAME_PORT);
Misc.println("Game server listening on " + ss.getInetAddress().getHostAddress() + ":" + ss.getLocalPort());
do {
Socket sock = ss.accept();
if (ht.register(sock)) {
sock.setTcpNoDelay(true);
sock.setTrafficClass(0x04 | 0x08);
playerHandler.newPlayer(sock);
} else {
sock.close();
}
} while (!stopListener);
} finally {
if (ss != null) {
ss.close();
}
}
} catch (IOException e) {
if (!stopListener) {
e.printStackTrace();
} else {
Misc.println("Game listener shut down");
}
}
}
public void destruct() {
try {
stopListener = true;
if (clientListener != null) {
clientListener.close();
}
} catch (Throwable e) {
e.printStackTrace();
}
}
}