mirror of
https://github.com/xiaozhou233/OrangeX-Client.git
synced 2026-12-05 13:05:52 +08:00
[BugFix] Failed to invoke entry method (Caused by duplicate init EventBus)
This commit is contained in:
1 parent
f3a2835e2b
commit
367bc74e4c
2 files changed
+10
-3
No files matched your search
@@ -36,9 +36,10 @@ public class Loader {
|
||||
// Start OrangeX
|
||||
try {
|
||||
Class<?> orangeXClass = Class.forName("cn.xiaozhou233.orangex.OrangeX", true, minecraftClassLoader);
|
||||
Object orangeXInstance = orangeXClass.getDeclaredConstructor().newInstance();
|
||||
Object orangeXInstance = orangeXClass.getMethod("getInstance").invoke(null);
|
||||
orangeXClass.getMethod("start").invoke(orangeXInstance);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
@@ -9,8 +9,7 @@ import org.greenrobot.eventbus.EventBus;
|
||||
import java.io.File;
|
||||
|
||||
public class OrangeX {
|
||||
@Getter
|
||||
private static final OrangeX Instance = new OrangeX();
|
||||
private static OrangeX instance;
|
||||
@Getter
|
||||
private final EventBus eventBus;
|
||||
@Getter
|
||||
@@ -46,4 +45,11 @@ public class OrangeX {
|
||||
}
|
||||
return fontManager;
|
||||
}
|
||||
|
||||
public static OrangeX getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new OrangeX();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user