Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-03 14:50:19 +01:00
Add precaution if lectern container is not open
Dieser Commit ist enthalten in:
Ursprung
3dc5890649
Commit
1676242c4f
@ -31,7 +31,6 @@ import com.github.steveice10.mc.protocol.data.game.world.block.BlockFace;
|
|||||||
import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPlaceBlockPacket;
|
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.ClientClickWindowButtonPacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientCloseWindowPacket;
|
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 com.nukkitx.protocol.bedrock.packet.LecternUpdatePacket;
|
||||||
import org.geysermc.connector.inventory.LecternContainer;
|
import org.geysermc.connector.inventory.LecternContainer;
|
||||||
import org.geysermc.connector.network.session.GeyserSession;
|
import org.geysermc.connector.network.session.GeyserSession;
|
||||||
@ -60,6 +59,10 @@ public class BedrockLecternUpdateTranslator extends PacketTranslator<LecternUpda
|
|||||||
session.sendDownstreamPacket(blockPacket);
|
session.sendDownstreamPacket(blockPacket);
|
||||||
} else {
|
} else {
|
||||||
// Bedrock wants to either move a page or exit
|
// 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();
|
LecternContainer lecternContainer = (LecternContainer) session.getOpenInventory();
|
||||||
if (lecternContainer.getCurrentBedrockPage() == packet.getPage()) {
|
if (lecternContainer.getCurrentBedrockPage() == packet.getPage()) {
|
||||||
// The same page means Bedrock is closing the window
|
// The same page means Bedrock is closing the window
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren