- Notifications
You must be signed in to change notification settings - Fork 0
Commands
We will include the SteveSharp.Core using for all the commands.
You must have a project created.
The commands will be written inside of functions.
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!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(newTextComponent[]{})And then, add a TextComponent inside of the array, to create a TextComponent:
Chat.Out(newTextComponent[]{newTextComponent{}})And then, specify the text, and another property if you want (the code is yours)
Chat.Out(newTextComponent[]{newTextComponent{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(newTextComponent[]{newTextComponent{text="This is my",color="aqua",italic=true},newTextComponent{text="/tellraw",color="green",italic=true,underlined=true}})Classes references:
SteveSharp.Core.Score
Outside the function, add this code to declare your scoreboard, this will initialize your scoreboard object in the code.
Please specify the id parameter at least. If is dummy type, skip the type parameter, else, specify that parameter, and if your scoreboard includes a name, also specify the name parameter
ScoreMyScore=newScore("myScore");Outside the function, to add the function, you will need to initialize your scoreboard object and inside the function, add the AddObjective() method of your scoreboard.
Example:
ScoreMyScore=newScore("myScore");MyFunction.WriteAllCommands(newstring[]{MyScore.AddObjective()});Result:
scoreboardobjectivesaddmyScoredummyYou can add multiple objectives in a single instruction calling the Score.AddObjectives() method
MyFunction.WriteAllCommands(newstring[]{Score.AddObjectives(newScore[]{newScore("my"),newScore("three","deathCount"),newScore("scoreboards","used:warped_fungus_on_a_stick")})});Result:
scoreboardobjectivesaddmydummyscoreboardobjectivesaddthreedeathCountscoreboardobjectivesaddscoreboardsused:warped_fungus_on_a_stickbut will be a trouble later when you will work using that scoreboards and will be illegible, I recommend declaring all the scoreboards before, and then execute the single instruction:
ScoreMy=newScore("my");ScoreThree=newScore("three","deathCount");ScoreScoreboards=newScore("scoreboards","used:warped_fungus_on_a_stick");MyFunction.WriteAllCommands(newstring[]{Score.AddObjectives(newScore[]{My,Three,Scoreboards})});Result:
scoreboardobjectivesaddmydummyscoreboardobjectivesaddthreedeathCountscoreboardobjectivesaddscoreboardsused:warped_fungus_on_a_stick