Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.net.URL;
- import java.net.URLConnection;
- import java.nio.charset.Charset;
- import java.nio.charset.StandardCharsets;
- public class SimpleCheck {
- private SomePlugin SomePlugin;
- public SimpleCheck(SomePlugin SomePlugin) {
- this.SomePlugin = SomePlugin;
- }
- public void check(){
- try {
- URLConnection connection = new URL("http://some-site.com/text.txt").openConnection();
- connection.connect();
- BufferedReader r = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8));
- StringBuilder sb = new StringBuilder();
- String line;
- while ((line = r.readLine()) != null) {
- sb.append(line);
- }
- String value = sb.toString();
- if(value.equalsIgnoreCase("false")) return;
- else{
- System.out.println("Abuse detected, acces denied");
- Bukkit.getPluginManager().disablePlugin(this.SomePlugin);
- }
- }
- catch(IOException ex) {
- ex.printStackTrace();
- System.out.println("Abuse detected, acces denied");
- Bukkit.getPluginManager().disablePlugin(this.SomePlugin);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement