How to Using PacketLoginStart ?
heartlion1 opened this issue · 0 comments
my code:
public static void sendFakePlayerPacketsToServer(Player player,FakePlayer fakePlayer)
{
final PacketContainer packetContainer =PlayerLibUtil.protocolManager.createPacket(PacketType.Login.Client.START);
final WrappedGameProfile wrappedGameProfile=new WrappedGameProfile(fakePlayer.getUuid(),fakePlayer.getPlayerName());
packetContainer.getGameProfiles().write(0, wrappedGameProfile);
try {
//GameProfile
PlayerLibUtil.protocolManager.recieveClientPacket(player,packetContainer);
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
but it dont work ,there is error:
[00:23:56] [Netty Server IO #3/ERROR]: [ProtocolLib] Unhandled exception occured in recieveClientPacket for ProtocolLib
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_172]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_172]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_172]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_172]
at com.comphenix.protocol.injector.netty.ChannelInjector.lambda$recieveClientPacket$2(ChannelInjector.java:669) ~[?:?]
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:380) [spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357) [spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) [spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_172]
Caused by: java.lang.ClassCastException: net.minecraft.server.v1_8_R3.PlayerConnection cannot be cast to net.minecraft.server.v1_8_R3.PacketLoginInListener
at net.minecraft.server.v1_8_R3.PacketLoginInStart.a(SourceFile:10) ~[spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.NetworkManager.a(NetworkManager.java:124) ~[spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
... 9 more
I dont know what wrong with the code when i check the nms class . Can you tech me?