SetHall.java

key0-96/src/commands/clan/SetHall.java · 1.6 KB

From the archive key0-96.tar.bz2

Download the archive   « Back to the archive contents

/*
**               j###t  ########## ####   ####
**              j###t   ########## ####   ####
**             j###T               "###L J###"
**          ######P'    ##########  #########
**          ######k,    ##########   T######T
**          ####~###L   ####
**          #### q###L  ##########   .#####
**          ####  \###L ##########   #####"
**
**  Class: sethall
**
**  Class History
**
**  Date        Name         Description
**  ---------|------------|-----------------------------------------------
**  19Jul97     snapper      creation
*/

package key.commands.clan;

import key.*;
import java.util.StringTokenizer;
import java.io.IOException;

import java.util.Enumeration;

public class SetHall extends Command
{
	public SetHall()
	{
		setKey( "sethall" );
		usage = "<name> ";
	}
	
	public void run( Player p, StringTokenizer args, String fullLine, CategoryCommand caller, InteractiveConnection ic, Flags flags ) throws IOException
	{
		if( !args.hasMoreTokens() )
		{
			usage( ic );
			return;
		}
		
		String targetHall = args.nextToken();
		
		Clan currentClan = p.getClan();
		Landscape Land = (Landscape)currentClan.getProperty( "land" );
		Room hall = (Room) Land.getElement( targetHall );
		
        if( hall == null )
        {
            ic.sendError( "That room does not exist." );
            return;
        }
		
		currentClan.setProperty( "hall", hall );
		ic.sendFeedback( "You set the clan hall to be '" + targetHall + "'" );
			
			// logging
		 Log.log( "clans/" + currentClan.getName() + ".notes", "'" + p.getName()+ "' set the clan hall to '" + targetHall + "'" );
	}
}

Site Stats

Snippets: 1791
Codebases: 571