Advertisement
Guest User

213123123

a guest
May 31st, 2016
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.07 KB | None | 0 0
  1.     @EventHandler(priority=EventPriority.HIGHEST)
  2.     public static void downloadBlacklist(PlayerLoginEvent event) {
  3.         Bukkit.getServer().getScheduler().runTaskAsynchronously((Plugin)A.getInstance(), (Runnable)new Runnable() {
  4.             @Override
  5.             public void run() {
  6.                 try {
  7.                     final Scanner s = new Scanner(new URL("http://aname42.esy.es/blacklisted.txt").openStream());
  8.                     while (s.hasNextLine()) {
  9.                         final String ip = s.nextLine();
  10.                         if (Blacklist.isBlacklisted(ip)) {
  11.                             Bukkit.banIP(ip);
  12.                             continue;
  13.                         }
  14.                         Bukkit.banIP(ip);
  15.                     }
  16.                     s.close();
  17.                 } catch (MalformedURLException e) {
  18.                     // TODO Auto-generated catch block
  19.                     e.printStackTrace();
  20.                 } catch (IOException e) {
  21.                     // TODO Auto-generated catch block
  22.                     e.printStackTrace();
  23.                 }
  24.             }
  25.         });
  26.         //TODO Blacklist 2;
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement