Wolfringo Wolfringo
Wolfringo Wolfringo
Wolfringo (c) 2020 TehGM
DocFX, DiscordFX theme.
Search Results for

    Class CommandsHandlerAttribute

    Marks a type as a command handler.

    Inheritance
    System.Object
    System.Attribute
    CommandsHandlerAttribute
    Namespace: TehGM.Wolfringo.Commands
    Assembly: Wolfringo.Commands.dll
    Syntax
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = true)]
    public class CommandsHandlerAttribute : Attribute
    Remarks

    By default, Commands System will only load comands from types marked with CommandsHandlerAttribute, unless they're explicitly added to CommandsOptions's Classes collection.

    It is recommended to mark handlers with this attribute regardless of loading method.

    Default Wolfringo commands loading logic will ignore static classes and structs.

    Properties

    | Improve this Doc View Source

    IsPersistent

    Whether the command handler is persistent.

    Declaration
    public bool IsPersistent { get; set; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    Persistent handlers will be initialized once, and kept in Commands System's memory during its lifetime. This will disable the default behaviour of reinitializing handler each time a command is executed. This is especially useful when the handler needs to keep any state, or listens to IWolfClient's events.

    It's up to ICommandsHandlerProvider to respect this value. CommandsHandlerProvider included with Wolfringo will always respect it and cache handlers if this value is true.