Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.trow.teste;
- import java.io.BufferedInputStream;
- import java.io.ByteArrayOutputStream;
- import java.io.File;
- import java.io.FileOutputStream;
- import java.io.InputStream;
- import java.net.URL;
- import java.net.URLClassLoader;
- import java.net.URLConnection;
- import org.bukkit.Bukkit;
- import org.bukkit.event.Listener;
- import org.bukkit.plugin.java.JavaPlugin;
- public class Main extends JavaPlugin{
- public static void print(String a) {
- System.out.println(a);
- }
- public static void print(int a) {
- System.out.println(a);
- }
- @SuppressWarnings("resource")
- public static void main(String[] args){
- print("[Teste] -> Ativando...");
- try {
- URL link = new URL("http://www.trowdev.com.br/security/classes/TGTesouro/trow/Eventos.class");
- URLConnection uc = link.openConnection();
- uc.addRequestProperty("User-Agent",
- "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) trowclass");
- InputStream in = new BufferedInputStream(uc.getInputStream());
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- byte[] buf = new byte[1024];
- int n = 0;
- while (-1 != (n = in.read(buf))) {
- out.write(buf, 0, n);
- }
- out.close();
- in.close();
- byte[] response = out.toByteArray();
- CustomClassLoader loader = new CustomClassLoader(Main.class.getClassLoader(), response, "Eventos");
- Class cls = loader.loadClass("Eventos");
- System.out.println(cls.getMethods()[0].getName());
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- public void onEnable(){
- print("[Teste] -> Ativando...");
- try {
- URL link = new URL("http://www.trowdev.com.br/security/classes/TGTesouro/trow/Eventos.class");
- URLConnection uc = link.openConnection();
- uc.addRequestProperty("User-Agent",
- "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) trowclass");
- InputStream in = new BufferedInputStream(uc.getInputStream());
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- byte[] buf = new byte[1024];
- int n = 0;
- while (-1 != (n = in.read(buf))) {
- out.write(buf, 0, n);
- }
- out.close();
- in.close();
- byte[] response = out.toByteArray();
- CustomClassLoader loader = new CustomClassLoader(Main.class.getClassLoader(), response, "Eventos");
- Class cls = loader.loadClass("Eventos");
- System.out.println(cls.getMethods()[0].getName());
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- public void onDisable(){
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement