private static void BanExHandler( Player player, Command cmd )
{
string playerName = cmd.Next();
if ( playerName == null || playerName.Length < 2 || ( playerName[0] != '-' && playerName[0] != '+' ) ) {
CdBanEx.PrintUsage( player );
return;
}
bool addExemption = ( playerName[0] == '+' );
string targetName = playerName.Substring( 1 );
PlayerInfo target = PlayerDB.FindPlayerInfoOrPrintMatches( player, targetName );
if ( target == null )
return;
switch ( target.BanStatus ) {
case BanStatus.Banned:
if ( addExemption ) {
player.Message( "Player {0}&S is currently banned. Unban before adding an exemption.",
target.ClassyName );
} else {
player.Message( "Player {0}&S is already banned. There is no exemption to remove.",
target.ClassyName );
}
break;
case BanStatus.IPBanExempt:
if ( addExemption ) {
player.Message( "IP-Ban exemption already exists for player {0}", target.ClassyName );
} else {
player.Message( "IP-Ban exemption removed for player {0}",
target.ClassyName );
target.BanStatus = BanStatus.NotBanned;
}
break;
case BanStatus.NotBanned:
if ( addExemption ) {
player.Message( "IP-Ban exemption added for player {0}",
target.ClassyName );
target.BanStatus = BanStatus.IPBanExempt;
} else {
player.Message( "No IP-Ban exemption exists for player {0}",
target.ClassyName );
}
break;
}
}