Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package dev.bans;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.OfflinePlayer;
- import org.bukkit.Sound;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandExecutor;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import dev.bans.API;
- import dev.bans.Config;
- import dev.configuração.cfGrupo;
- public class cBan implements CommandExecutor {
- @SuppressWarnings({ "deprecation" })
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
- if (!(sender instanceof Player)) {
- return true;
- }
- final Player jogador = (Player)sender;
- if (cmd.getName().equalsIgnoreCase("ban")) {
- 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")))))))){
- if (args.length == 0) {
- API.sendMsg(jogador, API.PrefixErro, "Comando Correto: /Ban [ Nick ] [ Motivo ]!");
- API.sendSound(jogador, Sound.NOTE_PLING, 10);
- return true;
- }
- Player vitima = Bukkit.getPlayer(args[0]);
- if (vitima == null) {
- OfflinePlayer vitimaoff = Bukkit.getOfflinePlayer(args[0]);
- if (vitimaoff.getName() == jogador.getName()) {
- API.sendMsg(jogador, API.PrefixErro, "Você NÃO pode banir a si mesmo!");
- API.sendSound(jogador, Sound.NOTE_PLING, 10);
- return true;
- }
- if (Config.getConfig().getBans().get("Bans." + vitimaoff.getUniqueId()) != null) {
- API.sendMsg(jogador, API.PrefixErro, "O Jogador " + vitimaoff.getName() + " já está Banido PERMANENTEMENTE!");
- API.sendSound(jogador, Sound.NOTE_PLING, 10);
- return true;
- }
- if (Config.getConfig().getIpBans().get("IPBans." + vitimaoff.getUniqueId()) != null) {
- API.sendMsg(jogador, API.PrefixErro, "O Jogador " + vitimaoff.getName() + " está Banido IP!");
- API.sendSound(jogador, Sound.NOTE_PLING, 10);
- return true;
- }
- if (Config.getConfig().getTempBans().get("TempBans." + vitimaoff.getUniqueId()) != null) {
- API.sendMsg(jogador, API.PrefixErro, "O Jogador " + vitimaoff.getName() + " está Banido TEMPORARIAMENTE!");
- API.sendSound(jogador, Sound.NOTE_PLING, 10);
- return true;
- }
- String Motivo = "";
- for (int i = 1; i < args.length; i++) {
- Motivo = Motivo + args[i] + " ";
- }
- double l = Config.getConfig().getBans().getDouble("Players Banidos");
- API.sendBC(API.PrefixBan, "O Jogador §c" + vitimaoff.getName() + "§7 foi Banido por " + Motivo + "!");
- API.sendMsg(jogador, API.PrefixSucesso, "Banimento à §c" + vitimaoff.getName() + "§a aplicado com sucesso!");
- Config.getConfig().getBans().set("Players Banidos", Double.valueOf(l + 1.0D));
- Config.getConfig().getBans().set("Bans." + vitimaoff.getUniqueId() + ".Nome", vitimaoff.getName());
- Config.getConfig().getBans().set("Bans." + vitimaoff.getUniqueId() + ".Banido por", jogador.getName());
- Config.getConfig().getBans().set("Bans." + vitimaoff.getUniqueId() + ".Motivo", Motivo);
- Config.getConfig().saveBans();
- return true;
- }
- if (vitima.getName() == jogador.getName()) {
- API.sendMsg(jogador, API.PrefixErro, "Você NÃO pode banir a si mesmo!");
- API.sendSound(jogador, Sound.NOTE_PLING, 10);
- return true;
- }
- if (Config.getConfig().getBans().get("Bans." + vitima.getUniqueId()) != null) {
- API.sendMsg(jogador, API.PrefixErro, "O Jogador §7" + vitima.getName() + "§4 já está Banido PERMANENTEMENTE!");
- API.sendSound(jogador, Sound.NOTE_PLING, 10);
- return true;
- }
- if (Config.getConfig().getIpBans().get("IPBans." + vitima.getUniqueId()) != null) {
- API.sendMsg(jogador, API.PrefixErro, "O Jogador §7" + vitima.getName() + "§4 já está Banido por IP!");
- API.sendSound(jogador, Sound.NOTE_PLING, 10);
- return true;
- }
- if (Config.getConfig().getTempBans().get("TempBans." + vitima.getUniqueId()) != null) {
- API.sendMsg(jogador, API.PrefixErro, "O Jogador §7" + vitima.getName() + "§4 já está Banido TEMPORARIAMENTE!");
- API.sendSound(jogador, Sound.NOTE_PLING, 10);
- if (args.length == 1) {
- API.sendMsg(jogador, API.PrefixErro, "Comando Correto: " + ChatColor.GREEN + "/Ban " + args[0] + " [ Motivo ]" + "!");
- API.sendSound(jogador, Sound.NOTE_PLING, 10);
- return true;
- }
- String Motivo = "";
- for (int i = 1; i < args.length; i++) {
- Motivo = Motivo + args[i] + " ";
- }
- double l = Config.getConfig().getBans().getDouble("Players Banidos");
- API.sendBC(API.PrefixBan, "O Jogador §c" + vitima.getName() + "§7 foi Banido por " + Motivo + "!");
- API.sendMsg(jogador, API.PrefixSucesso, "Banimento à §c" + vitima.getName() + "§a aplicado com sucesso!");
- 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");
- Config.getConfig().getBans().set("Players Banidos", Double.valueOf(l + 1.0D));
- Config.getConfig().getBans().set("Bans." + vitima.getUniqueId() + ".Nome", vitima.getName());
- Config.getConfig().getBans().set("Bans." + vitima.getUniqueId() + ".Banido por", jogador.getName());
- Config.getConfig().getBans().set("Bans." + vitima.getUniqueId() + ".Motivo", Motivo);
- Config.getConfig().saveBans();
- return true;
- }
- return false;
- }
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement