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() {
|
public void run() {
|
||||||
|
String uinput;
|
||||||
while(thread != null) {
|
while(thread != null) {
|
||||||
try {
|
try {
|
||||||
streamOut.writeUTF(console.readLine());
|
uinput = console.readLine();
|
||||||
|
if(uinput.equals("/clientVersion")) {
|
||||||
|
System.out.println(version);
|
||||||
|
} else {
|
||||||
|
streamOut.writeUTF(uinput);
|
||||||
streamOut.flush();
|
streamOut.flush();
|
||||||
|
}
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
System.out.println("Sending error: " + e.getMessage());
|
System.out.println("Sending error: " + e.getMessage());
|
||||||
stop();
|
stop();
|
||||||
|
@ -92,6 +92,8 @@ public class Server implements Runnable {
|
|||||||
if(input.equals("/quit")) {
|
if(input.equals("/quit")) {
|
||||||
clients.get(findClient(id)).send("/quit");
|
clients.get(findClient(id)).send("/quit");
|
||||||
remove(id);
|
remove(id);
|
||||||
|
} else if(input.equals("/serverVersion")) {
|
||||||
|
clients.get(findClient(id)).send(version);
|
||||||
} else if(input.equals("/list")) {
|
} else if(input.equals("/list")) {
|
||||||
int pos = findClient(id);
|
int pos = findClient(id);
|
||||||
for(int i = 0; i < clients.size(); i++) {
|
for(int i = 0; i < clients.size(); i++) {
|
||||||
|
@ -59,6 +59,8 @@ public class ServerThread extends Thread {
|
|||||||
" - /myUserName -- Returns your username.\n" +
|
" - /myUserName -- Returns your username.\n" +
|
||||||
" - /pm [id] [msg] -- Sends a message to only one of the clients.\n" +
|
" - /pm [id] [msg] -- Sends a message to only one of the clients.\n" +
|
||||||
" - /setUserName [newusername] -- Change your username.\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" +
|
" - /help -- Show this information.\n" +
|
||||||
" - /quit -- Quit.\n");
|
" - /quit -- Quit.\n");
|
||||||
if(admin) {
|
if(admin) {
|
||||||
|
Loading…
Reference in New Issue
Block a user