Skip to content

Commands

Hazel Rojas edited this page Oct 4, 2023 · 10 revisions

Note

We will include the SteveSharp.Core using for all the commands.

You might have a Project created.

The commands will be written inside of functions.

/say

Classes references:
SteveSharp.Core.Chat

You can execute /say by calling the Chat.Say() method

For example:

Chat.Say("Hello World!")

Result:

say Hello World!

/tellraw

Classes references:
SteveSharp.Core.Chat
SteveSharp.JsonShapes.TextComponent

This is a more complicated instruction, you can check the TextComponent class to write the message structure.

You need to call the Chat.Out() method, giving a specific argument: You need to initialize an array of TextComponents

Chat.Out(
    new TextComponent[] {
        
    }
)

And then, add a TextComponent inside of the array, to create a TextComponent:

Chat.Out(
    new TextComponent[] {
        new TextComponent {
            
        }
    }
)

And then, specify the text, and another property if you want (the code is yours)

Chat.Out(
    new TextComponent[] {
        new TextComponent {
            text = "This is my /tellraw",
            color = "green",
            italic = true,
            underlined = true
        }
    }
)

Another benefit: Because the method uses an array of TextComponents, you can write multiple texts like in the commands!

Chat.Out(
    new TextComponent[] {
        new TextComponent {
            text = "This is my",
            color = "aqua",
            italic = true
        },
        new TextComponent {
            text = "/tellraw",
            color = "green",
            italic = true,
            underlined = true
        }
    }
)

Clone this wiki locally