AAC-Issues icon indicating copy to clipboard operation
AAC-Issues copied to clipboard

Sending Player Teleport Packets desyncs location between client and server

Open NickkTMD opened this issue 5 years ago • 8 comments

Issue description

My gun plugin uses teleport packets to change players' yaw and pitch to do recoil. This causes AAC5 to print " dispatch: unresolved teleport" for all my movements after initially shooting, and my location becomes desynced between client and server (only relogging or /aac reload resyncs it). I've tried calling fake teleport events through bukkit but that hasn't worked. What's really weird is that this check seems to be outside of exemptions as it applies to me while I'm exempt via perms + even disabling all checks doesn't prevent it, so I can't try using API to get around it.

Code being used to handle recoil:

public void doPhysicalRecoil(Player player, float yawOffset, float pitchOffset) {
        if (yawOffset == 0 || pitchOffset == 0) return;

        EntityPlayer nms = ((CraftPlayer) player).getHandle();
        
        nms.yaw += yawOffset;
        nms.pitch -= pitchOffset;

        PacketPlayOutPosition packetPlayOutPosition = new PacketPlayOutPosition(0.0D, 0.0D, 0.0D, yawOffset, -pitchOffset, this.TELEPORT_FLAGS);
        nms.playerConnection.sendPacket(packetPlayOutPosition);
    }

Video of issue: https://streamable.com/dds4q1

Core information

Server version: Paper 1.8.8

AAC version: 5.0.6

ProtocolLib version: 4.5.1

Plugin list:

Special environment information

ViaVersion version: 3.2.1

ProtocolSupport version: N/A

ViaBackwards version: N/A

BungeeCord plugins: None Relevant

Configuration

Celebrimbor's optimized config in video but the same exact issue persists on default config

NickkTMD avatar Dec 31 '20 16:12 NickkTMD

Can the teleport detection thing be changed to work with exemptions for time being so we can just exempt players while shooting? We wanna deploy AAC5 asap because we're having a lot of issues with hackers but have no way to atm.

NickkTMD avatar Jan 10 '21 19:01 NickkTMD

Try using this overload of sendServerPacket to send teleport packets via protocollib without touching AAC's teleport handler

https://ci.dmulloy2.net/job/ProtocolLib/javadoc/com/comphenix/protocol/ProtocolManager.html#sendServerPacket(org.bukkit.entity.Player,com.comphenix.protocol.events.PacketContainer,boolean)

(with an exemption added)

konsolas avatar Jan 10 '21 20:01 konsolas

(that means the second parameter should be set to false)

Janmm14 avatar Jan 11 '21 09:01 Janmm14

@konsolas this still happen when I move to protocollib, and give player an extemtion my code: https://pastebin.com/q4SHvZrN

amadeusmz avatar Mar 14 '21 11:03 amadeusmz

@amadeusmz Why the exemtpion does not work: The exemption is not honored because it is removed just after sending the packet. you'd have to wait with removing the exemption until the player sent his reaction on the teleport packet.

Janmm14 avatar Mar 14 '21 12:03 Janmm14

@Janmm14 which packet I have to listen? Why are events not in AAC5? Using exemption that way is risky and players can exploit easily.

amadeusmz avatar Mar 14 '21 13:03 amadeusmz

@konsolas please fix this bug or give an acceptable solution ASAP. I closed my server to update it to 1.16.5, jobs have been done for weeks but I can't open my server because of this bug. I understand you feel uncomfortable as people are tagging you this much, but please think about my situation.

amadeusmz avatar Mar 16 '21 02:03 amadeusmz

@konsolas Please fix the bug. It is 7 months long, you know!? 7 months for a bug? Not only us but also many people else need it, too!

nguyenntdev avatar Jul 26 '21 11:07 nguyenntdev