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