fCraft.LifeHandler.ProcessCommand C# (CSharp) Method

ProcessCommand() public static method

public static ProcessCommand ( Player p, Command cmd ) : void
p Player
cmd Command
return void
        public static void ProcessCommand( Player p, Command cmd )
        {
            string command = cmd.Next();
            if ( String.IsNullOrWhiteSpace( command ) ) {
                p.Message( "&WLife command is missing or empty" );
                return;
            }
            LifeCommand c;
            if ( !Commands.TryGetValue( command.ToLower(), out c ) ) {
                p.Message( "&WUnknown life command " + command + ". &hType '/life help' for the list of commands." );
                return;
            }
            c.F( p, cmd );
        }

Usage Example

Example #1
0
 private static void LifeHandlerFunc(Player p, Command cmd)
 {
     try {
         if (!cmd.HasNext)
         {
             p.Message("&H/Life <command> <params>. Commands are Help, Create, Delete, Start, Stop, Set, List, Print");
             p.Message("Type /Life help <command> for more information");
             return;
         }
         LifeHandler.ProcessCommand(p, cmd);
     } catch (Exception e) {
         p.Message("Error: " + e.Message);
     }
 }