Can now show client and server versions.
This commit is contained in:
parent
000d834d42
commit
9d7612cd55
@ -47,10 +47,16 @@ public class Client implements Runnable {
|
||||
}
|
||||
|
||||
public void run() {
|
||||
String uinput;
|
||||
while(thread != null) {
|
||||
try {
|
||||
streamOut.writeUTF(console.readLine());
|
||||
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();
|
||||
|
@ -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++) {
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user