1.8.8 player on 1.20.4 server kicked when right clicking blocks
jtJava opened this issue ยท 5 comments
/viaversion dump
Output
https://dump.viaversion.com/2157df1bae4938b4b7cdfc2bfc4e3c9ddc7c7d706217c864cce792eb5b2fc99f
Console Error
[1.8.8](https://mclo.gs/qLtQWoE)
Bug Description
Right clicking blocks causes a netty error and kicks the player on a 1.20.4 server.
Steps to Reproduce
Login with a 1.7 or 1.8 Client and right click any block
Expected Behavior
No kick or exception
Additional Server Info
public class LookFixListener extends SimplePacketListenerAbstract {
private static final EnumSet<PacketType.Play.Client> DELAYED_PACKETS = EnumSet.of(PacketType.Play.Client.PLAYER_BLOCK_PLACEMENT);
private final Map<User, List<PacketWrapper<?>>> delayedActions = new HashMap<>();
@Override
public void onPacketPlayReceive(PacketPlayReceiveEvent event) {
if (!event.getUser().getClientVersion().equals(ClientVersion.V_1_8)) {
return;
}
if (DELAYED_PACKETS.contains(event.getPacketType())) {
this.delayedActions.get(event.getUser()).add(new PacketWrapper<>(event.clone()));
event.setCancelled(true);
} else if (WrapperPlayClientPlayerFlying.isFlying(event.getPacketType())){
handleFly(event.getUser());
}
}
public void handleFly(User user) {
for (PacketWrapper<?> wrapper : this.delayedActions.get(user)) {
PacketEvents.getAPI().getProtocolManager().receivePacketSilently(user.getChannel(), wrapper);
}
}
@Override
public void onUserConnect(UserConnectEvent event) {
this.delayedActions.put(event.getUser(), new ArrayList<>());
}
@Override
public void onUserDisconnect(UserDisconnectEvent event) {
super.onUserDisconnect(event);
}
}
Checklist
- Via plugins are only running on EITHER the backend servers (e.g. Paper) OR the proxy (e.g. BungeeCord), not on both.
- I have included a ViaVersion dump.
- If applicable, I have included a paste (not a screenshot) of the error.
- I have tried the latest build(s) from https://ci.viaversion.com/ and the issue still persists.
- I have looked at https://www.spigotmc.org/resources/viarewind-legacy-support.52924/ and it does not offer a fix for my problem
Please update all Via* plugins from https://ci.viaversion.com/. In case the issue still persists send the new dump and the issue will be reopened
stack,outdated_proxy
https://dump.viaversion.com/670b6b26a1f6e9641b506a73123e11b2d58632cc25012d1afd055c2aa1d3e1c5
I've debugged and found the following code to be the issue:
public class LookFixListener extends SimplePacketListenerAbstract {
private static final EnumSet<PacketType.Play.Client> DELAYED_PACKETS = EnumSet.of(PacketType.Play.Client.PLAYER_BLOCK_PLACEMENT);
private final Map<User, List<PacketWrapper<?>>> delayedActions = new HashMap<>();
@Override
public void onPacketPlayReceive(PacketPlayReceiveEvent event) {
if (!event.getUser().getClientVersion().equals(ClientVersion.V_1_8)) {
return;
}
if (DELAYED_PACKETS.contains(event.getPacketType())) {
this.delayedActions.get(event.getUser()).add(new PacketWrapper<>(event.clone()));
event.setCancelled(true);
} else if (WrapperPlayClientPlayerFlying.isFlying(event.getPacketType())){
handleFly(event.getUser());
}
}
public void handleFly(User user) {
for (PacketWrapper<?> wrapper : this.delayedActions.get(user)) {
PacketEvents.getAPI().getProtocolManager().receivePacketSilently(user.getChannel(), wrapper);
}
}
@Override
public void onUserConnect(UserConnectEvent event) {
this.delayedActions.put(event.getUser(), new ArrayList<>());
}
@Override
public void onUserDisconnect(UserDisconnectEvent event) {
super.onUserDisconnect(event);
}
}