/*
** j###t ########## #### ####
** j###t ########## #### ####
** j###T "###L J###"
** ######P' ########## #########
** ######k, ########## T######T
** ####~###L ####
** #### q###L ########## .#####
** #### \###L ########## #####"
*/
package key.commands.clan;
import key.*;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.Enumeration;
/**
* Just an advanced create command intended for those
* intended to make clans, of such...
*/
public class Create_rank extends key.commands.Create
{
public Create_rank()
{
setKey( "rank" );
usage = "<rank>";
}
public void run( Player p, StringTokenizer args, String fullLine, CategoryCommand caller, InteractiveConnection ic, Flags flags ) throws IOException
{
String type;
String targetRank = nextArgument( args, ic );
Clan currentClan = p.getClan();
Rank tempRank = (Rank) currentClan.ranks.getElement( targetRank );
if( tempRank != null )
{
ic.sendError( "That rank exists already." );
return;
}
Rank newRank = (Rank) Factory.makeAtom( Rank.class, targetRank );
// we do this, to catch BadKeyException errors
// and NonUniqueKeyException errors
add( ic, newRank, currentClan.ranks, "You make a new rank inside your clan named '" + newRank.getName() + "'" );
// logging
Log.log( "clans/" + currentClan.getName() + ".notes", "'" + p.getName() + "' made new rank '" + newRank.getName() + "'" );
}
}