本文整理汇总了C#中fCraft.Player.ManyPlayersMessage方法的典型用法代码示例。如果您正苦于以下问题:C# Player.ManyPlayersMessage方法的具体用法?C# Player.ManyPlayersMessage怎么用?C# Player.ManyPlayersMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fCraft.Player
的用法示例。
在下文中一共展示了Player.ManyPlayersMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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 );
}
}
示例2: 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 );
}
}
}