Guest User

Commands

a guest
Nov 18th, 2015
72
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Commands implements CommandExecutor {
  2. Main main;
  3. MessageManager mm = new MessageManager();
  4.  
  5.  
  6. @Override
  7. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  8.  
  9. if (!((sender) instanceof Player)) {
  10.  
  11. } else {
  12. Player player = (Player) sender;
  13. Player target = Bukkit.getServer().getPlayer(args[1]);
  14. if (cmd.getName().equalsIgnoreCase("clan")) {
  15. if (args.length == 0) {
  16. mm.info(player, "Clans command");
  17. return true;
  18. } else if (args.length == 1) {
  19.  
  20. if (args[0].equalsIgnoreCase("create")) {
  21. if (args.length == 2) {
  22. Clans.createClan(args[1], player);
  23. }
  24. } else if (args[0].equalsIgnoreCase("delete")) {
  25. if (args.length == 2) {
  26. Clans.deleteClan(player, Clans.getClan(player));
  27. }
  28. } else if (args[0].equalsIgnoreCase("add")) {
  29. if (args.length == 2) {
  30. if (args[1].equalsIgnoreCase(target.getName())) {
  31. if (target == null) {
  32. mm.severe(player, "Player not found");
  33. return true;
  34. } else {
  35. Clans.addPlayer(player, target, Clans.getClan(player));
  36. //MESSAGE
  37. return true;
  38. }
  39.  
  40. }
  41. }
  42. } else if (args[0].equalsIgnoreCase("remove")) {
  43. if (args.length == 2) {
  44. if (args[1].equalsIgnoreCase(target.getName())) {
  45. if (target == null) {
  46. mm.severe(player, "Player not found");
  47. return true;
  48. } else {
  49. Clans.removePlayer(player, target, Clans.getClan(player));
  50. //MESSAGE
  51. return true;
  52. }
  53.  
  54. }
  55. }
  56. } else if (args[0].equalsIgnoreCase("leave")) {
  57. Clans.leaveClan(player, Clans.getClan(player));
  58.  
  59. } else if (args[0].equalsIgnoreCase("chat")) {
  60. if (args.length == 2) {
  61. if (args[1].equalsIgnoreCase("on")) {
  62. if (main.chatClan.contains(player.getName())) {
  63. mm.severe(player, "Ja tens o chat do clan ligado");
  64.  
  65. return true;
  66. } else {
  67. main.chatClan.add(player.getName());
  68. mm.info(player, "Chat do clan ligado");
  69.  
  70. return true;
  71. }
  72. } else if (args[1].equalsIgnoreCase("off")) {
  73. if (main.chatClan.contains(player.getName())) {
  74. main.chatClan.remove(player.getName());
  75. mm.info(player, "saiste do chat co clan!");
  76.  
  77. return true;
  78. } else {
  79. mm.info(player, "Nao podes sair, pk nao tas no chat co clan!");
  80.  
  81. return true;
  82. }
  83. }
  84. }
  85. } else if (args[0].equalsIgnoreCase("friendlyfire")) {
  86. if (args.length == 2) {
  87. if (args[1].equalsIgnoreCase("on")) {
  88. if (main.friendlyFireClan.contains(player.getName())) {
  89. mm.severe(player, "o Friendlyfire do teu clan ta ligado");
  90.  
  91. return true;
  92. } else {
  93. main.friendlyFireClan.add(player.getName());
  94. mm.info(player, "ligaste o friendly fire");
  95.  
  96. return true;
  97. }
  98. } else if (args[1].equalsIgnoreCase("off")) {
  99. if (main.friendlyFireClan.contains(player.getName())) {
  100. main.friendlyFireClan.remove(player.getName());
  101. mm.info(player, "desligaste o friendly fire");
  102.  
  103. return true;
  104. } else {
  105. mm.severe(player, "primeiro liga o e depois e que sais!");
  106.  
  107. return true;
  108. }
  109. }
  110. }
  111. }
  112. }
  113.  
  114. }
  115.  
  116. }
  117.  
  118. return false;
  119. }
  120. }
RAW Paste Data