Solved Cancel Swing Animation [ThatPacketAddon]

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Farid

Active Member
Feb 5, 2017
179
11
18
23
Hello, I've been trying to cancel the swing animation with packets.
90c829bd2450ebd59efc8f2f402fa442.png


Code:


Code:
packet event play_client_arm_animation:
    broadcast "%byte packet field 0 event-packet%"

It output <none> instead, I'm new to packets, so I have no idea if I'm doing this correctly. However I came across a thread on bukkit website.

Code:
public class ExampleMod extends JavaPlugin implements Listener {
    @Override
    public void onEnable() {
        ProtocolLibrary.getProtocolManager().addPacketListener(
          new PacketAdapter(this, ConnectionSide.SERVER_SIDE, Packets.Server.ARM_ANIMATION) {  
            @Override
            public void onPacketSending(PacketEvent event) {
                // This is the entity whose arm has just moved
                Entity entity = event.getPacket().getEntityModifier(event.getPlayer().getWorld()).read(0);
                int animation = event.getPacket().getIntegers().read(1);
 
                // See if this is a "move arm" action
                if (animation == 1) {
                    event.setCancelled(true);
                }
            }
        });
    }
}

I tried to implement a way with skript-mirror and ProtocolLib, here's my method

Code:
import:
    com.comphenix.protocol.events.PacketAdapter
    com.comphenix.protocol.events.PacketEvent as pEvent;



packet event play_client_arm_animation:
    set {_packet} to new pEvent.PacketEvent(event-packet)
    set {_t} to new PacketAdapter.onPacketSending({_packet})
    broadcast "%{_t}%"

However still output <none> and I also have the .jar in my skript-mirror folder. I'm aware that it's a void method, but I don't know how I can work it with skript-mirror.
If you have any idea on how I can cancel the swing animation, please let me know! I been stuck for long time.
[doublepost=1568604814,1568525903][/doublepost]Close thread: Mission fucking impossible.
 
Hi, no one reply so I will :emoji_grinning:
If you don't have found the solution , you can juste do:
Code:
packet event play_client_arm_animation:
    broadcast "%object field 0%"

and it will return "MAIN_HAND" or "OFF_HAND" or ... wiki.vg show what is inisde a packet but ProtocolLib do not use the same informations.

The cool thing with ThatPacketAddon is the "Object field %number%" when you don't know how his parsed the field
 
  • Like
Reactions: Farid
Status
Not open for further replies.