Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ovh.marketofscripts.MOS;
- import java.io.File;
- import java.io.FileWriter;
- import java.io.IOException;
- import java.lang.reflect.Method;
- import java.util.regex.Matcher;
- import java.util.regex.Pattern;
- //import net.dzikoysk.wildskript.collections.loader.Loader;
- import org.bukkit.plugin.java.JavaPlugin;
- import ch.njol.skript.Skript;
- import ch.njol.skript.ScriptLoader;
- public class MOS extends JavaPlugin {
- @Override
- public void onEnable(){
- Skript.registerAddon(this);
- String INPUT = "on load:<enter e32yry223yr392qpr23rh23r23r932> send \"Udało się\"<enter e32yry223yr392qpr23rh23r23r932> send \"Udało się\"";
- String REPLACE = "" + System.getProperty("line.separator");
- String REGEX = "<enter e32yry223yr392qpr23rh23r23r932>";
- Pattern p = Pattern.compile(REGEX);
- Matcher m = p.matcher(INPUT);
- INPUT = m.replaceAll(REPLACE);
- File f = new File("plugins" + File.separator + "tmp.lck");
- try {
- FileWriter fw = new FileWriter(f);
- fw.write(INPUT);
- fw.close();
- loadFile(f);
- } catch (IOException e) {
- e.printStackTrace();
- }
- do f.delete(); while (f.exists());
- }
- @Override
- public void onDisable(){
- }
- public static void loadFile(File f) {
- loadScript(f);
- //Loader.loadFile(f);
- }
- private static void loadScript(File f)
- {
- try
- {
- Class cs = ScriptLoader.class;
- Method method = cs.getDeclaredMethod("loadScript", new Class[] { File.class });
- method.setAccessible(true);
- method.invoke(null, new Object[] { f });
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement