From ca3f9550dd466adbdd5e1793eb9673624024ab17 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Thu, 4 Mar 2021 12:26:16 -0500 Subject: [PATCH] Remove unused variables; fix opening double chests quickly --- .../geysermc/connector/network/session/GeyserSession.java | 6 ------ .../bedrock/BedrockContainerCloseTranslator.java | 1 - .../bedrock/BedrockInventoryTransactionTranslator.java | 4 ---- .../translators/java/world/JavaTradeListTranslator.java | 7 ++++--- .../java/org/geysermc/connector/utils/InventoryUtils.java | 3 +++ 5 files changed, 7 insertions(+), 14 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 77ca0d6ff..68f6297e1 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -250,12 +250,6 @@ public class GeyserSession implements CommandSender { @Setter private Entity ridingVehicleEntity; - @Setter - private long lastWindowCloseTime = 0; - - @Setter - private long lastInteractedVillagerEid; - @Setter private Int2ObjectMap craftingRecipes; private final Set unlockedRecipes; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockContainerCloseTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockContainerCloseTranslator.java index c2e0618ba..21bc1e437 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockContainerCloseTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockContainerCloseTranslator.java @@ -40,7 +40,6 @@ public class BedrockContainerCloseTranslator extends PacketTranslator { - session.setLastWindowCloseTime(0); byte windowId = packet.getId(); //Client wants close confirmation diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java index 79f658188..440dff571 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockInventoryTransactionTranslator.java @@ -327,10 +327,6 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator tags = new ArrayList<>(); + boolean addExtraTrade = packet.isRegularVillager() && packet.getVillagerLevel() < 5; + List tags = new ArrayList<>(addExtraTrade ? packet.getTrades().length + 1 : packet.getTrades().length); for (int i = 0; i < packet.getTrades().length; i++) { VillagerTrade trade = packet.getTrades()[i]; NbtMapBuilder recipe = NbtMap.builder(); @@ -101,7 +102,7 @@ public class JavaTradeListTranslator extends PacketTranslator