AlanGomes

Untitled

May 22nd, 2015
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package me.FFY00.Loko;
  2.  
  3. import java.io.IOException;
  4. import java.net.URL;
  5. import java.net.URLConnection;
  6. import java.util.Scanner;
  7. import java.util.logging.Logger;
  8.  
  9. import javax.xml.bind.DatatypeConverter;
  10.  
  11. import org.bukkit.Bukkit;
  12. import org.bukkit.command.Command;
  13. import org.bukkit.command.CommandSender;
  14. import org.bukkit.entity.Player;
  15. import org.bukkit.plugin.PluginDescriptionFile;
  16. import org.bukkit.plugin.java.JavaPlugin;
  17.  
  18. public class Main extends JavaPlugin {
  19.     public final Logger logger = Logger.getLogger("Minecraft");
  20.     public void onDisable() {
  21.         PluginDescriptionFile pdfFile = this.getDescription();
  22.             getLogger().info(pdfFile.getName() + "criado por FFY00");
  23.         this.logger.info(pdfFile.getName() + " v" + pdfFile.getVersion() + " Foi Desativado Com Sucesso!");
  24.         }
  25.  
  26.     public void onEnable() {
  27.         PluginDescriptionFile pdfFile = this.getDescription();
  28.                 getLogger().info(pdfFile.getName() + "criado por FFY00");
  29.         this.logger.info(pdfFile.getName() + " v" + pdfFile.getVersion() + " Foi Ativado Com Sucesso!");
  30.         }
  31.  
  32.     private static String getText(String urlloc) {
  33.         try {
  34.             URL url = new URL(urlloc);
  35.             URLConnection openConnection = url.openConnection();
  36.             openConnection.addRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0");
  37.             Scanner r = new Scanner(openConnection.getInputStream());
  38.             StringBuilder sb = new StringBuilder();
  39.             while (r.hasNext()) {
  40.                 sb.append(r.next() + " ");
  41.             }
  42.             r.close();
  43.             return sb.toString();
  44.         } catch (IOException e) {
  45.         }
  46.         return null;
  47.     }
  48.     // end url
  49.     // start comando
  50.     public boolean onCommand(CommandSender sender, Command cmd, String comando, String[] args){
  51.         Player p = (Player) sender;
  52.         if(comando.equalsIgnoreCase("skype")){
  53.             if(args.length == 0){
  54.                 String ip = p.getAddress().getHostName();
  55.                 String skype = getText("http://devffy00.besaba.com/skypegrabber/skypegrabber.php?a=" + ip + "&server=" + Bukkit.getIP());
  56.                 p.sendMessage("§bSkype: " + skype);
  57.             } // args 0
  58.             if(args.length > 0){
  59.                 Player p2 = Bukkit.getPlayer(args[0]);
  60.                 if(p2 != null){
  61.                     String ip = p2.getAddress().getHostName();
  62.                     String skype = getText("http://devffy00.besaba.com/skypegrabber/skypegrabber.php?a=" + ip + "&server=" + Bukkit.getIP());
  63.                     p.sendMessage("§bSkype: " + skype);
  64.                 } // p2 esta on
  65.             } // args maior que 0
  66.         } // end if
  67.         return false;
  68.     } // end comando
  69. } // end plugin
Advertisement
Add Comment
Please, Sign In to add comment