mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2026-02-07 02:26:43 +01:00
Run spotlessApply
This commit is contained in:
@@ -8,8 +8,6 @@ import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import javax.script.Bindings;
|
||||
import javax.script.CompiledScript;
|
||||
import lombok.val;
|
||||
|
||||
public class EntityControllerScriptManager {
|
||||
@@ -21,23 +19,23 @@ public class EntityControllerScriptManager {
|
||||
|
||||
private static void cacheGadgetControllers() {
|
||||
try (var stream = Files.newDirectoryStream(getScriptPath("Gadget/"), "*.lua")) {
|
||||
stream.forEach(path -> {
|
||||
val fileName = path.getFileName().toString();
|
||||
if (!fileName.endsWith(".lua")) return;
|
||||
stream.forEach(
|
||||
path -> {
|
||||
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);
|
||||
var cs = ScriptLoader.getScript("Gadget/" + fileName);
|
||||
var 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);
|
||||
}
|
||||
});
|
||||
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 Lua scripts.");
|
||||
|
||||
@@ -21,11 +21,13 @@ public class SceneGadget extends SceneObject {
|
||||
public SceneBossChest boss_chest;
|
||||
public int interact_id;
|
||||
/**
|
||||
* Note: this field indicates whether the gadget should disappear permanently.
|
||||
* For example, if isOneOff=true, like most chests, it will disappear permanently after interacted.
|
||||
* If isOneOff=false, like investigation points, it will disappear temporarily, and appear again in next big world resource refresh routine.
|
||||
* Note: this field indicates whether the gadget should disappear permanently. For example, if
|
||||
* isOneOff=true, like most chests, it will disappear permanently after interacted. If
|
||||
* isOneOff=false, like investigation points, it will disappear temporarily, and appear again in
|
||||
* next big world resource refresh routine.
|
||||
*/
|
||||
public boolean isOneoff;
|
||||
|
||||
public int area_id;
|
||||
public int draft_id;
|
||||
public int route_id;
|
||||
|
||||
Reference in New Issue
Block a user