Kick.java 608 B

123456789101112131415161718192021222324252627282930313233343536
  1. package command;
  2. import server.Client;
  3. import server.Server;
  4. public class Kick extends Command {
  5. @Override
  6. public void execute(String[] args, Client caller) {
  7. try {
  8. Server.getUserByName(args[0]).disconnect(false);
  9. } catch (NullPointerException ex) {
  10. caller.send("No user called " + args[0] + "!");
  11. }
  12. }
  13. @Override
  14. public String getName() {
  15. return "kick";
  16. }
  17. @Override
  18. public int getMinArgNumber() {
  19. return 1;
  20. }
  21. @Override
  22. public String writeDescription() {
  23. return "Kicks a user. (/kick <username>)";
  24. }
  25. @Override
  26. public String getPermission() {
  27. return "server.kick";
  28. }
  29. }