diff --git a/src/main/java/land/chipmunk/chipmunkbot/data/chat/PlayerMessageParser.java b/src/main/java/land/chipmunk/chipmunkbot/data/chat/PlayerMessageParser.java new file mode 100644 index 0000000..8d9c27b --- /dev/null +++ b/src/main/java/land/chipmunk/chipmunkbot/data/chat/PlayerMessageParser.java @@ -0,0 +1,7 @@ +package land.chipmunk.chipmunkbot.data.chat; + +import net.kyori.adventure.text.Component; + +public interface PlayerMessageParser { + PlayerMessage parse (Component message); +} \ No newline at end of file diff --git a/src/main/java/land/chipmunk/chipmunkbot/plugins/CommandCore.java b/src/main/java/land/chipmunk/chipmunkbot/plugins/CommandCore.java index 56099fd..3b46c13 100644 --- a/src/main/java/land/chipmunk/chipmunkbot/plugins/CommandCore.java +++ b/src/main/java/land/chipmunk/chipmunkbot/plugins/CommandCore.java @@ -14,7 +14,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.Server import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetCreativeModeSlotPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerActionPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetCommandBlockPacket; -// import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundBlockEntityTagQuery; +import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundBlockEntityTagQuery; import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.object.Direction; @@ -84,21 +84,22 @@ public class CommandCore extends SessionAdapter { relEnd.getZ() + origin.getZ() ); - // TODO: Figure out how to use OpenNBT - /* CompoundTag itemTag = new CompoundTag("tag"); + CompoundTag itemTag = new CompoundTag(""); CompoundTag blockEntityTag = new CompoundTag("BlockEntityTag"); - blockEntityTag.getValue().put("Command", new StringTag("Command", command)); - blockEntityTag.getValue().put("auto", new ByteTag("auto", (byte) 1)); - itemTag.getValue().put("BlockEntityTag", blockEntityTag); + blockEntityTag.put(new StringTag("Command", command)); + blockEntityTag.put(new ByteTag("auto", (byte) 1)); + itemTag.put(blockEntityTag); - Vector3i temporaryBlockPosition = Vector3i.from((int) position.x(), (int) position.y() - 1, (int) position.z()); */ + final PositionManager position = client.position(); - client.chat().command(command); + Vector3i temporaryBlockPosition = Vector3i.from((int) position.x(), (int) position.y() - 1, (int) position.z()); - // final Session session = client.session(); - // session.send(new ServerboundSetCreativeModeSlotPacket(45, new ItemStack(371 /* command_block */, 1, itemTag))); - // session.send(new ServerboundPlayerActionPacket(PlayerAction.START_DIGGING, temporaryBlockPosition, Direction.NORTH, 0)); - // session.send(new ServerboundUseItemOnPacket(temporaryBlockPosition, Direction.NORTH, Hand.OFF_HAND, 0.5f, 0.5f, 0.5f, false, 0)); + // client.chat().command(command); + + final Session session = client.session(); + session.send(new ServerboundSetCreativeModeSlotPacket(45, new ItemStack(371 /* command_block */, 1, itemTag))); + session.send(new ServerboundPlayerActionPacket(PlayerAction.START_DIGGING, temporaryBlockPosition, Direction.NORTH, 0)); + session.send(new ServerboundUseItemOnPacket(temporaryBlockPosition, Direction.NORTH, Hand.OFF_HAND, 0.5f, 0.5f, 0.5f, false, 0)); } public void incrementCurrentBlock () {