Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions common/src/main/java/com/github/epsilon/Epsilon.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.github.epsilon;

import com.github.epsilon.assets.i18n.I18NFileGenerator;
import com.github.epsilon.events.bus.EventBus;
import com.github.epsilon.managers.AddonManager;
import com.github.epsilon.managers.ConfigManager;
Expand All @@ -25,19 +24,14 @@ public static void init() {

EventBus.INSTANCE.registerLambdaFactory(Epsilon.class.getPackageName(), (lookupInMethod, klass) -> (MethodHandles.Lookup) lookupInMethod.invoke(null, klass, MethodHandles.lookup()));

// 初始化 Managers
ModuleManager.INSTANCE.initModules();
AddonManager.INSTANCE.setupAddons();
ConfigManager.INSTANCE.initConfig();
HealthManager.INSTANCE.getClass();

// 生成空的 i18n 文件
I18NFileGenerator.generate("epsilon-empty-i18n.json");

// 添加一个退出游戏时候的钩子
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
ConfigManager.INSTANCE.saveNow();
Epsilon.LOGGER.info("お兄ちゃん、私はあなたを一番愛しています~");
Epsilon.LOGGER.info("Epsilon saved config on shutdown");
}));

Epsilon.LOGGER.info("Epsilon has loaded successfully, Meow~");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public LegacyConfigMigrator(Path legacyRootDir, Path targetConfigDir, Gson gson)
* {@code {targetConfigDir}/{addonId}/{moduleName}.json}
*/
public Path getModuleFile(Module module) {
return targetConfigDir.resolve("modules").resolve(module.getName() + ".json");
String addonId = module.getAddonId() != null ? module.getAddonId() : "unknown";
return targetConfigDir.resolve(addonId).resolve(module.getName() + ".json");
}

public void migrateIfNeeded(List<Module> modules) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public LambdaListener(Factory factory, Class<?> klass, Object object, Method met
if (isStatic) this.executor = (Consumer<Object>) lambdaFactory.invoke();
else this.executor = (Consumer<Object>) lambdaFactory.invoke(object);
} catch (Throwable throwable) {
throwable.printStackTrace();
throw new IllegalStateException("Failed to create event listener for " + klass.getName() + "#" + method.getName(), throwable);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ protected void onEnable() {
resetState();
}

@Override
protected void onDisable() {
renderBoxes.clear();
}

@EventHandler
private void onTick(TickEvent.Pre event) {
if (nullCheck()) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ protected void onEnable() {
@Override
protected void onDisable() {
ownAnchors.clear();
renderBoxes.clear();
}

@EventHandler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ protected void onDisable() {
if (shouldSwapBack) {
InvUtils.swapBack();
}
renderBoxes.clear();
}

@EventHandler
Expand Down
Loading