Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.82 KB | None | 0 0
  1. package punish.ban;
  2.  
  3. import java.util.Date;
  4. import java.util.UUID;
  5.  
  6. import org.bukkit.BanList;
  7. import org.bukkit.Bukkit;
  8. import org.bukkit.event.EventHandler;
  9. import org.bukkit.event.Listener;
  10. import org.bukkit.event.player.PlayerLoginEvent;
  11. import org.bukkit.event.player.PlayerLoginEvent.Result;
  12.  
  13. import api.colour.ChatColour;
  14. import punish.PunishManager;
  15.  
  16. public class BanManager implements Listener {
  17.  
  18. public static int banNumber;
  19. private static String banString = String.format("%09d", banNumber);
  20.  
  21. public static void ban(long time, String reason, UUID player) {
  22.  
  23. BanList ban = Bukkit.getBanList(BanList.Type.NAME);
  24.  
  25. String tempBanMessage = ChatColour.Colour("&cYou are temporarily banned for &f29d 23h 59m 59s &cfrom this server!\n\n" +
  26. "&7Reason: &fHacked Client [" + PunishManager.proof + "]\n" +
  27. "&7Find out more: &fwebsite I don't own\n\n" +
  28. "&7Ban ID: &f#" + banString + "\n" +
  29. "&7Sharing your Ban ID could affect the processing of your appeal!");
  30. ;
  31. String permBanMessage = ChatColour.Colour("&cYou are permanently banned from this server!\n\n" +
  32. "&7Reason: &fHacked Client [" + PunishManager.proof + "]\n" +
  33. "&7Find out more: &fwebsite I don't own\n\n" +
  34. "&7Ban ID: &f#" + banString + "\n" +
  35. "&7Sharing your Ban ID could affect the processing of your appeal!");
  36.  
  37.  
  38. // Player Offline
  39. if (!(Bukkit.getOfflinePlayer(player).isOnline())) {
  40.  
  41. Bukkit.broadcastMessage(ChatColour.Colour("&c&lA player has been removed from your game for hacking or abuse. &fThanks for reporting it!"));
  42.  
  43. }
  44.  
  45.  
  46.  
  47. // Player Online
  48. if (Bukkit.getOfflinePlayer(player).isOnline()) {
  49.  
  50. Bukkit.broadcastMessage(ChatColour.Colour("&c&lA player has been removed from your game for hacking or abuse. &fThanks for reporting it!"));
  51.  
  52. /* HACKED CLIENT */
  53. if (reason.equalsIgnoreCase("HC-1")) {
  54. Bukkit.getPlayer(player).kickPlayer(tempBanMessage);
  55. Date date = new Date(System.currentTimeMillis() + 60*1000);
  56. ban.addBan(Bukkit.getOfflinePlayer(player).getName(), tempBanMessage, date, null);
  57. }
  58.  
  59. if (reason.equalsIgnoreCase("HC-2")) {
  60. Bukkit.getPlayer(player).kickPlayer(tempBanMessage);
  61. }
  62.  
  63. if (reason.equalsIgnoreCase("HC-3")) {
  64. Bukkit.getPlayer(player).kickPlayer(permBanMessage);
  65. }
  66.  
  67. /* */
  68.  
  69. }
  70.  
  71.  
  72.  
  73. }
  74.  
  75. @EventHandler
  76. public void onPlayerJoin(PlayerLoginEvent event) {
  77.  
  78. if (event.getResult().equals(Result.KICK_BANNED)) {
  79. event.setKickMessage(ChatColour.Colour("&cYou are permanently banned from this server!\n\n" +
  80. "&7Reason: &fHacked Client [" + PunishManager.proof + "]\n" +
  81. "&7Find out more: &fwebsite I don't own\n\n" +
  82. "&7Ban ID: &f#" + banString + "\n" +
  83. "&7Sharing your Ban ID could affect the processing of your appeal!"));
  84.  
  85. }
  86. }
  87.  
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement