Advertisement
Guest User

Untitled

a guest
Apr 17th, 2014
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. package me.idray.noproxy;
  2.  
  3. import java.io.IOException;
  4. import java.net.MalformedURLException;
  5. import java.net.URL;
  6. import java.util.Scanner;
  7. import org.bukkit.Bukkit;
  8. import org.bukkit.event.EventHandler;
  9. import org.bukkit.event.EventPriority;
  10. import org.bukkit.event.Listener;
  11. import org.bukkit.event.player.PlayerLoginEvent;
  12. import org.bukkit.plugin.java.JavaPlugin;
  13.  
  14. public class noProxy extends JavaPlugin implements Listener{
  15. public void onEnable()
  16. {
  17. Bukkit.getPluginManager().registerEvents(this, this);
  18. }
  19.  
  20. @EventHandler(priority=EventPriority.LOWEST)
  21. public void onLogin(PlayerLoginEvent event) {
  22. if (!event.getPlayer().hasPermission("noproxy.bypass")) {
  23. try
  24. {
  25. String url = "http://botscout.com/test/?ip=" + event.getAddress().getHostAddress();
  26. Scanner scanner = new Scanner(new URL(url).openStream());
  27. if (scanner.findInLine("Y") != null) {
  28. event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "You are using a proxy!");
  29. }
  30. scanner.close();
  31. }
  32. catch (MalformedURLException exception)
  33. {
  34. exception.printStackTrace();
  35. }
  36. catch (IOException exception)
  37. {
  38. exception.printStackTrace();
  39. }
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement