本文整理汇总了C#中fCraft.Player.NoPlayerMessage方法的典型用法代码示例。如果您正苦于以下问题:C# Player.NoPlayerMessage方法的具体用法?C# Player.NoPlayerMessage怎么用?C# Player.NoPlayerMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fCraft.Player
的用法示例。
在下文中一共展示了Player.NoPlayerMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Bring
internal static void Bring( Player player, Command cmd )
{
if( player.Can( Permissions.Bring ) ) {
string name = cmd.Next();
Player target = player.world.FindPlayer( name );
if( target != null ) {
Position pos = player.pos;
pos.x += 1;
pos.y += 1;
pos.h += 1;
target.Send( PacketWriter.MakeTeleport( 255, pos ) );
} else {
player.NoPlayerMessage( name );
}
} else {
player.NoAccessMessage( Permissions.Bring );
}
}
示例2: Freeze
internal static void Freeze( Player player, Command cmd )
{
if( player.Can( Permissions.Freeze ) ) {
string name = cmd.Next();
Player target = Server.FindPlayer( name );
if( target != null ) {
if( !target.isFrozen ) {
Server.SendToAll( Color.Sys + target.nick + " has been frozen by " + player.nick );
target.isFrozen = true;
} else {
player.Message( target.GetLogName() + " is already frozen." );
}
} else {
player.NoPlayerMessage( name );
}
} else {
player.NoAccessMessage( Permissions.Freeze );
}
}
示例3: ZoneEdit
internal static void ZoneEdit( Player player, Command cmd ) {
bool changesWereMade = false;
string zoneName = cmd.Next();
if( zoneName == null ) {
player.Message( "No zone name specified. See &H/help zedit" );
return;
}
Zone zone = player.World.Map.FindZone( zoneName );
if( zone == null ) {
player.Message( "No zone found with the name \"{0}\". See &H/zones", zoneName );
return;
}
string name;
while( (name = cmd.Next()) != null ) {
if( name.Length < 2 ) continue;
if( name.StartsWith( "+" ) ) {
PlayerInfo info;
if( !PlayerDB.FindPlayerInfo( name.Substring( 1 ), out info ) ) {
player.Message( "More than one player found matching \"{0}\"", name.Substring( 1 ) );
return;
}
if( info == null ) {
player.NoPlayerMessage( name.Substring( 1 ) );
return;
}
// prevent players from whitelisting themselves to bypass protection
if( !player.Info.Rank.AllowSecurityCircumvention && player.Info == info ) {
if( !zone.Controller.Check( info ) ) {
player.Message( "You must be {0}+&S to add yourself to this zone's whitelist.",
zone.Controller.MinRank.GetClassyName() );
continue;
}
}
switch( zone.Controller.Include( info ) ) {
case PermissionOverride.Deny:
player.Message( "{0}&S is no longer excluded from zone {1}",
info.GetClassyName(), zone.GetClassyName() );
changesWereMade = true;
break;
case PermissionOverride.None:
player.Message( "{0}&S is now included in zone {1}",
info.GetClassyName(), zone.GetClassyName() );
changesWereMade = true;
break;
case PermissionOverride.Allow:
player.Message( "{0}&S is already included in zone {1}",
info.GetClassyName(), zone.GetClassyName() );
break;
}
} else if( name.StartsWith( "-" ) ) {
PlayerInfo info;
if( !PlayerDB.FindPlayerInfo( name.Substring( 1 ), out info ) ) {
player.Message( "More than one player found matching \"{0}\"", name.Substring( 1 ) );
return;
}
if( info == null ) {
player.NoPlayerMessage( name.Substring( 1 ) );
return;
}
switch( zone.Controller.Exclude( info ) ) {
case PermissionOverride.Deny:
player.Message( "{0}&S is already excluded from zone {1}",
info.GetClassyName(), zone.GetClassyName() );
break;
case PermissionOverride.None:
player.Message( "{0}&S is now excluded from zone {1}",
info.GetClassyName(), zone.GetClassyName() );
changesWereMade = true;
break;
case PermissionOverride.Allow:
player.Message( "{0}&S is no longer included in zone {1}",
info.GetClassyName(), zone.GetClassyName() );
changesWereMade = true;
break;
}
} else {
Rank minRank = RankManager.ParseRank( name );
if( minRank != null ) {
// prevent players from lowering rank so bypass protection
if( !player.Info.Rank.AllowSecurityCircumvention &&
zone.Controller.MinRank > player.Info.Rank && minRank <= player.Info.Rank ) {
player.Message( "You are not allowed to lower the zone's rank." );
continue;
}
if( zone.Controller.MinRank != minRank ) {
zone.Controller.MinRank = minRank;
player.Message( "Permission for zone \"{0}\" changed to {1}+",
zone.Name,
//.........这里部分代码省略.........
示例4: DoBan
internal static void DoBan( Player player, Command cmd, bool banIP, bool banAll, bool unban )
{
if( !player.Can( Permissions.Ban ) ) {
player.NoAccessMessage( Permissions.Ban );
return;
} else if( banIP && !player.Can( Permissions.BanIP ) ) {
player.NoAccessMessage( Permissions.BanIP );
return;
} else if( banAll && !player.Can( Permissions.BanAll ) ) {
player.NoAccessMessage( Permissions.BanAll );
return;
}
string arg = cmd.Next();
string reason = cmd.NextAll();
IPAddress address;
Player offender = Server.FindPlayer( arg );
PlayerInfo info = PlayerDB.FindPlayerInfoExact( arg );
// ban by IP address
if( banIP && IPAddress.TryParse( arg, out address ) ) {
DoIPBan( player, address, reason, null, banAll, unban );
// ban online players
} else if( !unban && offender != null ) {
// check permissions
if( !player.info.playerClass.CanBan( offender.info.playerClass ) ) {
player.Message( "You can only ban players ranked " + player.info.playerClass.maxBan.color + player.info.playerClass.maxBan.name + Color.Sys + " or lower." );
player.Message( offender.GetLogName() + " is ranked " + offender.info.playerClass.name + "." );
} else {
address = offender.info.lastIP;
if( banIP ) DoIPBan( player, address, reason, offender.name, banAll, unban );
if( offender.info.ProcessBan( player.name, reason ) ) {
Logger.Log( "{0} was banned by {1}.", LogType.UserActivity, offender.info.name, player.GetLogName() );
Server.SendToAll( Color.Red + offender.name + " was banned by " + player.nick, offender );
offender.session.Kick( "You were just banned by " + player.GetLogName() );
} else {
player.Message( offender.name + " is already banned." );
}
}
// ban offline players
} else if( info != null ) {
if( !player.info.playerClass.CanBan( info.playerClass ) ) {
PlayerClass maxRank = player.info.playerClass.maxBan;
if( maxRank == null ) {
player.Message( "You can only ban players ranked " + player.info.playerClass.color + player.info.playerClass.name + Color.Sys + " or lower." );
} else {
player.Message( "You can only ban players ranked " + maxRank.color + maxRank.name + Color.Sys + " or lower." );
}
player.Message( info.name + " is ranked " + info.playerClass.name + "." );
} else {
address = info.lastIP;
if( banIP ) DoIPBan( player, address, reason, info.name, banAll, unban );
if( unban ) {
if( info.ProcessUnBan( player.name, reason ) ) {
Logger.Log( "{0} (offline) was unbanned by {1}", LogType.UserActivity, info.name, player.GetLogName() );
Server.SendToAll( Color.Red + info.name + " (offline) was unbanned by " + player.nick );
} else {
player.Message( info.name + " (offline) is not currenty banned." );
}
} else {
if( info.ProcessBan( player.name, reason ) ) {
Logger.Log( "{0} (offline) was banned by {1}.", LogType.UserActivity, info.name, player.GetLogName() );
Server.SendToAll( Color.Red + info.name + " (offline) was banned by " + player.nick );
} else {
player.Message( info.name + " (offline) is already banned." );
}
}
}
} else {
player.NoPlayerMessage( arg );
player.Message( "Use the FULL player name for ban/unban commands." );
}
}
示例5: BanInfo
internal static void BanInfo( Player player, Command cmd ) {
string name = cmd.Next();
IPAddress address;
if( name == null ) {
name = player.Name;
} else if( !player.Can( Permission.ViewOthersInfo ) ) {
player.NoAccessMessage( Permission.ViewOthersInfo );
return;
}
if( Server.IsIP( name ) && IPAddress.TryParse( name, out address ) ) {
IPBanInfo info = IPBanList.Get( address );
if( info != null ) {
player.Message( "{0} was banned by {1} on {2:dd MMM yyyy}.",
info.Address,
info.BannedBy,
info.BanDate );
if( !String.IsNullOrEmpty( info.PlayerName ) ) {
player.Message( " IP ban was banned by association with {0}",
info.PlayerName );
}
if( info.Attempts > 0 ) {
player.Message( " There have been {0} attempts to log in, most recently", info.Attempts );
player.Message( " on {0:dd MMM yyyy} by {1}.",
info.LastAttemptDate,
info.LastAttemptName );
}
if( info.BanReason.Length > 0 ) {
player.Message( " Ban reason: {0}", info.BanReason );
}
} else {
player.Message( "{0} is currently NOT banned.", address );
}
} else {
PlayerInfo info;
if( !PlayerDB.FindPlayerInfo( name, out info ) ) {
player.Message( "More than one player found matching \"{0}\"", name );
} else if( info != null ) {
if( info.Banned ) {
player.Message( "Player {0}&S is &WBANNED", info.GetClassyName() );
} else {
player.Message( "Player {0}&S is NOT banned.", info.GetClassyName() );
}
if( !String.IsNullOrEmpty( info.BannedBy ) ) {
player.Message( " Last ban by {0} on {1:dd MMM yyyy} ({2} ago).",
info.BannedBy,
info.BanDate,
info.TimeSinceBan.ToMiniString() );
if( info.BanReason.Length > 0 ) {
player.Message( " Last ban reason: {0}", info.BanReason );
}
}
if( !String.IsNullOrEmpty( info.UnbannedBy ) ) {
player.Message( " Unbanned by {0} on {1:dd MMM yyyy} ({2} ago).",
info.UnbannedBy,
info.UnbanDate,
info.TimeSinceUnban.ToMiniString() );
if( info.UnbanReason.Length > 0 ) {
player.Message( " Last unban reason: {0}", info.UnbanReason );
}
}
if( info.BanDate != DateTime.MinValue ) {
TimeSpan banDuration;
if( info.Banned ) {
banDuration = info.TimeSinceBan;
} else {
banDuration = info.UnbanDate.Subtract( info.BanDate );
}
player.Message( " Last ban duration: {0} days and {1:F1} hours.",
(int)banDuration.TotalDays,
banDuration.TotalHours );
}
} else {
player.NoPlayerMessage( name );
}
}
}
示例6: ZoneAdd
internal static void ZoneAdd( Player player, Command cmd ) {
string zoneName = cmd.Next();
if( zoneName == null ) {
cdZoneAdd.PrintUsage( player );
return;
}
Zone zone = new Zone();
if( zoneName.StartsWith( "+" ) ) {
PlayerInfo info;
if( !PlayerDB.FindPlayerInfo( zoneName.Substring( 1 ), out info ) ) {
player.Message( "More than one player found matching \"{0}\"", zoneName.Substring( 1 ) );
return;
}
if( info == null ) {
player.NoPlayerMessage( zoneName.Substring( 1 ) );
return;
}
zone.Name = info.Name;
zone.Controller.MinRank = info.Rank.NextRankUp ?? info.Rank;
zone.Controller.Include( info );
player.Message( "Zone: Creating a {0}+&S zone for player {1}&S. Place a block or type /mark to use your location.",
zone.Controller.MinRank.GetClassyName(), info.GetClassyName() );
player.SetCallback( 2, ZoneAddCallback, zone, cdZoneAdd.Permissions );
} else {
if( !World.IsValidName( zoneName ) ) {
player.Message( "\"{0}\" is not a valid zone name", zoneName );
return;
}
if( player.World.Map.FindZone( zoneName ) != null ) {
player.Message( "A zone with this name already exists. Use &H/zedit&S to edit." );
return;
}
zone.Name = zoneName;
string rankName = cmd.Next();
if( rankName == null ) {
player.Message( "No rank was specified. See &H/help zone" );
return;
}
Rank minRank = RankManager.ParseRank( rankName );
if( minRank != null ) {
string name;
while( (name = cmd.Next()) != null ) {
if( name.Length == 0 ) continue;
PlayerInfo info;
if( !PlayerDB.FindPlayerInfo( name.Substring( 1 ), out info ) ) {
player.Message( "More than one player found matching \"{0}\"", name.Substring( 1 ) );
return;
}
if( info == null ) {
player.NoPlayerMessage( name.Substring( 1 ) );
return;
}
if( name.StartsWith( "+" ) ) {
zone.Controller.Include( info );
} else if( name.StartsWith( "-" ) ) {
zone.Controller.Exclude( info );
}
}
zone.Controller.MinRank = minRank;
player.SetCallback( 2, ZoneAddCallback, zone, cdZoneAdd.Permissions );
player.Message( "Zone: Place a block or type /mark to use your location." );
} else {
player.NoRankMessage( rankName );
}
}
}
示例7: Whois
internal static void Whois( Player player, Command cmd )
{
string name = cmd.Next();
if( name == null ) {
player.Message( "Usage: " + Color.Help + "/whois PlayerNickname" );
return;
}
Player target = Server.FindPlayerByNick( name );
if( target != null ) {
if( target.nick != target.name ) {
player.Message( "Player named " + target.name + " is using a nickname \"" + target.nick + "\"" );
} else {
player.Message( "Player named " + target.name + " is not using any nickname." );
}
} else {
player.NoPlayerMessage( name );
}
}
示例8: ChangeClass
// Change player class
internal static void ChangeClass( Player player, Command cmd )
{
string name = cmd.Next();
string newClassName = cmd.Next();
if( name == null || newClassName == null ) {
player.Message( "Usage: " + Color.Help + "/user PlayerName ClassName" );
player.Message( "To see a list of classes and permissions, use " + Color.Help + "/class" );
return;
}
Player target = Server.FindPlayer( name );
if( target == null ) {
player.NoPlayerMessage( name );
return;
}
PlayerClass newClass = ClassList.FindClass( newClassName );
if( newClass == null ) {
player.Message( "Unrecognized player class: " + newClassName );
return;
}
if( target.info.playerClass == newClass ) {
player.Message( target.GetLogName() + " is already " + newClass.color + newClass.name );
return;
}
bool promote = target.info.playerClass.rank < newClass.rank;
if( (promote && !player.Can( Permissions.Promote )) ) {
player.NoAccessMessage( Permissions.Promote );
return;
} else if( !promote && !player.Can( Permissions.Demote ) ) {
player.NoAccessMessage( Permissions.Demote );
return;
}
if( promote && !player.info.playerClass.CanPromote( newClass ) ) {
player.Message( "You can only promote players up to " + player.info.playerClass.maxPromote.color + player.info.playerClass.maxPromote.name );
player.Message( target.GetLogName() + " is ranked " + target.info.playerClass.name + "." );
return;
} else if( !promote && !player.info.playerClass.CanDemote( target.info.playerClass ) ) {
player.Message( "You can only demote players that are " + player.info.playerClass.maxDemote.color + player.info.playerClass.maxDemote.name + Color.Sys + " or lower." );
player.Message( target.GetLogName() + " is ranked " + target.info.playerClass.name + "." );
return;
}
if( promote && target.info.playerClass.rank < newClass.rank ||
target.info.playerClass.rank > newClass.rank ) {
PlayerClass oldClass = target.info.playerClass;
if( !Server.FirePlayerClassChange( target, player, oldClass, newClass ) ) return;
Logger.Log( "{0} changed the class of {1} from {2} to {3}.", LogType.UserActivity,
player.GetLogName(), target.GetLogName(), target.info.playerClass.name, newClass.name );
target.info.playerClass = newClass;
target.info.classChangeDate = DateTime.Now;
target.info.classChangedBy = player.name;
Server.FirePlayerListChangedEvent();
target.Send( PacketWriter.MakeSetPermission( target ) );
target.mode = BlockPlacementMode.Normal;
if( promote ) {
player.Message( "You promoted " + target.name + " to " + newClass.color + newClass.name );
target.Message( "You have been promoted to " + newClass.color + newClass.name + Color.Sys + " by " + player.nick );
} else {
player.Message( "You demoted " + target.name + " to " + newClass.color + newClass.name );
target.Message( "You have been demoted to " + newClass.color + newClass.name + Color.Sys + " by " + player.nick );
}
if( Config.GetBool( ConfigKey.ClassPrefixesInList ) || Config.GetBool( ConfigKey.ClassColorsInChat ) ) {
target.world.UpdatePlayer( target );
}
} else {
if( promote ) {
player.Message( target.GetLogName() + " is already same or lower rank than " + newClass.name );
} else {
player.Message( target.GetLogName() + " is already same or higher rank than " + newClass.name );
}
}
}
示例9: Info
// Player information display.
// When used without arguments, shows players's own stats.
// An optional argument allows to look at other people's stats.
internal static void Info( Player player, Command cmd )
{
string name = cmd.Next();
if( name == null ) {
name = player.name;
} else if( !player.Can( Permissions.ViewOthersInfo ) ) {
player.NoAccessMessage( Permissions.ViewOthersInfo );
return;
}
Player target = Server.FindPlayerByNick( name );
if( target != null && target.nick != target.name ) {
player.Message( Color.Red, "Warning: Player named " + target.name + " is using a nickname \"" + target.nick + "\"" );
player.Message( Color.Red, "The information below is for the REAL " + name );
}
PlayerInfo info;
if( !PlayerDB.FindPlayerInfo( name, out info ) ) {
player.ManyPlayersMessage( name );
} else if( info != null ) {
if( DateTime.Now.Subtract( info.lastLoginDate ).TotalDays < 1 ) {
player.Message( String.Format( "About {0}: Last login {1:F1} hours ago from {2}",
info.name,
DateTime.Now.Subtract( info.lastLoginDate ).TotalHours,
info.lastIP ) );
} else {
player.Message( String.Format( "About {0}: Last login {1:F1} days ago from {2}",
info.name,
DateTime.Now.Subtract( info.lastLoginDate ).TotalDays,
info.lastIP ) );
}
player.Message( String.Format( " Logged in {0} time(s) since {1:dd MMM yyyy}.",
info.timesVisited,
info.firstLoginDate ) );
player.Message( String.Format( " Built {0} and deleted {1} blocks, and wrote {2} messages.",
info.blocksBuilt,
info.blocksDeleted,
info.linesWritten ) );
if( player.info.classChangedBy != "-" ) {
player.Message( String.Format( " Promoted to {0} by {1} on {2:dd MMM yyyy}.",
info.playerClass.name,
info.classChangedBy,
info.classChangeDate ) );
} else {
player.Message( String.Format( " Class is {0} (default).",
info.playerClass.name ) );
}
TimeSpan totalTime = info.totalTimeOnServer;
if( Server.FindPlayerExact( player.name ) != null ) {
totalTime = totalTime.Add( DateTime.Now.Subtract( info.lastLoginDate ) );
}
player.Message( String.Format( " Spent a total of {0:F1} hours ({1:F1} minutes) here.",
totalTime.TotalHours,
totalTime.TotalMinutes ) );
} else {
player.NoPlayerMessage( name );
}
}
示例10: Where
internal static void Where( Player player, Command cmd )
{
int offset;
string name = cmd.Next();
Player target = player;
if( name != null ) {
target = Server.FindPlayer( name );
if( target != null ) {
player.Message( "Coordinates of player \"" + target.nick + "\" (on \"" + target.world.name + "\"):" );
} else {
player.NoPlayerMessage( name );
return;
}
}
offset = (int)(target.pos.r / 255f * 64f) + 32;
player.Message( Color.Silver, String.Format( "({0},{1},{2}) - {3}[{4}{5}{6}{3}{7}]",
target.pos.x / 32,
target.pos.y / 32,
target.pos.h / 32,
Color.White,
compass.Substring( offset - 12, 11 ),
Color.Red,
compass.Substring( offset - 1, 3 ),
compass.Substring( offset + 2, 11 ) ) );
}
示例11: BanInfo
// Shows ban information.
// When used without arguments, shows players's own ban stats.
// An optional argument allows to look at other people's ban stats.
internal static void BanInfo( Player player, Command cmd )
{
string name = cmd.Next();
IPAddress address;
if( name == null ) {
name = player.name;
} else if( !player.Can( Permissions.ViewOthersInfo ) ) {
player.NoAccessMessage( Permissions.ViewOthersInfo );
} else if( IPAddress.TryParse( name, out address ) ) {
IPBanInfo info = IPBanList.Get( address );
if( info != null ) {
player.Message( String.Format( "{0} was banned by {1} on {2:dd MMM yyyy}.",
info.address,
info.bannedBy,
info.banDate ) );
if( info.playerName != null ) {
player.Message( " IP ban was banned by association with " + info.playerName );
}
if( info.attempts > 0 ) {
player.Message( " There have been " + info.attempts + " attempts to log in, most recently" );
player.Message( String.Format( " on {0:dd MMM yyyy} by {1}.",
info.lastAttemptDate,
info.lastAttemptName ) );
}
if( info.banReason != "" ) {
player.Message( " Memo: " + info.banReason );
}
} else {
player.Message( address.ToString() + " is currently NOT banned." );
}
} else {
PlayerInfo info;
if( !PlayerDB.FindPlayerInfo( name, out info ) ) {
player.ManyPlayersMessage( name );
} else if( info != null ) {
if( info.banned ) {
player.Message( "Player " + info.name + " is currently " + Color.Red + "banned." );
} else {
player.Message( "Player " + info.name + " is currently NOT banned." );
}
if( info.bannedBy != "-" ) {
player.Message( String.Format( " Last banned by {0} on {1:dd MMM yyyy}.",
info.bannedBy,
info.banDate ) );
if( info.banReason != "" ) {
player.Message( " Ban memo: " + info.banReason );
}
}
if( info.unbannedBy != "-" ) {
player.Message( String.Format( " Unbanned by {0} on {1:dd MMM yyyy}.",
info.unbannedBy,
info.unbanDate ) );
if( info.unbanReason != "" ) {
player.Message( " Unban memo: " + info.unbanReason );
}
}
if( info.banDate != DateTime.MinValue ) {
TimeSpan banDuration;
if( info.banned ) {
banDuration = DateTime.Now.Subtract( info.banDate );
} else {
banDuration = info.unbanDate.Subtract( info.banDate );
}
player.Message( String.Format( " Last ban duration: {0} days and {1:F1} hours.",
(int)banDuration.TotalDays,
banDuration.TotalHours ) );
}
} else {
player.NoPlayerMessage( name );
}
}
}
示例12: FindPlayerOrPrintMatches
/// <summary>Find player by name using autocompletion (returns only whose whom player can see)
/// Returns null and prints message if none or multiple players matched.</summary>
/// <param name="player">Player who initiated the search. This is where messages are sent.</param>
/// <param name="name">Full or partial name of the search target.</param>
/// <param name="includeHidden">Whether to include hidden players in the search.</param>
/// <returns>Player object, or null if no player was found.</returns>
public static Player FindPlayerOrPrintMatches( Player player, string name, bool includeHidden ) {
if( player == null ) throw new ArgumentNullException( "player" );
if( name == null ) throw new ArgumentNullException( "name" );
Player[] matches;
if( includeHidden ) {
matches = FindPlayers( name );
} else {
matches = FindPlayers( player, name );
}
if( matches.Length == 0 ) {
player.NoPlayerMessage( name );
return null;
} else if( matches.Length > 1 ) {
player.ManyMatchesMessage( "player", matches );
return null;
} else {
return matches[0];
}
}
示例13: Info
internal static void Info( Player player, Command cmd ) {
string name = cmd.Next();
if( name == null ) {
name = player.Name;
} else if( !player.Can( Permission.ViewOthersInfo ) ) {
player.NoAccessMessage( Permission.ViewOthersInfo );
return;
}
IPAddress ip;
PlayerInfo[] infos;
if( Server.IsIP( name ) && IPAddress.TryParse( name, out ip ) ) {
// find players by IP
infos = PlayerDB.FindPlayers( ip, PlayerDB.NumberOfMatchesToPrint );
} else if( name.Contains( "*" ) || name.Contains( "." ) ) {
// find players by regex/wildcard
string regexString = "^" + RegexNonNameChars.Replace( name, "" ).Replace( "*", ".*" ) + "$";
Regex regex = new Regex( regexString, RegexOptions.IgnoreCase | RegexOptions.Compiled );
infos = PlayerDB.FindPlayers( regex, PlayerDB.NumberOfMatchesToPrint );
} else {
// find players by partial matching
PlayerInfo tempInfo;
if( !PlayerDB.FindPlayerInfo( name, out tempInfo ) ) {
infos = PlayerDB.FindPlayers( name, PlayerDB.NumberOfMatchesToPrint );
} else if( tempInfo == null ) {
player.NoPlayerMessage( name );
return;
} else {
infos = new[] { tempInfo };
}
}
if( infos.Length == 1 ) {
PrintPlayerInfo( player, infos[0] );
} else if( infos.Length > 1 ) {
player.ManyMatchesMessage( "player", infos );
if( infos.Length == PlayerDB.NumberOfMatchesToPrint ) {
player.Message( "NOTE: Only first {0} matches are shown.", PlayerDB.NumberOfMatchesToPrint );
}
} else {
player.NoPlayerMessage( name );
}
}
示例14: Kick
// Kick a player. One argument (mandatory) - player name (can be partial).
internal static void Kick( Player player, Command cmd )
{
if( !player.Can( Permissions.Kick ) ) {
player.NoAccessMessage( Permissions.Kick );
return;
}
string name = cmd.Next();
if( name != null ) {
string msg = cmd.NextAll();
Player offender = Server.FindPlayer( name );
if( offender != null ) {
if( !player.info.playerClass.CanKick( offender.info.playerClass ) ) {
player.Message( "You can only kick players ranked " + player.info.playerClass.maxKick.color + player.info.playerClass.maxKick.name + Color.Sys + " or lower." );
player.Message( offender.GetLogName() + " is ranked " + offender.info.playerClass.name + "." );
} else {
Server.SendToAll( Color.Red + offender.nick + " was kicked by " + player.nick );
if( msg != null && msg != "" ) {
Logger.Log( "{0} was kicked by {1}. Memo: {2}", LogType.UserActivity, offender.GetLogName(), player.GetLogName(), msg );
offender.session.Kick( "Kicked by " + player.GetLogName() + ": " + msg );
} else {
Logger.Log( "{0} was kicked by {1}", LogType.UserActivity, offender.GetLogName(), player.GetLogName() );
offender.session.Kick( "You have been kicked by " + player.GetLogName() );
}
}
} else {
player.NoPlayerMessage( name );
}
} else {
player.Message( "Usage: " + Color.Help + "/kick PlayerName [Message]" +
Color.Sys + " or " + Color.Help + "/k PlayerName [Message]" );
}
}
示例15: Unignore
internal static void Unignore( Player player, Command cmd ) {
string name = cmd.Next();
if( name != null ) {
PlayerInfo targetInfo;
if( !PlayerDB.FindPlayerInfo( name, out targetInfo ) ) {
PlayerInfo[] infos = PlayerDB.FindPlayers( name );
if( infos.Length == 1 ) {
targetInfo = infos[0];
} else if( infos.Length > 1 ) {
player.ManyMatchesMessage( "player", infos );
return;
} else {
player.NoPlayerMessage( name );
return;
}
} else if( targetInfo == null ) {
player.NoPlayerMessage( name );
return;
}
if( player.Unignore( targetInfo ) ) {
player.MessageNow( "You are no longer ignoring {0}", targetInfo.GetClassyName() );
} else {
player.MessageNow( "You are not currently ignoring {0}", targetInfo.GetClassyName() );
}
} else {
PlayerInfo[] ignoreList = player.GetIgnoreList();
if( ignoreList.Length > 0 ) {
player.MessageNow( "Ignored players: {0}", ignoreList.JoinToClassyString() );
} else {
player.MessageNow( "You are not currently ignoring anyone." );
}
return;
}
}