Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-27 00:22:51 +01:00
Cancel second-hand packets to prevent double interact Fix #502
Dieser Commit ist enthalten in:
Ursprung
1b69243326
Commit
1a6b98deca
@ -318,6 +318,8 @@ public class EntityPackets {
|
|||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.VAR_INT); // 0 - Entity ID (Target)
|
map(Type.VAR_INT); // 0 - Entity ID (Target)
|
||||||
map(Type.VAR_INT); // 1 - Action Type
|
map(Type.VAR_INT); // 1 - Action Type
|
||||||
|
|
||||||
|
// Cancel second hand to prevent double interact
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
@ -328,7 +330,10 @@ public class EntityPackets {
|
|||||||
wrapper.passthrough(Type.FLOAT); // 4 - Z
|
wrapper.passthrough(Type.FLOAT); // 4 - Z
|
||||||
}
|
}
|
||||||
if (type == 0 || type == 2) {
|
if (type == 0 || type == 2) {
|
||||||
wrapper.read(Type.VAR_INT); // 2/5 - Hand
|
int hand = wrapper.read(Type.VAR_INT); // 2/5 - Hand
|
||||||
|
|
||||||
|
if (hand == 1)
|
||||||
|
wrapper.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren