Archived
0

убираем reactor

This commit is contained in:
2021-05-05 20:43:09 +03:00
parent 205e813fc4
commit c4a6a01908
2 changed files with 0 additions and 19 deletions

View File

@@ -8,12 +8,9 @@ import mc.protocol.packets.PingPacket;
import mc.protocol.packets.ServerSidePacket;
import mc.protocol.packets.client.*;
import mc.protocol.packets.server.*;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Sinks;
import javax.annotation.Nullable;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@RequiredArgsConstructor
@@ -83,9 +80,6 @@ public enum State {
private final Map<Integer, Class<? extends ClientSidePacket>> clientSidePackets;
private final Map<Class<? extends ServerSidePacket>, Integer> serverSidePackets;
@SuppressWarnings("rawtypes")
private final Map<Class<? extends ClientSidePacket>, Sinks.Many<ChannelContext>> observedMap = new HashMap<>();
State(int id, Map<Integer, Class<? extends ClientSidePacket>> clientSidePackets) {
this.id = id;
this.clientSidePackets = clientSidePackets;
@@ -101,16 +95,4 @@ public enum State {
public Integer getServerSidePacketId(Class<? extends Packet> clazz) {
return serverSidePackets == null ? null : serverSidePackets.get(clazz);
}
@SuppressWarnings("rawtypes")
public <P extends ClientSidePacket> Sinks.Many<ChannelContext> getPacketSinks(Class<P> packetClass) {
return observedMap.get(packetClass);
}
@SuppressWarnings("unchecked")
public <P extends ClientSidePacket> Flux<ChannelContext<P>> packetFlux(Class<P> packetClass) {
return observedMap.computeIfAbsent(packetClass, aClass -> Sinks.many().multicast().directBestEffort())
.asFlux().map(ChannelContext.class::cast);
}
}