53 lines
1.2 KiB
Java
53 lines
1.2 KiB
Java
package net.saltymc.eaa;
|
|
|
|
import net.fabricmc.api.ModInitializer;
|
|
import net.saltymc.eaa.handler.CommandHandler;
|
|
import net.saltymc.eaa.handler.HandlerInterface;
|
|
import net.saltymc.eaa.util.ResponseEntity;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
public class EaaMod implements ModInitializer {
|
|
|
|
private static EaaMod instance;
|
|
private final List<HandlerInterface> handler;
|
|
|
|
public EaaMod(){
|
|
handler = new ArrayList<>();
|
|
}
|
|
|
|
public static EaaMod getInstance(){
|
|
if (instance == null) {
|
|
instance = new EaaMod();
|
|
instance.onInitialize();
|
|
}
|
|
|
|
return instance;
|
|
}
|
|
|
|
@Override
|
|
public void onInitialize() {
|
|
// This code runs as soon as Minecraft is in a mod-load-ready state.
|
|
// However, some things (like resources) may still be uninitialized.
|
|
// Proceed with mild caution.
|
|
|
|
System.out.println("EAA Mod initializing...");
|
|
|
|
//Init CommandHandler
|
|
handler.add(new CommandHandler());
|
|
|
|
}
|
|
|
|
public ResponseEntity onEvent(Object object){
|
|
for (HandlerInterface hi : handler) {
|
|
ResponseEntity handlerResponse = hi.handle(object);
|
|
if (handlerResponse.isWasHandled()) {
|
|
return handlerResponse; // Events are exclusive yet
|
|
}
|
|
}
|
|
|
|
return new ResponseEntity(false);
|
|
}
|
|
}
|