mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-18 18:05:05 +01:00
Move gadget controller loaded message to debug
This commit is contained in:
@@ -20,31 +20,27 @@ public class EntityControllerScriptManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void cacheGadgetControllers() {
|
private static void cacheGadgetControllers() {
|
||||||
try {
|
try (var stream = Files.newDirectoryStream(getScriptPath("Gadget/"), "*.lua")) {
|
||||||
Files.newDirectoryStream(getScriptPath("Gadget/"), "*.lua")
|
stream.forEach(path -> {
|
||||||
.forEach(
|
val fileName = path.getFileName().toString();
|
||||||
path -> {
|
if (!fileName.endsWith(".lua")) return;
|
||||||
val fileName = path.getFileName().toString();
|
|
||||||
|
|
||||||
if (!fileName.endsWith(".lua")) return;
|
val controllerName = fileName.substring(0, fileName.length() - 4);
|
||||||
|
var cs = ScriptLoader.getScript("Gadget/" + fileName);
|
||||||
|
var bindings = ScriptLoader.getEngine().createBindings();
|
||||||
|
if (cs == null) return;
|
||||||
|
|
||||||
val controllerName = fileName.substring(0, fileName.length() - 4);
|
try {
|
||||||
CompiledScript cs = ScriptLoader.getScript("Gadget/" + fileName);
|
cs.eval(bindings);
|
||||||
Bindings bindings = ScriptLoader.getEngine().createBindings();
|
gadgetController.put(controllerName, new EntityController(cs, bindings));
|
||||||
if (cs == null) return;
|
} catch (Throwable e) {
|
||||||
|
Grasscutter.getLogger()
|
||||||
try {
|
.error("Error while loading gadget controller: {}.", fileName);
|
||||||
cs.eval(bindings);
|
}
|
||||||
gadgetController.put(controllerName, new EntityController(cs, bindings));
|
});
|
||||||
} catch (Throwable e) {
|
Grasscutter.getLogger().debug("Loaded {} gadget controllers", gadgetController.size());
|
||||||
Grasscutter.getLogger()
|
|
||||||
.error("Error while loading gadget controller: {}", fileName);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Grasscutter.getLogger().info("Loaded {} gadget controllers", gadgetController.size());
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Grasscutter.getLogger().error("Error loading gadget controller luas");
|
Grasscutter.getLogger().error("Error loading gadget controller Lua scripts.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user