ROUNDS
This package has been deprecated and may no longer be maintained. We recommend looking for an alternative.
Install with App

Details

Latest version
1.3.0
Last Updated
First Uploaded
Downloads
2.5K
Likes
0
Size
16KB
Dependants

Categories

Tags

Deprecated

ROUNDSCommons Commands

PLEASE REPORT ANY BUGS OR GLITCHES IN THE ROUNDS MODDING COMMUNITY DISCORD, IN #bug-reports, AND PING @scyye

How to use commands

Commands are ran by using !command.

There will be a help command shortly, for now, check the logs.

Creation

This section assumes prexisting knowledge on creating ROUNDS mods, for a tutorial on that, see here

Importing dependencies

Just the same way you inport all the DLLs, import ROUNDSCommons.dll into your dependencies

And put:

[BepInDependency("dev.sub5allts.rounds.commons")]

above your main class.

Creating Commands

To create a command, create a class that extends Command:

    public class ExampleCommand : Command
    {
    public override CommandDetails Details => new CommandDetails()
    {
        Name = "example",
        Description = "An example command",
        Scope = CommandScope.Sandbox,
        Aliases = new string[] {
            "command",
            "test"
        }
    };

    public override CommandResponse Execute(CommandEvent e)
    {
        Console.WriteLine("Hello World!");

        return new CommandResponse()
        {
            Success = true,
            Message = "Printed Hello World!",
        };
    }
}

Command Details

Name is the text that goes after "!" when running a command.

Description is the text that will show up in !help when that gets added.

Scope is the scope the command is valid in, either HOST, where only the host can do it, SANDBOX where you can do it in sandbox only, or GLOBAL, where you can do it globally.

Aliases (Optional) is equivelent commands that can be ran to do the same thing.

Execute()

Inside Execute() you can get the executor (Player), the arguments (String[]), and the details (CommandDetails) about the command.

Execute() returns a CommandResponse, these are fairly simple. Success (bool), did the command successfully run? And Message (String), the message to respond to the player with.

Registering Commands

Simply put

CommonsPlugin.instance.commandManager.AddCommand(new ExampleCommand());

inside Awake().

(Replace new ExampleCommand(), with new YourCommandClass())

Make sure ROUNDSCommons is installed, add your mod to your profile, and enjoy your commands!

Thunderstore development is made possible with ads. Please consider making an exception to your adblock.