Commands - SynapseSL/Synapse GitHub Wiki

SynapseCommand

If you want to create a custom command, that's easy!

You only need to create a new class in your project, let this Class inherit from ISynapseCommand and add the needed CommandInformation and you are done.

Synapse will do the rest :smile:

In the method Execute(), you can then use Synapse as normal.

Example:

using Synapse.Command;
using System.Linq;

namespace CommandPlugin
{
    [CommandInformation(
        Name = "hello", // The main name and parameter for your command
        Aliases = new string[] {"helloworld"}, // Aliases you can use instead of main command
        Description = "A Hello World Command", // A Description for the Commad
        Permission = "commandplugin.hello", // The permission which the player needs to execute the Command
        Platforms = new[] {Platform.RemoteAdmin,Platform.ServerConsole}, // The platforms the command can be used
        Usage = "Just type hello or helloworld in the Console!" // A message how to use the command
        )]
    public class HelloWorldCommand : ISynapseCommand
    {
        public CommandResult Execute(CommandContext context)
        {
            var result = new CommandResult();

            result.Message = "Hello World";
            result.State = CommandResultState.Ok;

            return result;
        }
    }
}