Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Using PacketLoginStart ? #52

Open
heartlion1 opened this issue Jun 27, 2018 · 0 comments
Open

How to Using PacketLoginStart ? #52

heartlion1 opened this issue Jun 27, 2018 · 0 comments

Comments

@heartlion1
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant