3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-25 15:50:14 +01:00

Fix running Geyser commands ingame

Dieser Commit ist enthalten in:
RednedEpic 2020-03-06 19:37:35 -06:00
Ursprung 0e355c1a95
Commit 9e203d48aa

Datei anzeigen

@ -29,6 +29,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.client.ClientChatPacket;
import com.nukkitx.protocol.bedrock.packet.CommandRequestPacket; import com.nukkitx.protocol.bedrock.packet.CommandRequestPacket;
import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.GeyserConnector;
import org.geysermc.connector.command.GeyserCommandMap;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.PacketTranslator;
@ -37,8 +38,9 @@ public class BedrockCommandRequestTranslator extends PacketTranslator<CommandReq
@Override @Override
public void translate(CommandRequestPacket packet, GeyserSession session) { public void translate(CommandRequestPacket packet, GeyserSession session) {
String command = packet.getCommand().replace("/", ""); String command = packet.getCommand().replace("/", "");
if (GeyserConnector.getInstance().getCommandMap().getCommands().containsKey(command)) { GeyserCommandMap commandMap = GeyserConnector.getInstance().getCommandMap();
GeyserConnector.getInstance().getCommandMap().runCommand(session, command); if (command.startsWith("geyser ") && commandMap.getCommands().containsKey(command.split(" ")[1])) {
commandMap.runCommand(session, command);
} else { } else {
ClientChatPacket chatPacket = new ClientChatPacket(packet.getCommand()); ClientChatPacket chatPacket = new ClientChatPacket(packet.getCommand());
session.getDownstream().getSession().send(chatPacket); session.getDownstream().getSession().send(chatPacket);