-
-
Notifications
You must be signed in to change notification settings - Fork 17
Sending Respawn Packet On Sync PlayerDeath #38
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
Comments
I think i can actually do this let me try before asking for your answer lol |
Ok so im gonna leave this closed because this is totally unrelated but i dont want to make a new thread to ask lol. So anyway im trying to skip the respawn screen on a playerdeathevent. I switched the trigger to sync mode and now im trying to send a respawn packet with protocollib. ill type out what i have so far. |
Ok adding on to this i see part of the problem. I have to specify the respawn packet is client side so i tried using "PacketType.Play.Client.RESPAWN" instead of respawn. |
The packet your are modifying: PacketPlayInClientCommand, Client Status Enum: EnumClientCommand Method to use: getClientCommands() So there are some (quite a lot) information you have to consider when you are modifying the packet. First, you have to identify which packet you are sending. In your case, probably the ClientStatus packet is what you are looking for. And then, you have to find the NMS class that is responsible for the packet. That is PacketPlayInClientCommand. Inside the PacketPlayInClientCommand, you will see a enum field named 'a' which has type of EnumClientCommand. However, because we are using ProtocolLib instead of directly dealing with the NMS, you have pre-defined wrapper classes to use. You see Here, you can find PacketType.Play.Client.CLIENT_COMMAND which is exactly what you are looking for
Then, now you have created your packet, you have to put the value you want. As you already saw in the NMS packet class, you have a field 'a' with enum type EnumClientCommand; similarly, ProtocolLib has a ClientCommand enum in its wrapper: https://github.com/aadnk/ProtocolLib/blob/master/modules/API/src/main/java/com/comphenix/protocol/wrappers/EnumWrappers.java So,
This should work fine. Hopefully, TriggerReactor can translate String into Enum automatically even the write() method is Generic type. |
Thank you so much i know i ask so much of you lately XD but im just soaking all this in and learning. Thanks for dealing with me lol |
No worries :) glad to see you enjoying it though. Good luck with whatever you are doing now |
Yeah triggerreactor was saying that it cant translate string into enum. |
Can I see the full log though? |
WARN ... 47 more |
check out #40 |
Hi so i see your enhancement and again this might have to do with my inexperience but, tried your new parse enum commonfunction and the class that ive been using to try to parse the enum is not recognized as an enum class. Is this perhaps because of it being an abstract class? I will link you where i was getting the class from and how i typed it. |
That's a static inner class(enum is implicitly static), so I believe the name should be something different respawn.getClientCommands().write(0,parseEnum("com.comphenix.protocol.wrappers.EnumWrappers$ClientCommand","PERFORM_RESPAWN")) |
Hey again so thank you so much yes that got rid of the class error. With that said triggerreactor is now erroring saying that im trying to send a client packet to a client. |
This is the code in the protocollib support This uses sendServerPacket() not recieveClientPacket In that case, use the protocollib directly
|
Wysohn i would like to say we did it but this was like 90 percent you! Thank you so much this thread can finally go to sleep it works beautifully thank you thank you thank you! |
No worries; it was pretty advanced stuff, and you managed to follow through all the obstacles. Be proud of yourself! |
Hi im thinking of trying to send a respawn packet on the player death event. I want to do this synchronously,but i already have a playerdeathevent trigger that is async and i want to keep it out of the server thread. Is there a way to have an async event trigger so it doesnt stress the server, and a sync trigger of the same event that executes just a small snippet of code such as sending a respawn packet? Idk the possible ramifications of doing it this way but im just curious.
The text was updated successfully, but these errors were encountered: