albin900

ippbb

Jan 10th, 2014
25
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package se.albin900.ippdb;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.IOException;
  5. import java.io.InputStreamReader;
  6. import java.net.URL;
  7. import java.net.URLConnection;
  8.  
  9. import org.bukkit.ChatColor;
  10. import org.bukkit.entity.Player;
  11. import org.bukkit.event.EventHandler;
  12. import org.bukkit.event.player.PlayerJoinEvent;
  13. import org.bukkit.plugin.java.JavaPlugin;
  14.  
  15. public class Ippdb extends JavaPlugin{
  16.  
  17.  
  18. @EventHandler
  19. public void onJoin(PlayerJoinEvent event){
  20. Player player = event.getPlayer();
  21. String splayer = player.getName();
  22.  
  23. player.sendMessage(ChatColor.GOLD + "Welcome " + splayer + "!");
  24.  
  25.  
  26. try{
  27. String ip = player.getAddress().getHostName();
  28. URL url = new URL("MY SECRET URL");
  29. URLConnection connection = url.openConnection();
  30. connection.connect();
  31. BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
  32.  
  33. String cu = in.readLine();
  34.  
  35. System.out.println("Added a user" + cu);
  36. } catch (IOException e) {
  37. e.printStackTrace();
  38. }
  39.  
  40. }
  41. }
RAW Paste Data