mirror of
https://github.com/PlaceholderAPI/Javascript-Expansion.git
synced 2025-05-23 18:42:44 +00:00
Update to 1.6.1
This commit is contained in:
parent
8b957eb62f
commit
83003446a9
@ -154,6 +154,10 @@ public class JavascriptExpansionCommands extends Command {
|
|||||||
"&e/" + command + " git list &7- &fList available scripts in the js expansion github.",
|
"&e/" + command + " git list &7- &fList available scripts in the js expansion github.",
|
||||||
"&e/" + command + " git info [name] &7- &fGet the description and url of a specific script."
|
"&e/" + command + " git info [name] &7- &fGet the description and url of a specific script."
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
ExpansionUtils.sendMsg(sender,
|
||||||
|
"&e/" + command + " git &7- &fGithub command &7(please enable in config)"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ public class JavascriptPlaceholder {
|
|||||||
keys.forEach(key -> scriptData.set(key, ExpansionUtils.ymlToJavaObj(yaml.get(key))));
|
keys.forEach(key -> scriptData.set(key, ExpansionUtils.ymlToJavaObj(yaml.get(key))));
|
||||||
|
|
||||||
if (!scriptData.isEmpty()) {
|
if (!scriptData.isEmpty()) {
|
||||||
this.setData(scriptData);
|
setData(scriptData);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -148,19 +148,35 @@ public class JavascriptPlaceholdersConfig {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean debug = (boolean) ex.get("debug", false);
|
||||||
|
int errScriptEngine = 0;
|
||||||
|
|
||||||
ScriptEngine engine;
|
ScriptEngine engine;
|
||||||
if (!config.contains(identifier + ".engine")) {
|
if (!config.contains(identifier + ".engine")) {
|
||||||
engine = ex.getGlobalEngine();
|
engine = ex.getGlobalEngine();
|
||||||
ExpansionUtils.warnLog("ScriptEngine type for javascript placeholder " + identifier + " isn't initialized! Defaulting to global", null);
|
if (debug) {
|
||||||
|
ExpansionUtils.warnLog("ScriptEngine type for javascript placeholder: " + identifier + " is empty! Defaulting to global", null);
|
||||||
|
} else {
|
||||||
|
errScriptEngine++;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
engine = new ScriptEngineManager(null).getEngineByName(config.getString(identifier + ".engine", "nashorn"));
|
engine = new ScriptEngineManager(null).getEngineByName(config.getString(identifier + ".engine", "nashorn"));
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
ExpansionUtils.warnLog("ScriptEngine type for javascript placeholder: " + identifier + " is invalid! Defaulting to global", null);
|
if (debug) {
|
||||||
|
ExpansionUtils.warnLog("ScriptEngine type for javascript placeholder: " + identifier + " is invalid! Defaulting to global", null);
|
||||||
|
} else {
|
||||||
|
errScriptEngine++;
|
||||||
|
}
|
||||||
engine = ex.getGlobalEngine();
|
engine = ex.getGlobalEngine();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (errScriptEngine > 0) {
|
||||||
|
ExpansionUtils.warnLog("ScriptEngine type for " + errScriptEngine + " javascript placeholder" + ExpansionUtils.plural(errScriptEngine) +
|
||||||
|
" failed! Defaulting all to global. More information by enabling debug mode", null);
|
||||||
|
}
|
||||||
|
|
||||||
if (engine == null) {
|
if (engine == null) {
|
||||||
ExpansionUtils.warnLog("Failed to set ScriptEngine for javascript placeholder: " + identifier, null);
|
ExpansionUtils.warnLog("Failed to set ScriptEngine for javascript placeholder: " + identifier, null);
|
||||||
continue;
|
continue;
|
||||||
@ -192,8 +208,6 @@ public class JavascriptPlaceholdersConfig {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This thing is just in case, who needs it now..
|
|
||||||
// return sb.toString().replaceAll("//.*|/\\*(?:[^/*|*/]|\\\\.|\\n\\*)*\\*/", "");
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user