Skip to content

Commit

Permalink
Add precaution if lectern container is not open
Browse files Browse the repository at this point in the history
  • Loading branch information
Camotoy committed Jan 22, 2021
1 parent 3dc5890 commit 1676242
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPlaceBlockPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientClickWindowButtonPacket;
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientCloseWindowPacket;
import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.packet.LecternUpdatePacket;
import org.geysermc.connector.inventory.LecternContainer;
import org.geysermc.connector.network.session.GeyserSession;
Expand Down Expand Up @@ -60,6 +59,10 @@ public void translate(LecternUpdatePacket packet, GeyserSession session) {
session.sendDownstreamPacket(blockPacket);
} else {
// Bedrock wants to either move a page or exit
if (!(session.getOpenInventory() instanceof LecternContainer)) {
session.getConnector().getLogger().debug("Expected lectern but it wasn't open!");
return;
}
LecternContainer lecternContainer = (LecternContainer) session.getOpenInventory();
if (lecternContainer.getCurrentBedrockPage() == packet.getPage()) {
// The same page means Bedrock is closing the window
Expand Down

0 comments on commit 1676242

Please sign in to comment.