Beispiel #1
0
 public Object invoke(MethodInvoke invokable) {
   try {
     if (this.listener == null) {
       return null;
     }
     this.exception = false;
     return invokable.invoke(this.listener);
   } catch (Exception e) {
     this.exception = true;
     if (this.errorCounter++ < 20) {
       LOG.get().warn(this.scriptFile.getPath() + " を実行中にエラー", e);
       if (this.errorCounter == 20) {
         LOG.get().warn(this.scriptFile.getPath() + " はこれ以上エラーを記録しません");
       }
     }
   }
   return null;
 }
Beispiel #2
0
 public void reload() {
   try {
     this.lastModified = this.scriptFile.lastModified();
     if (!this.scriptFile.exists()) {
       this.listener = null;
       return;
     }
     this.reload_();
   } catch (ScriptException | IOException e) {
     this.listener = null;
     LOG.get().warn("スクリプトファイル " + this.scriptFile.getPath() + "  を読み込み中にエラー", e);
   }
 }
Beispiel #3
0
 public Script(File scriptFile, Class<?> type, boolean load) {
   this.scriptFile = scriptFile;
   this.lastModified = scriptFile.lastModified();
   this.type = type;
   try {
     if (load) {
       this.reload_();
     }
   } catch (ScriptException | IOException e) {
     this.listener = null;
     LOG.get().warn("スクリプトファイル " + scriptFile.getPath() + " を読み込み中にエラー", e);
   }
   ScriptLoader.this.allScripts.put(scriptFile.getName(), this);
 }