From bf2c69bb3220dc24ca5a827c7fc72f620cd57d52 Mon Sep 17 00:00:00 2001 From: Deathsbreed Date: Mon, 17 Nov 2014 16:57:37 -0600 Subject: [PATCH] Ban needs a little bit of work, but almost functional. --- src/consolechat/server/Server.java | 2 +- src/consolechat/server/ServerThread.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/consolechat/server/Server.java b/src/consolechat/server/Server.java index fc8b3cd..34cfc5c 100644 --- a/src/consolechat/server/Server.java +++ b/src/consolechat/server/Server.java @@ -149,7 +149,7 @@ public class Server implements Runnable { } else if(input.length() > 11 && input.substring(0, 4).equals("/ban")) { if(clients.get(findClient(id)).isAdmin()) { int bID = Integer.parseInt(input.substring(5, 10)); - String reason = input.substring(12); + String reason = input.substring(11); ban(bID, reason); } else { clients.get(findClient(id)).send("You are not admin."); diff --git a/src/consolechat/server/ServerThread.java b/src/consolechat/server/ServerThread.java index 224081a..be31304 100644 --- a/src/consolechat/server/ServerThread.java +++ b/src/consolechat/server/ServerThread.java @@ -74,7 +74,8 @@ public class ServerThread extends Thread { send("Admin commands:\n" + " - /chgpasswd [newpasswd] -- Change the server admin password.\n" + " - /giveadmin [id] -- Give another client admin as well.\n" + - " - /kick [id] [reason] -- Kick out a user and state a reason for the kick.\n"); + " - /kick [id] [reason] -- Kick out a user and state a reason for the kick.\n" + + " - /ban [id] [reason] -- Ban a user from ever being able to connect to the server again.\n"); } } else if(command.length() > 6 && command.substring(0, 6).equals("/admin")) { if(command.substring(7).equals(server.getPasswd())) {