/* ** j###t ########## #### #### ** j###t ########## #### #### ** j###T "###L J###" ** ######P' ########## ######### ** ######k, ########## T######T ** ####~###L #### ** #### q###L ########## .##### ** #### \###L ########## #####" ** ** Class History ** ** Date Name Description ** ---------|------------|----------------------------------------------- ** 17Jul97 merlin created this command ** */ package key.commands; import key.*; import key.primitive.DateTime; import java.io.IOException; import java.util.StringTokenizer; import java.util.Enumeration; import java.lang.String; /** * This command is to display all the sites in detail, more detail * than sitesbanned. Shows if a site had been banned, or unbanned */ public class SiteDisplay extends Command { public SiteDisplay() { setKey( "sitedisplay" ); usage = ""; } public void run( Player p, StringTokenizer args, String fullLine, CategoryCommand caller, InteractiveConnection ic, Flags flags ) throws IOException { Object o = p.getContext(); if( !( p.getContext() instanceof Site ) ) { ic.sendFeedback( "This command can not be run unless a site is being referenced" ); return; } Site s = (Site) o; StringBuffer str = new StringBuffer(); Player pl = (Player) s.bannedBy.get(); boolean banned = ( !s.connectionsAllowed() || !s.newbiesAllowed() ); //DateTime bannedAt = (DateTime) s.getProperty( "bannedAt" ); //DateTime bannedUntil = (DateTime) s.getProperty( "bannedUntil" ); //String reasonBanned = (String) s.getProperty( "reasonBanned" ); //TextParagraph notes = (TextParagraph) s.getProperty( "notes" ); ic.sendLine(); str.append( s + " " ); //check to see if the site has ever been banned if( s.bannedAt == null ) { str.append( "has never been banned\n" ); } else { if( !banned ) str.append( "unbanned" ); else { str.append( ( s.newbiesAllowed()?"newbie":"site" ) ); str.append( " banned" ); } if ( pl != null ) str.append( " by " + pl.getName() ); if ( banned ) str.append( "\n" ); else str.append( " " ); str.append( "on " + s.bannedAt + "\n" ); if ( banned ) { str.append( "The site is banned until " + s.bannedUntil + "\n" ); } str.append( "This site was " ); str.append( ( (banned)?"banned":"unbanned" ) ); str.append( " for '" + s.reasonBanned + "'\n" ); } ic.sendFeedback( str.toString() ); ic.sendLine(); ic.send( s.notes ); ic.sendLine(); } }