Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.idray.noproxy;
- import java.io.IOException;
- import java.net.MalformedURLException;
- import java.net.URL;
- import java.util.Scanner;
- import org.bukkit.Bukkit;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.EventPriority;
- import org.bukkit.event.Listener;
- import org.bukkit.event.player.PlayerLoginEvent;
- import org.bukkit.plugin.java.JavaPlugin;
- public class noProxy extends JavaPlugin implements Listener{
- public void onEnable()
- {
- Bukkit.getPluginManager().registerEvents(this, this);
- }
- @EventHandler(priority=EventPriority.LOWEST)
- public void onLogin(PlayerLoginEvent event) {
- if (!event.getPlayer().hasPermission("noproxy.bypass")) {
- try
- {
- String url = "http://botscout.com/test/?ip=" + event.getAddress().getHostAddress();
- Scanner scanner = new Scanner(new URL(url).openStream());
- if (scanner.findInLine("Y") != null) {
- event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "You are using a proxy!");
- }
- scanner.close();
- }
- catch (MalformedURLException exception)
- {
- exception.printStackTrace();
- }
- catch (IOException exception)
- {
- exception.printStackTrace();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement