Server.EventSink.InvokeCommand C# (CSharp) Méthode

InvokeCommand() public static méthode

public static InvokeCommand ( CommandEventArgs e ) : void
e CommandEventArgs
Résultat void
		public static void InvokeCommand( CommandEventArgs e )
		{
			if ( Command != null )
				Command( e );
		}

Usage Example

Exemple #1
0
        public static bool Handle(Mobile from, string text)
        {
            int    num1;
            string text1;

            string[]         textArray1;
            string           text2;
            CommandEntry     entry1;
            CommandEventArgs args1;

            if (text.StartsWith(Commands.m_CommandPrefix))
            {
                text = text.Substring(Commands.m_CommandPrefix.Length);
                num1 = text.IndexOf(' ');
                if (num1 >= 0)
                {
                    text2      = text.Substring((num1 + 1));
                    text1      = text.Substring(0, num1);
                    textArray1 = Commands.Split(text2);
                }
                else
                {
                    text2      = "";
                    text1      = text.ToLower();
                    textArray1 = new string[0];
                }
                entry1 = ((CommandEntry)Commands.m_Entries[text1]);
                if (entry1 != null)
                {
                    if (from.AccessLevel >= entry1.AccessLevel)
                    {
                        if (entry1.Handler != null)
                        {
                            args1 = new CommandEventArgs(from, text1, text2, textArray1);
                            entry1.Handler.Invoke(args1);
                            EventSink.InvokeCommand(args1);
                        }
                    }
                    else
                    {
                        if (from.AccessLevel <= Commands.m_BadCommandIngoreLevel)
                        {
                            return(false);
                        }
                        from.SendMessage("You do not have access to that command.");
                    }
                }
                else
                {
                    if (from.AccessLevel <= Commands.m_BadCommandIngoreLevel)
                    {
                        return(false);
                    }
                    from.SendMessage("That is not a valid command.");
                }
                return(true);
            }
            return(false);
        }
All Usage Examples Of Server.EventSink::InvokeCommand