rework lol
This commit is contained in:
parent
59420948d3
commit
865abd7c29
8 changed files with 65 additions and 251 deletions
|
@ -1,32 +1,10 @@
|
|||
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;
|
||||
import net.saltymc.eaa.handler.commands.EchoCommand;
|
||||
|
||||
public class EaaMod implements ModInitializer {
|
||||
|
||||
private static EaaMod instance;
|
||||
private final List<HandlerInterface> handler;
|
||||
|
||||
public EaaMod(){
|
||||
instance = this;
|
||||
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.
|
||||
|
@ -35,19 +13,7 @@ public class EaaMod implements ModInitializer {
|
|||
|
||||
System.out.println("EAA Mod initializing...");
|
||||
|
||||
//Init CommandHandler
|
||||
handler.add(new CommandHandler());
|
||||
new EchoCommand();
|
||||
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue