Advertisement
Guest User

Untitled

a guest
Feb 1st, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.70 KB | None | 0 0
  1. package dev.bans;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.ChatColor;
  5. import org.bukkit.OfflinePlayer;
  6. import org.bukkit.Sound;
  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. import dev.bans.API;
  13. import dev.bans.Config;
  14. import dev.configuração.cfGrupo;
  15.  
  16. public class cBan implements CommandExecutor {
  17.  
  18. @SuppressWarnings({ "deprecation" })
  19. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  20.  
  21. if (!(sender instanceof Player)) {
  22. return true;
  23. }
  24. final Player jogador = (Player)sender;
  25. if (cmd.getName().equalsIgnoreCase("ban")) {
  26. if((cfGrupo.ChecarGrupo(jogador, "Dono") || (cfGrupo.ChecarGrupo(jogador, "Dono-Geral") || (cfGrupo.ChecarGrupo(jogador, "Admin-Geral") || (cfGrupo.ChecarGrupo(jogador, "Admin") || (cfGrupo.ChecarGrupo(jogador, "ModFull") || (cfGrupo.ChecarGrupo(jogador, "Mod")))))))){
  27. if (args.length == 0) {
  28. API.sendMsg(jogador, API.PrefixErro, "Comando Correto: /Ban [ Nick ] [ Motivo ]!");
  29. API.sendSound(jogador, Sound.NOTE_PLING, 10);
  30. return true;
  31. }
  32. Player vitima = Bukkit.getPlayer(args[0]);
  33. if (vitima == null) {
  34. OfflinePlayer vitimaoff = Bukkit.getOfflinePlayer(args[0]);
  35. if (vitimaoff.getName() == jogador.getName()) {
  36. API.sendMsg(jogador, API.PrefixErro, "Você NÃO pode banir a si mesmo!");
  37. API.sendSound(jogador, Sound.NOTE_PLING, 10);
  38. return true;
  39. }
  40. if (Config.getConfig().getBans().get("Bans." + vitimaoff.getUniqueId()) != null) {
  41. API.sendMsg(jogador, API.PrefixErro, "O Jogador " + vitimaoff.getName() + " já está Banido PERMANENTEMENTE!");
  42. API.sendSound(jogador, Sound.NOTE_PLING, 10);
  43. return true;
  44. }
  45. if (Config.getConfig().getIpBans().get("IPBans." + vitimaoff.getUniqueId()) != null) {
  46. API.sendMsg(jogador, API.PrefixErro, "O Jogador " + vitimaoff.getName() + " está Banido IP!");
  47. API.sendSound(jogador, Sound.NOTE_PLING, 10);
  48. return true;
  49. }
  50. if (Config.getConfig().getTempBans().get("TempBans." + vitimaoff.getUniqueId()) != null) {
  51. API.sendMsg(jogador, API.PrefixErro, "O Jogador " + vitimaoff.getName() + " está Banido TEMPORARIAMENTE!");
  52. API.sendSound(jogador, Sound.NOTE_PLING, 10);
  53. return true;
  54. }
  55. String Motivo = "";
  56. for (int i = 1; i < args.length; i++) {
  57. Motivo = Motivo + args[i] + " ";
  58. }
  59. double l = Config.getConfig().getBans().getDouble("Players Banidos");
  60. API.sendBC(API.PrefixBan, "O Jogador §c" + vitimaoff.getName() + "§7 foi Banido por " + Motivo + "!");
  61. API.sendMsg(jogador, API.PrefixSucesso, "Banimento à §c" + vitimaoff.getName() + "§a aplicado com sucesso!");
  62.  
  63. Config.getConfig().getBans().set("Players Banidos", Double.valueOf(l + 1.0D));
  64. Config.getConfig().getBans().set("Bans." + vitimaoff.getUniqueId() + ".Nome", vitimaoff.getName());
  65. Config.getConfig().getBans().set("Bans." + vitimaoff.getUniqueId() + ".Banido por", jogador.getName());
  66. Config.getConfig().getBans().set("Bans." + vitimaoff.getUniqueId() + ".Motivo", Motivo);
  67. Config.getConfig().saveBans();
  68. return true;
  69. }
  70. if (vitima.getName() == jogador.getName()) {
  71. API.sendMsg(jogador, API.PrefixErro, "Você NÃO pode banir a si mesmo!");
  72. API.sendSound(jogador, Sound.NOTE_PLING, 10);
  73. return true;
  74. }
  75. if (Config.getConfig().getBans().get("Bans." + vitima.getUniqueId()) != null) {
  76. API.sendMsg(jogador, API.PrefixErro, "O Jogador §7" + vitima.getName() + "§4 já está Banido PERMANENTEMENTE!");
  77. API.sendSound(jogador, Sound.NOTE_PLING, 10);
  78. return true;
  79. }
  80. if (Config.getConfig().getIpBans().get("IPBans." + vitima.getUniqueId()) != null) {
  81. API.sendMsg(jogador, API.PrefixErro, "O Jogador §7" + vitima.getName() + "§4 já está Banido por IP!");
  82. API.sendSound(jogador, Sound.NOTE_PLING, 10);
  83. return true;
  84. }
  85. if (Config.getConfig().getTempBans().get("TempBans." + vitima.getUniqueId()) != null) {
  86. API.sendMsg(jogador, API.PrefixErro, "O Jogador §7" + vitima.getName() + "§4 já está Banido TEMPORARIAMENTE!");
  87. API.sendSound(jogador, Sound.NOTE_PLING, 10);
  88.  
  89. if (args.length == 1) {
  90. API.sendMsg(jogador, API.PrefixErro, "Comando Correto: " + ChatColor.GREEN + "/Ban " + args[0] + " [ Motivo ]" + "!");
  91. API.sendSound(jogador, Sound.NOTE_PLING, 10);
  92. return true;
  93. }
  94. String Motivo = "";
  95. for (int i = 1; i < args.length; i++) {
  96. Motivo = Motivo + args[i] + " ";
  97. }
  98. double l = Config.getConfig().getBans().getDouble("Players Banidos");
  99. API.sendBC(API.PrefixBan, "O Jogador §c" + vitima.getName() + "§7 foi Banido por " + Motivo + "!");
  100. API.sendMsg(jogador, API.PrefixSucesso, "Banimento à §c" + vitima.getName() + "§a aplicado com sucesso!");
  101. vitima.kickPlayer("§cOver§7-§fNetwork \n§7Você foi Banido §cPERMANENTEMENTE §7do Servidor! \n §7Pelo Staffer §c" + jogador.getName() + " \n §7pelo Motivo §c" + Motivo + "\n§7Compre Unban em: §7www.central-network.com.br! \n§7Banimento Injusto? Fale com um membro da Diretoria no TeamSpeak3! \n§7Ip Ts3: §ccentral-network.com.br");
  102.  
  103. Config.getConfig().getBans().set("Players Banidos", Double.valueOf(l + 1.0D));
  104. Config.getConfig().getBans().set("Bans." + vitima.getUniqueId() + ".Nome", vitima.getName());
  105. Config.getConfig().getBans().set("Bans." + vitima.getUniqueId() + ".Banido por", jogador.getName());
  106. Config.getConfig().getBans().set("Bans." + vitima.getUniqueId() + ".Motivo", Motivo);
  107. Config.getConfig().saveBans();
  108. return true;
  109. }
  110. return false;
  111. }
  112.  
  113. }
  114. return false;
  115. }
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement