using System;
using RageCoop.Core.Scripting;
namespace RageCoop.Server.Scripting
{
///
/// Inherit from this class, constructor will be called automatically, but other scripts might have yet been loaded and will be null, you should use . to initiate your script.
///
public abstract class ServerScript : Scriptable
{
///
/// This method would be called from main thread after all scripts have been loaded.
///
public override abstract void OnStart();
///
/// This method would be called from main thread when the server is shutting down, you MUST terminate all background jobs/threads in this method.
///
public override abstract void OnStop();
public API API { get; set; }
}
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
public class Command : Attribute
{
///
/// Sets name of the command
///
public string Name { get; set; }
///
/// Set the Usage (Example: "Please use "/help"". ArgsLength required!)
///
public string Usage { get; set; }
///
/// Set the length of arguments (Example: 2 for "/message USERNAME MESSAGE". Usage required!)
///
public short ArgsLength { get; set; }
public Command(string name)
{
Name = name;
}
}
public class CommandContext
{
///
/// Gets the client which executed the command
///
public Client Client { get; internal set; }
///
/// Gets the arguments (Example: "/message USERNAME MESSAGE", Args[0] for USERNAME)
///
public string[] Args { get; internal set; }
}
}