Move gadget controller loaded message to debug

This commit is contained in:
KingRainbow44
2023-04-15 13:17:09 -04:00
parent d8f90b26cf
commit c672a2d9cb

View File

@@ -20,17 +20,14 @@ 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(
path -> {
val fileName = path.getFileName().toString(); val fileName = path.getFileName().toString();
if (!fileName.endsWith(".lua")) return; if (!fileName.endsWith(".lua")) return;
val controllerName = fileName.substring(0, fileName.length() - 4); val controllerName = fileName.substring(0, fileName.length() - 4);
CompiledScript cs = ScriptLoader.getScript("Gadget/" + fileName); var cs = ScriptLoader.getScript("Gadget/" + fileName);
Bindings bindings = ScriptLoader.getEngine().createBindings(); var bindings = ScriptLoader.getEngine().createBindings();
if (cs == null) return; if (cs == null) return;
try { try {
@@ -38,13 +35,12 @@ public class EntityControllerScriptManager {
gadgetController.put(controllerName, new EntityController(cs, bindings)); gadgetController.put(controllerName, new EntityController(cs, bindings));
} catch (Throwable e) { } catch (Throwable e) {
Grasscutter.getLogger() Grasscutter.getLogger()
.error("Error while loading gadget controller: {}", fileName); .error("Error while loading gadget controller: {}.", fileName);
} }
}); });
Grasscutter.getLogger().debug("Loaded {} gadget controllers", gadgetController.size());
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.");
} }
} }