Skip to content

Commit

Permalink
Bedrock command suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
rtm516 committed Jul 24, 2024
1 parent b504ae8 commit 60c3d8f
Showing 1 changed file with 45 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
package org.geysermc.globallinkserver.bedrock;

import io.netty.buffer.Unpooled;

import java.util.Collections;
import java.util.UUID;
import org.cloudburstmc.math.vector.Vector2f;
import org.cloudburstmc.math.vector.Vector3f;
Expand All @@ -39,6 +41,12 @@
import org.cloudburstmc.protocol.bedrock.data.GameType;
import org.cloudburstmc.protocol.bedrock.data.PlayerPermission;
import org.cloudburstmc.protocol.bedrock.data.SpawnBiomeType;
import org.cloudburstmc.protocol.bedrock.data.command.CommandData;
import org.cloudburstmc.protocol.bedrock.data.command.CommandOverloadData;
import org.cloudburstmc.protocol.bedrock.data.command.CommandParam;
import org.cloudburstmc.protocol.bedrock.data.command.CommandParamData;
import org.cloudburstmc.protocol.bedrock.data.command.CommandPermission;
import org.cloudburstmc.protocol.bedrock.packet.AvailableCommandsPacket;
import org.cloudburstmc.protocol.bedrock.packet.BiomeDefinitionListPacket;
import org.cloudburstmc.protocol.bedrock.packet.LevelChunkPacket;
import org.cloudburstmc.protocol.bedrock.packet.PlayStatusPacket;
Expand Down Expand Up @@ -177,6 +185,43 @@ public void sendStartGame() {
setEntityMotionPacket.setRuntimeEntityId(1);
setEntityMotionPacket.setMotion(Vector3f.ZERO);
session.sendPacket(setEntityMotionPacket);

// Send the available commands
AvailableCommandsPacket availableCommandsPacket = new AvailableCommandsPacket();

CommandParamData linkIdParam = new CommandParamData();
linkIdParam.setName("linkId");
linkIdParam.setType(CommandParam.INT);
linkIdParam.setOptional(true);

availableCommandsPacket.getCommands().add(new CommandData(
"linkaccount",
"Link your account",
Collections.EMPTY_SET,
CommandPermission.ANY,
null,
Collections.EMPTY_LIST,
new CommandOverloadData[] {
new CommandOverloadData(
false,
new CommandParamData[] {
linkIdParam
}
)
}
));

availableCommandsPacket.getCommands().add(new CommandData(
"unlinkaccount",
"Unlink your account",
Collections.EMPTY_SET,
CommandPermission.ANY,
null,
Collections.EMPTY_LIST,
new CommandOverloadData[] {}
));

session.sendPacket(availableCommandsPacket);
}

public BedrockServerSession session() {
Expand Down

0 comments on commit 60c3d8f

Please sign in to comment.