diff --git a/.idea/.idea.Alibi/.idea/contentModel.xml b/.idea/.idea.Alibi/.idea/contentModel.xml index fddbd67..b2e8ae4 100644 --- a/.idea/.idea.Alibi/.idea/contentModel.xml +++ b/.idea/.idea.Alibi/.idea/contentModel.xml @@ -68,7 +68,6 @@ - diff --git a/.idea/.idea.Alibi/.idea/workspace.xml b/.idea/.idea.Alibi/.idea/workspace.xml index 1cfbd75..c307a59 100644 --- a/.idea/.idea.Alibi/.idea/workspace.xml +++ b/.idea/.idea.Alibi/.idea/workspace.xml @@ -23,12 +23,10 @@ - - - - - + + + @@ -150,6 +149,7 @@ + @@ -187,22 +187,22 @@ - + - - + + - - + + - - + + - + diff --git a/Alibi.Plugins.API/Attributes/RequireStateAttribute.cs b/Alibi.Plugins.API/Attributes/RequireStateAttribute.cs index 0379dd5..0b65e1a 100644 --- a/Alibi.Plugins.API/Attributes/RequireStateAttribute.cs +++ b/Alibi.Plugins.API/Attributes/RequireStateAttribute.cs @@ -6,7 +6,12 @@ namespace Alibi.Plugins.API.Attributes public class RequireStateAttribute : Attribute { public ClientState State { get; } + public bool Kick { get; } - public RequireStateAttribute(ClientState requiredState) => State = requiredState; + public RequireStateAttribute(ClientState requiredState, bool kickIfFalse = true) + { + State = requiredState; + Kick = kickIfFalse; + } } } diff --git a/Alibi/Protocol/MessageHandler.cs b/Alibi/Protocol/MessageHandler.cs index 331ed74..75d5601 100644 --- a/Alibi/Protocol/MessageHandler.cs +++ b/Alibi/Protocol/MessageHandler.cs @@ -24,11 +24,13 @@ public static void HandleMessage(IClient client, IAOPacket packet) var stateAttr = Handlers[packet.Type].Method.GetCustomAttribute(); if (stateAttr != null) - if (client.CurrentState != stateAttr.State) + if (client.CurrentState != stateAttr.State && stateAttr.Kick) { client.Kick("Protocol violation."); return; } + else if(client.CurrentState != stateAttr.State) + return; Handlers[packet.Type].Method.Invoke(Handlers[packet.Type].Target, new object[] {client, packet}); } diff --git a/Alibi/Protocol/Messages.cs b/Alibi/Protocol/Messages.cs index 2d8e61d..c09458e 100644 --- a/Alibi/Protocol/Messages.cs +++ b/Alibi/Protocol/Messages.cs @@ -125,7 +125,7 @@ internal static void RequestCharacters(IClient client, IAOPacket packet) } [MessageHandler("RE")] - [RequireState(ClientState.Identified)] + [RequireState(ClientState.InArea, false)] internal static void RequestEvidence(IClient client, IAOPacket packet) { string[] evidenceList = new string[client.Area!.EvidenceList.Count];