Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package punish.ban;
- import java.util.Date;
- import java.util.UUID;
- import org.bukkit.BanList;
- import org.bukkit.Bukkit;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.player.PlayerLoginEvent;
- import org.bukkit.event.player.PlayerLoginEvent.Result;
- import api.colour.ChatColour;
- import punish.PunishManager;
- public class BanManager implements Listener {
- public static int banNumber;
- private static String banString = String.format("%09d", banNumber);
- public static void ban(long time, String reason, UUID player) {
- BanList ban = Bukkit.getBanList(BanList.Type.NAME);
- String tempBanMessage = ChatColour.Colour("&cYou are temporarily banned for &f29d 23h 59m 59s &cfrom this server!\n\n" +
- "&7Reason: &fHacked Client [" + PunishManager.proof + "]\n" +
- "&7Find out more: &fwebsite I don't own\n\n" +
- "&7Ban ID: &f#" + banString + "\n" +
- "&7Sharing your Ban ID could affect the processing of your appeal!");
- ;
- String permBanMessage = ChatColour.Colour("&cYou are permanently banned from this server!\n\n" +
- "&7Reason: &fHacked Client [" + PunishManager.proof + "]\n" +
- "&7Find out more: &fwebsite I don't own\n\n" +
- "&7Ban ID: &f#" + banString + "\n" +
- "&7Sharing your Ban ID could affect the processing of your appeal!");
- // Player Offline
- if (!(Bukkit.getOfflinePlayer(player).isOnline())) {
- Bukkit.broadcastMessage(ChatColour.Colour("&c&lA player has been removed from your game for hacking or abuse. &fThanks for reporting it!"));
- }
- // Player Online
- if (Bukkit.getOfflinePlayer(player).isOnline()) {
- Bukkit.broadcastMessage(ChatColour.Colour("&c&lA player has been removed from your game for hacking or abuse. &fThanks for reporting it!"));
- /* HACKED CLIENT */
- if (reason.equalsIgnoreCase("HC-1")) {
- Bukkit.getPlayer(player).kickPlayer(tempBanMessage);
- Date date = new Date(System.currentTimeMillis() + 60*1000);
- ban.addBan(Bukkit.getOfflinePlayer(player).getName(), tempBanMessage, date, null);
- }
- if (reason.equalsIgnoreCase("HC-2")) {
- Bukkit.getPlayer(player).kickPlayer(tempBanMessage);
- }
- if (reason.equalsIgnoreCase("HC-3")) {
- Bukkit.getPlayer(player).kickPlayer(permBanMessage);
- }
- /* */
- }
- }
- @EventHandler
- public void onPlayerJoin(PlayerLoginEvent event) {
- if (event.getResult().equals(Result.KICK_BANNED)) {
- event.setKickMessage(ChatColour.Colour("&cYou are permanently banned from this server!\n\n" +
- "&7Reason: &fHacked Client [" + PunishManager.proof + "]\n" +
- "&7Find out more: &fwebsite I don't own\n\n" +
- "&7Ban ID: &f#" + banString + "\n" +
- "&7Sharing your Ban ID could affect the processing of your appeal!"));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement