Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-27 08:30:12 +01:00
Temporary bad fix for command crashing (#4490)
Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>
Dieser Commit ist enthalten in:
Ursprung
7e4d97f6e1
Commit
a9467cf150
@ -602,6 +602,13 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
|||||||
@Setter
|
@Setter
|
||||||
private @Nullable ItemData currentBook = null;
|
private @Nullable ItemData currentBook = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores if we've sent AvailibleCommandsPacket to the client due to it crashing if sent twice on 1.20.70/71
|
||||||
|
* Hopefully bedrock will have a hotfix so we can remove this
|
||||||
|
*/
|
||||||
|
@Setter
|
||||||
|
private boolean sentAvailibleCommands = false;
|
||||||
|
|
||||||
private final GeyserCameraData cameraData;
|
private final GeyserCameraData cameraData;
|
||||||
|
|
||||||
private final GeyserEntityData entityData;
|
private final GeyserEntityData entityData;
|
||||||
|
@ -46,6 +46,7 @@ import org.geysermc.geyser.GeyserImpl;
|
|||||||
import org.geysermc.geyser.api.event.java.ServerDefineCommandsEvent;
|
import org.geysermc.geyser.api.event.java.ServerDefineCommandsEvent;
|
||||||
import org.geysermc.geyser.command.GeyserCommandManager;
|
import org.geysermc.geyser.command.GeyserCommandManager;
|
||||||
import org.geysermc.geyser.inventory.item.Enchantment;
|
import org.geysermc.geyser.inventory.item.Enchantment;
|
||||||
|
import org.geysermc.geyser.network.GameProtocol;
|
||||||
import org.geysermc.geyser.registry.BlockRegistries;
|
import org.geysermc.geyser.registry.BlockRegistries;
|
||||||
import org.geysermc.geyser.registry.Registries;
|
import org.geysermc.geyser.registry.Registries;
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
@ -115,6 +116,12 @@ public class JavaCommandsTranslator extends PacketTranslator<ClientboundCommands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't send command suggestions if they are already sent and the client is 1.20.70 or higher due to crash bug
|
||||||
|
// TODO: Remove this check when the crash bug is fixed
|
||||||
|
if (session.isSentAvailibleCommands() && !GameProtocol.isPre1_20_70(session)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
GeyserCommandManager manager = session.getGeyser().commandManager();
|
GeyserCommandManager manager = session.getGeyser().commandManager();
|
||||||
CommandNode[] nodes = packet.getNodes();
|
CommandNode[] nodes = packet.getNodes();
|
||||||
List<CommandData> commandData = new ArrayList<>();
|
List<CommandData> commandData = new ArrayList<>();
|
||||||
@ -191,6 +198,7 @@ public class JavaCommandsTranslator extends PacketTranslator<ClientboundCommands
|
|||||||
|
|
||||||
// Finally, send the commands to the client
|
// Finally, send the commands to the client
|
||||||
session.sendUpstreamPacket(availableCommandsPacket);
|
session.sendUpstreamPacket(availableCommandsPacket);
|
||||||
|
session.setSentAvailibleCommands(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren