Ejemplo n.º 1
0
 private File initialiseDataFolder() {
   if (Utils.getOrDefault(rdescription, "jxpl.hasdatafolder", false)) {
     File tempFolder = new File(file.getParentFile(), description.getName());
     if (Utils.dirExistOrCreate(tempFolder)) return tempFolder;
   }
   return null;
 }
Ejemplo n.º 2
0
 public ScriptPlugin(PluginLoader pluginLoader, Server instance, File plugin, ScriptEngine engine)
     throws InvalidDescriptionException {
   loader = pluginLoader;
   server = instance;
   file = plugin;
   rdescription = (Map<String, Object>) Utils.getOrExcept(engine, "SCRIPT_PDF");
   description = Utils.getPdfFromMap(rdescription);
   logger = Logger.getLogger("Minecraft.JxplPlugin." + description.getName());
   dataFolder = initialiseDataFolder();
   helper = new PluginHelper();
   engine.put(Utils.getOrDefault(rdescription, "jxpl.helpervarname", "helper"), helper);
   engine.put(Utils.getOrDefault(rdescription, "jxpl.pluginvarname", "plugin"), this);
   engine.put(Utils.getOrDefault(rdescription, "jxpl.servervarname", "server"), server);
   sEngine = (Invocable) engine;
   if (dataFolder != null && Utils.getOrDefault(rdescription, "jxpl.hasconfig", false)) {
     configFile = new File(dataFolder, "config.yml");
   } else {
     configFile = null;
   }
 }