Implemented basic client/server connection and title font

This commit is contained in:
Anuken
2017-12-30 18:40:02 -05:00
parent c14e233723
commit 79e18f7f4d
21 changed files with 462 additions and 409 deletions

View File

@@ -19,13 +19,15 @@ public class Net{
/**Connect to an address.*/
public static void connect(String ip, int port) throws IOException{
clientProvider.connect(ip, port);
active = true;
server = false;
}
/**Host a server at an address*/
public static void host(int port) throws IOException{
serverProvider.host(port);
active = true;
server = true;
serverProvider.host(port);
}
/**Closes the server.*/
@@ -34,6 +36,12 @@ public class Net{
server = false;
active = false;
}
public static void disconnect(){
clientProvider.disconnect();
server = false;
active = false;
}
/**Send an object to all connected clients, or to the server if this is a client.*/
public static void send(Object object, SendMode mode){
@@ -108,6 +116,8 @@ public class Net{
public void updatePing();
/**Get ping in milliseconds. Will only be valid after a call to updatePing.*/
public int getPing();
/**Disconnect from the server.*/
public void disconnect();
/**Register classes to be sent.*/
public void register(Class<?>... types);
}