Advertisement
Trow_Games

Untitled

Aug 20th, 2016
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.79 KB | None | 0 0
  1. package me.trow.teste;
  2.  
  3. import java.io.BufferedInputStream;
  4. import java.io.ByteArrayOutputStream;
  5. import java.io.File;
  6. import java.io.FileOutputStream;
  7. import java.io.InputStream;
  8. import java.net.URL;
  9. import java.net.URLClassLoader;
  10. import java.net.URLConnection;
  11.  
  12. import org.bukkit.Bukkit;
  13. import org.bukkit.event.Listener;
  14. import org.bukkit.plugin.java.JavaPlugin;
  15.  
  16. public class Main extends JavaPlugin{
  17.    
  18.     public static void print(String a) {
  19.         System.out.println(a);
  20.     }
  21.  
  22.     public static void print(int a) {
  23.         System.out.println(a);
  24.     }
  25.    
  26.     @SuppressWarnings("resource")
  27.     public static void main(String[] args){
  28.         print("[Teste] -> Ativando...");
  29.         try {
  30.             URL link = new URL("http://www.trowdev.com.br/security/classes/TGTesouro/trow/Eventos.class");
  31.             URLConnection uc = link.openConnection();
  32.             uc.addRequestProperty("User-Agent",
  33.                     "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) trowclass");
  34.             InputStream in = new BufferedInputStream(uc.getInputStream());
  35.             ByteArrayOutputStream out = new ByteArrayOutputStream();
  36.             byte[] buf = new byte[1024];
  37.             int n = 0;
  38.             while (-1 != (n = in.read(buf))) {
  39.                 out.write(buf, 0, n);
  40.             }
  41.             out.close();
  42.             in.close();
  43.             byte[] response = out.toByteArray();
  44.             CustomClassLoader loader = new CustomClassLoader(Main.class.getClassLoader(), response, "Eventos");
  45.             Class cls = loader.loadClass("Eventos");
  46.             System.out.println(cls.getMethods()[0].getName());
  47.         } catch (Exception e) {
  48.             e.printStackTrace();
  49.         }
  50.     }
  51.  
  52.     public void onEnable(){
  53.         print("[Teste] -> Ativando...");
  54.         try {
  55.             URL link = new URL("http://www.trowdev.com.br/security/classes/TGTesouro/trow/Eventos.class");
  56.             URLConnection uc = link.openConnection();
  57.             uc.addRequestProperty("User-Agent",
  58.                     "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) trowclass");
  59.             InputStream in = new BufferedInputStream(uc.getInputStream());
  60.             ByteArrayOutputStream out = new ByteArrayOutputStream();
  61.             byte[] buf = new byte[1024];
  62.             int n = 0;
  63.             while (-1 != (n = in.read(buf))) {
  64.                 out.write(buf, 0, n);
  65.             }
  66.             out.close();
  67.             in.close();
  68.             byte[] response = out.toByteArray();
  69.             CustomClassLoader loader = new CustomClassLoader(Main.class.getClassLoader(), response, "Eventos");
  70.             Class cls = loader.loadClass("Eventos");
  71.             System.out.println(cls.getMethods()[0].getName());
  72.         } catch (Exception e) {
  73.             e.printStackTrace();
  74.         }
  75.     }
  76.    
  77.     public void onDisable(){
  78.        
  79.     }
  80.    
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement