Advertisement
Slupik98

Untitled

Jan 12th, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.63 KB | None | 0 0
  1. package ovh.marketofscripts.MOS;
  2.  
  3. import java.io.File;
  4. import java.io.FileWriter;
  5. import java.io.IOException;
  6. import java.lang.reflect.Method;
  7. import java.util.regex.Matcher;
  8. import java.util.regex.Pattern;
  9.  
  10. //import net.dzikoysk.wildskript.collections.loader.Loader;
  11.  
  12. import org.bukkit.plugin.java.JavaPlugin;
  13.  
  14. import ch.njol.skript.Skript;
  15.  
  16. import ch.njol.skript.ScriptLoader;
  17.  
  18.  
  19. public class MOS extends JavaPlugin {
  20.     @Override
  21.     public void onEnable(){
  22.         Skript.registerAddon(this);
  23.         String INPUT = "on load:<enter e32yry223yr392qpr23rh23r23r932>  send \"Udało się\"<enter e32yry223yr392qpr23rh23r23r932>  send \"Udało się\"";
  24.         String REPLACE = "" + System.getProperty("line.separator");
  25.         String REGEX = "<enter e32yry223yr392qpr23rh23r23r932>";
  26.         Pattern p = Pattern.compile(REGEX);
  27.         Matcher m = p.matcher(INPUT);
  28.         INPUT = m.replaceAll(REPLACE);
  29.         File f = new File("plugins" + File.separator + "tmp.lck");
  30.         try {
  31.           FileWriter fw = new FileWriter(f);
  32.           fw.write(INPUT);
  33.           fw.close();
  34.           loadFile(f);
  35.         } catch (IOException e) {
  36.           e.printStackTrace();
  37.         }
  38.         do f.delete(); while (f.exists());
  39.     }
  40.     @Override
  41.     public void onDisable(){
  42.     }
  43.   public static void loadFile(File f) {
  44.         loadScript(f);
  45.         //Loader.loadFile(f);
  46.       }
  47.  
  48.   private static void loadScript(File f)
  49.   {
  50.    
  51.     try
  52.     {
  53.       Class cs = ScriptLoader.class;
  54.       Method method = cs.getDeclaredMethod("loadScript", new Class[] { File.class });
  55.       method.setAccessible(true);
  56.       method.invoke(null, new Object[] { f });
  57.     } catch (Exception e) {
  58.       e.printStackTrace();
  59.     }
  60.   }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement