key0-96/
key0-96/doc/key/
key0-96/doc/key/credits/
key0-96/doc/key/developers/
key0-96/doc/key/developers/resources/
key0-96/setup/caves/
key0-96/setup/help/
key0-96/setup/ruins/
key0-96/src/
key0-96/src/commands/
key0-96/src/events/
key0-96/src/hack/
key0-96/src/sql/
key0-96/src/swing/
key0-96/src/talker/forest/
key0-96/src/talker/objects/
key0-96/src/terminals/
/*
**               j###t  ########## ####   ####
**              j###t   ########## ####   ####
**             j###T               "###L J###"
**          ######P'    ##########  #########
**          ######k,    ##########   T######T
**          ####~###L   ####
**          #### q###L  ##########   .#####
**          ####  \###L ##########   #####"
**
**  $Id: LimitActions.java,v 1.1 1997/07/27 23:52:32 subtle Exp subtle $
**
**  Class History
**  
**  Date        Name         Description
**  ---------|------------|-----------------------------------------------
**  21Jul97    subtle       added support for Ranks in permissionlist
**
*/

package key.commands;
import key.*;
import java.util.StringTokenizer;
import java.util.Enumeration;
import java.io.IOException;

/**
  *  Remember to turn your expert bit on if you want to see
  *  everything.
 */
public class LimitActions extends Command
{
	public LimitActions()
	{
		setKey( "limitActions" );
		
		usage = "[<new limit>]";
	}

	public void run( Player p, StringTokenizer args, String fullLine, CategoryCommand caller, InteractiveConnection ic, Flags flags ) throws IOException
	{
		Atom context = p.getContext();
		PermissionList pl = context.getPermissionList();
		int old = pl.getLimit();
		
		if( args.hasMoreTokens() )
		{
			int newLimit = PermissionList.DEFAULT_LIMIT;
			
			try
			{
				newLimit = Integer.parseInt( args.nextToken() );
			}
			catch( NumberFormatException e )
			{
				ic.sendError( "Please use a number for the new limit" );
				return;
			}
			
			if( old != newLimit )
			{
				pl.setLimit( newLimit );
				ic.sendFeedback( "The permissionlist limit for " + context.getName() + " has been changed from " + old + " to " + newLimit + "." );
			}
			else
				ic.sendFeedback( "The permissionlist limit for " + context.getName() + " has not been changed from " + old + "." );
		}
		else
			ic.sendFeedback( "The permissionlist limit for " + context.getName() + " is " + old + "." );
		
	}
}