From 8892e2a5c6bbfa33aae293eb9283fecb4a77232c Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Tue, 8 Jun 2021 15:41:54 -0400 Subject: [PATCH] We don't need the hash to go along with the resource pack response --- .../connection/client/ClientPlaySessionHandler.java | 3 +-- .../proxy/connection/client/ConnectedPlayer.java | 11 +++-------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java index 7c8729610..6fb7633be 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java @@ -285,8 +285,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler { @Override public boolean handle(ResourcePackResponse packet) { - return player.onResourcePackResponse(packet.getStatus(), - ByteBufUtil.decodeHexDump(packet.getHash())); + return player.onResourcePackResponse(packet.getStatus(), packet.getHash()); } @Override diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java index 26ba80c24..64bb15122 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java @@ -924,7 +924,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { .compareTo(ProtocolVersion.MINECRAFT_1_17) >= 0) { break; } - onResourcePackResponse(PlayerResourcePackStatusEvent.Status.DECLINED, new byte[0]); + onResourcePackResponse(PlayerResourcePackStatusEvent.Status.DECLINED); queued = null; } if (queued == null) { @@ -960,9 +960,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { /** * Processes a client response to a sent resource-pack. */ - public boolean onResourcePackResponse(PlayerResourcePackStatusEvent.Status status, - @Nullable byte[] hash) { - + public boolean onResourcePackResponse(PlayerResourcePackStatusEvent.Status status) { final boolean peek = status == PlayerResourcePackStatusEvent.Status.ACCEPTED; final ResourcePackInfo queued = peek ? outstandingResourcePacks.peek() : outstandingResourcePacks.poll(); @@ -979,7 +977,6 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { } }); - switch (status) { case ACCEPTED: previousResourceResponse = true; @@ -1000,9 +997,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player { } if (!peek) { - connection.eventLoop().execute(() -> { - tickResourcePackQueue(); - }); + connection.eventLoop().execute(this::tickResourcePackQueue); } return queued != null && queued.getOrigin() == ResourcePackInfo.Origin.DOWNSTREAM_SERVER;