Guest User

Commands

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