Fixed: Подключение
This commit is contained in:
@@ -32,10 +32,8 @@ import java.util.LinkedList;
|
|||||||
@Hooks(className = "cn.nukkit.network.Network")
|
@Hooks(className = "cn.nukkit.network.Network")
|
||||||
public class NetworkHooks implements HookClass {
|
public class NetworkHooks implements HookClass {
|
||||||
|
|
||||||
private static final LinkedList<String> canSendInfo = new LinkedList<>();
|
|
||||||
|
|
||||||
public static void close(Player player){
|
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)
|
@Inject(signature = "([BLjava/util/Collection;Lcn/nukkit/network/CompressionProvider;ILcn/nukkit/Player;)V", type = TypeHook.BEFORE_REPLACE)
|
||||||
@@ -108,15 +106,6 @@ public class NetworkHooks implements HookClass {
|
|||||||
((BasePacket) pk).player = player;
|
((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 {
|
try {
|
||||||
if (raknetProtocol > 8) {
|
if (raknetProtocol > 8) {
|
||||||
pk.decode();
|
pk.decode();
|
||||||
@@ -139,6 +128,13 @@ public class NetworkHooks implements HookClass {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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)
|
@Inject(type = TypeHook.AFTER_NOT_REPLACE)
|
||||||
public static void registerPackets(Network network) {
|
public static void registerPackets(Network network) {
|
||||||
network.registerPacket(InnerCoreServer.PROTOCOL, InnerCorePacket.NETWORK_ID, InnerCorePacket.class);
|
network.registerPacket(InnerCoreServer.PROTOCOL, InnerCorePacket.NETWORK_ID, InnerCorePacket.class);
|
||||||
|
|||||||
Reference in New Issue
Block a user