Can now show client and server versions.

This commit is contained in:
Deathsbreed 2014-05-04 20:18:33 -05:00
parent 000d834d42
commit 9d7612cd55
3 changed files with 12 additions and 2 deletions

View File

@ -47,10 +47,16 @@ public class Client implements Runnable {
}
public void run() {
String uinput;
while(thread != null) {
try {
streamOut.writeUTF(console.readLine());
streamOut.flush();
uinput = console.readLine();
if(uinput.equals("/clientVersion")) {
System.out.println(version);
} else {
streamOut.writeUTF(uinput);
streamOut.flush();
}
} catch(IOException e) {
System.out.println("Sending error: " + e.getMessage());
stop();

View File

@ -92,6 +92,8 @@ public class Server implements Runnable {
if(input.equals("/quit")) {
clients.get(findClient(id)).send("/quit");
remove(id);
} else if(input.equals("/serverVersion")) {
clients.get(findClient(id)).send(version);
} else if(input.equals("/list")) {
int pos = findClient(id);
for(int i = 0; i < clients.size(); i++) {

View File

@ -59,6 +59,8 @@ public class ServerThread extends Thread {
" - /myUserName -- Returns your username.\n" +
" - /pm [id] [msg] -- Sends a message to only one of the clients.\n" +
" - /setUserName [newusername] -- Change your username.\n" +
" - /clientVersion -- Returns the version of the client.\n" +
" - /serverVersion -- Returns the version of the server.\n" +
" - /help -- Show this information.\n" +
" - /quit -- Quit.\n");
if(admin) {