Archived
0

рефакторинг DI

This commit is contained in:
2021-05-06 14:34:47 +03:00
parent 0aaf17b17f
commit 4c20c7fd02
6 changed files with 96 additions and 39 deletions

View File

@@ -11,6 +11,7 @@ import mc.protocol.State;
import mc.protocol.api.Server;
import mc.protocol.di.DaggerProtocolComponent;
import mc.protocol.di.ProtocolComponent;
import mc.protocol.di.ProtocolModule;
import mc.protocol.packets.PingPacket;
import mc.protocol.packets.client.HandshakePacket;
import mc.protocol.packets.client.LoginStartPacket;
@@ -40,8 +41,6 @@ public class Main {
private void run(OptionSet optionSet) {
log.info("mc-project launch");
ProtocolComponent protocolComponent = DaggerProtocolComponent.create();
ConfigModule configModule = new ConfigModule((Path) optionSet.valueOf(CLI_CONFIG));
ServerComponent serverComponent = DaggerServerComponent.builder()
@@ -50,6 +49,10 @@ public class Main {
Config config = serverComponent.getConfig();
ProtocolComponent protocolComponent = DaggerProtocolComponent.builder()
.protocolModule(new ProtocolModule(true))
.build();
Server server = protocolComponent.getServer();
PacketHandler packetHandler = serverComponent.getPacketHandler();