Class EventHandlerAttribute
Namespace: ReadyM.SDK.Attributes
Assembly: ReadyM.SDK.dll
Declares a method as a network event handler. The project it is compiled into says which side runs it - game or server.
[AttributeUsage(AttributeTargets.Method)]
public sealed class EventHandlerAttribute : Attribute
Inheritance
object ← Attribute ← EventHandlerAttribute
Inherited Members
Attribute.GetCustomAttributes(MemberInfo, Type), Attribute.GetCustomAttributes(MemberInfo, Type, bool), Attribute.GetCustomAttributes(MemberInfo), Attribute.GetCustomAttributes(MemberInfo, bool), Attribute.IsDefined(MemberInfo, Type), Attribute.IsDefined(MemberInfo, Type, bool), Attribute.GetCustomAttribute(MemberInfo, Type), Attribute.GetCustomAttribute(MemberInfo, Type, bool), Attribute.GetCustomAttributes(ParameterInfo), Attribute.GetCustomAttributes(ParameterInfo, Type), Attribute.GetCustomAttributes(ParameterInfo, Type, bool), Attribute.GetCustomAttributes(ParameterInfo, bool), Attribute.IsDefined(ParameterInfo, Type), Attribute.IsDefined(ParameterInfo, Type, bool), Attribute.GetCustomAttribute(ParameterInfo, Type), Attribute.GetCustomAttribute(ParameterInfo, Type, bool), Attribute.GetCustomAttributes(Module, Type), Attribute.GetCustomAttributes(Module), Attribute.GetCustomAttributes(Module, bool), Attribute.GetCustomAttributes(Module, Type, bool), Attribute.IsDefined(Module, Type), Attribute.IsDefined(Module, Type, bool), Attribute.GetCustomAttribute(Module, Type), Attribute.GetCustomAttribute(Module, Type, bool), Attribute.GetCustomAttributes(Assembly, Type), Attribute.GetCustomAttributes(Assembly, Type, bool), Attribute.GetCustomAttributes(Assembly), Attribute.GetCustomAttributes(Assembly, bool), Attribute.IsDefined(Assembly, Type), Attribute.IsDefined(Assembly, Type, bool), Attribute.GetCustomAttribute(Assembly, Type), Attribute.GetCustomAttribute(Assembly, Type, bool), Attribute.Equals(object?), Attribute.GetHashCode(), Attribute.Match(object?), Attribute.IsDefaultAttribute(), Attribute.TypeId, object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Examples
Validate, Apply, Observe, and Rejected need an in parameter for the event, and optionally an EventContext parameter.
[EventHandler(Stage.Validate)] // Apply, Observe
public void CheckPlayerCanJoin(in PlayerJoinedEvent e, EventContext ctx)
Filter needs a ref, as it can change the event before it's applied.
[EventHandler(Stage.Filter)]
public void ChangePlayerJoinParams(ref PlayerJoinedEvent e, EventContext ctx)
Constructors
EventHandlerAttribute(Stage)
Declares a method as a network event handler. The project it is compiled into says which side runs it - game or server.
public EventHandlerAttribute(Stage stage)
Parameters
stage Stage
Which stage of event propagation this method handles.
Examples
Validate, Apply, Observe, and Rejected need an in parameter for the event, and optionally an EventContext parameter.
[EventHandler(Stage.Validate)] // Apply, Observe
public void CheckPlayerCanJoin(in PlayerJoinedEvent e, EventContext ctx)
Filter needs a ref, as it can change the event before it's applied.
[EventHandler(Stage.Filter)]
public void ChangePlayerJoinParams(ref PlayerJoinedEvent e, EventContext ctx)
Properties
After
The manifest id of a mod this handler runs after, for the rare case where dependency order is not enough.
public string? After { get; set; }
Property Value
SkipOnRaisingClient
On Apply only: skip this handler on the client that raised the event, because that client already did what it applies.
public bool SkipOnRaisingClient { get; set; }
Property Value
Stage
Which stage of event propagation this method handles.
public Stage Stage { get; }