Skip to content

Commit

Permalink
Fixed: Подключение
Browse files Browse the repository at this point in the history
  • Loading branch information
Reider745 committed May 12, 2024
1 parent 0a0009a commit fe7ac16
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/main/java/com/reider745/hooks/NetworkHooks.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@
@Hooks(className = "cn.nukkit.network.Network")
public class NetworkHooks implements HookClass {

private static final LinkedList<String> canSendInfo = new LinkedList<>();

public static void close(Player player){
canSendInfo.remove(NativeNetworking.getId(player));

}

@Inject(signature = "([BLjava/util/Collection;Lcn/nukkit/network/CompressionProvider;ILcn/nukkit/Player;)V", type = TypeHook.BEFORE_REPLACE)
Expand Down Expand Up @@ -108,15 +106,6 @@ public static void processBatch(Network network, byte[] payload, Collection<Data
((BasePacket) pk).player = player;
}

if(player != null){
final String id = NativeNetworking.getId(player);
if(!canSendInfo.contains(id)){
canSendInfo.add(id);
player.dataPacket(InnerCorePacket.sendInfo);
}
}


try {
if (raknetProtocol > 8) {
pk.decode();
Expand All @@ -139,6 +128,13 @@ public static void processBatch(Network network, byte[] payload, Collection<Data
}
}

@Inject(className = "cn.nukkit.network.session.RakNetPlayerSession")
public static void setPlayer(RakNetPlayerSession self, Player player){
if(InnerCoreServer.isDebugInnerCoreNetwork())
System.out.println("Send inner core info");
player.dataPacket(InnerCorePacket.sendInfo);
}

@Inject(type = TypeHook.AFTER_NOT_REPLACE)
public static void registerPackets(Network network) {
network.registerPacket(InnerCoreServer.PROTOCOL, InnerCorePacket.NETWORK_ID, InnerCorePacket.class);
Expand Down

0 comments on commit fe7ac16

Please sign in to comment.