Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package io.github.thediamondpicks.bans;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.command.CommandExecutor;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import java.util.Objects;
- import java.util.UUID;
- import static org.bukkit.Bukkit.getPlayer;
- /**
- * Created by TheDiamondPicks on 28/09/2016
- */
- public class BanCommand implements CommandExecutor {
- Main main = new Main();
- public boolean onCommand(CommandSender cs, org.bukkit.command.Command cmd, String command, String[] args) {
- if (command.equalsIgnoreCase("ban")) {
- Player s = (Player) cs;
- Player p = getPlayer(args[0]);
- UUID u = p.getUniqueId();
- Main main = new Main();
- boolean id = main.playerExists(p.toString(), u.toString());
- if (!id) {
- s.sendMessage(ChatColor.RED + "That player is not in the database, please check the spelling or use /banuuid along with a UUID if you are certain.");
- }
- else {
- String timestamp = Long.toString(System.currentTimeMillis());
- if (args.length == 2) {
- main.execute("INSERT INTO PermBans (PLAYERNAME, UUID, BANNEDBY, REASON, DATE) VALUES ('" + p.toString() + "', '" + u.toString() + "', " + s.toString() + "', '" + args[1] + "', " + timestamp + "')");
- for (Player player : Bukkit.getOnlinePlayers()) {
- if (player.hasPermission("bans.notify")) {
- player.sendMessage("§5[J&J Bans] §f" + p.toString() + " §dwas permanently banned by §f" + s.toString() + "§d for §f" + args[1]);
- }
- }
- if (p.isOnline()) {
- p.kickPlayer("§4§lYou have been permanently banned from the server!\n\n§cReason: " + "");
- }
- }
- }
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement