From a65a14c2f23be97c100cc049d9894c47c54cda4f Mon Sep 17 00:00:00 2001 From: AJ Ferguson Date: Sun, 27 Oct 2019 01:56:47 -0800 Subject: [PATCH] Fix block breaking in creative --- .../geysermc/connector/network/session/GeyserSession.java | 5 ++--- .../translators/bedrock/BedrockActionTranslator.java | 8 +------- .../bedrock/BedrockInventoryTransactionTranslator.java | 7 ++++++- .../network/translators/java/JavaJoinGameTranslator.java | 1 + .../network/translators/java/JavaRespawnTranslator.java | 1 + .../java/world/JavaNotifyClientTranslator.java | 5 +++-- 6 files changed, 14 insertions(+), 13 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 a4f57c08e..c3af7cd4d 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 @@ -28,6 +28,7 @@ package org.geysermc.connector.network.session; import com.github.steveice10.mc.auth.data.GameProfile; import com.github.steveice10.mc.auth.exception.request.RequestException; import com.github.steveice10.mc.protocol.MinecraftProtocol; +import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.world.block.BlockFace; import com.github.steveice10.packetlib.Client; import com.github.steveice10.packetlib.event.session.ConnectedEvent; @@ -95,9 +96,7 @@ public class GeyserSession implements Player { private boolean closed; @Setter - private Vector3i blockDiggingPos = Vector3i.ZERO; - @Setter - private BlockFace blockDiggingFace = BlockFace.DOWN; + private GameMode gameMode = GameMode.SURVIVAL; public GeyserSession(GeyserConnector connector, BedrockServerSession bedrockServerSession) { this.connector = connector; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockActionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockActionTranslator.java index 0b5ad4ad1..334679346 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockActionTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockActionTranslator.java @@ -93,12 +93,9 @@ public class BedrockActionTranslator extends PacketTranslator SetPlayerGameTypePacket playerGameTypePacket = new SetPlayerGameTypePacket(); playerGameTypePacket.setGamemode(packet.getGamemode().ordinal()); session.getUpstream().sendPacket(playerGameTypePacket); + session.setGameMode(packet.getGamemode()); PlayStatusPacket playStatusPacket = new PlayStatusPacket(); playStatusPacket.setStatus(PlayStatusPacket.Status.PLAYER_SPAWN); diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaNotifyClientTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaNotifyClientTranslator.java index e32d27187..6c1b51aee 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaNotifyClientTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaNotifyClientTranslator.java @@ -57,10 +57,11 @@ public class JavaNotifyClientTranslator extends PacketTranslator