Package frontend.alphaspawn.tools.command

Examples of frontend.alphaspawn.tools.command.Command


      // Retrieve a list of all commands
      List cmdList = cmdMgr.getCommands();

      // Display list of commands
      for ( Iterator iter = cmdList.iterator() ; iter.hasNext() ; ) {
        Command cmd = (Command)iter.next();

        // Checks if the player has the right to see the command
        if ( cmd.checkAccess( playerName ) ) {
          String cmdName = cmd.getName().trim();
          if ( cmdName.length() > longestCmd ) { longestCmd = cmdName.length(); }

          // Memorize the command name
          cmdDisplay.put( cmdName, cmd );         
        }
      }
     
      // Display the help menu to the player
      String spaces = "    ";
     
      for ( Iterator iter = cmdDisplay.entrySet().iterator() ; iter.hasNext() ; ) {
        Command cmd = (Command)( (Map.Entry)iter.next() ).getValue();
       
        // Format the output string
        StringBuffer output = new StringBuffer( cmd.getName().trim() );
        // Fill the output with some space
        for ( int i = output.length() ; i < longestCmd ; i++ ) {
          output.append( ' ' );
        }
        // Add the description to the output
        output.append( spaces ).append( cmd.getDescription().trim() );
       
        // Display the command + description to the player
        this.objConnection.sendPrivateMessage( playerName, output.toString() );
      }
    }   
View Full Code Here

TOP

Related Classes of frontend.alphaspawn.tools.command.Command

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.