本文整理汇总了C#中fCraft.Player.CheckPaidStatus方法的典型用法代码示例。如果您正苦于以下问题:C# Player.CheckPaidStatus方法的具体用法?C# Player.CheckPaidStatus怎么用?C# Player.CheckPaidStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fCraft.Player
的用法示例。
在下文中一共展示了Player.CheckPaidStatus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoginSequence
//.........这里部分代码省略.........
Player.Info.ProcessFailedLogin( this );
ipBanInfo.ProcessAttempt( Player );
if( ConfigKey.ShowBannedConnectionMessages.GetBool() ) {
Server.SendToAll( "{0}&S tried to log in from a banned IP.", Player.GetClassyName() );
}
Logger.Log( "{0} tried to log in from a banned IP.", LogType.SuspiciousActivity,
Player.Name );
string bannedMessage = String.Format( "IP-banned {0} ago by {1}: {2}",
DateTime.UtcNow.Subtract( ipBanInfo.BanDate ).ToMiniString(),
ipBanInfo.BannedBy,
ipBanInfo.BanReason );
KickNow( bannedMessage, LeaveReason.LoginFailed );
return false;
}
// Check if max number of connections is reached for IP
if( !Server.RegisterSessionAndCheckConnectionCount( this ) ) {
Player.Info.ProcessFailedLogin( this );
Logger.Log( "Session.LoginSequence: Denied player {0}: maximum number of connections was reached for {1}", LogType.SuspiciousActivity,
playerName, IP );
KickNow( String.Format( "Max connection count reached for {0}", IP ), LeaveReason.LoginFailed );
return false;
}
// Check if player is paid (if required)
if( ConfigKey.PaidPlayersOnly.GetBool() ) {
SendNow( PacketWriter.MakeHandshake( Player,
ConfigKey.ServerName.GetString(),
"Please wait; Checking paid status..." ) );
writer.Flush();
if( !Player.CheckPaidStatus( Player.Name ) ) {
Logger.Log( "Player {0} was kicked because their account is not paid, and PaidOnly setting is enabled.", LogType.SystemActivity,
Player.Name );
KickNow( "Paid players allowed only.", LeaveReason.LoginFailed );
return false;
}
}
// Any additional security checks should be done right here
if( Server.RaisePlayerConnectingEvent( Player ) ) return false;
// ----==== beyond this point, player is considered connecting (allowed to join) ====----
// Register player for future block updates
if( !Server.RegisterPlayerAndCheckIfFull( this ) ) {
Logger.Log( "Player {0} was kicked because server is full.", LogType.SystemActivity,
Player.Name );
string kickMessage = String.Format( "Sorry, server is full ({0}/{1})",
Server.PlayerList.Length, ConfigKey.MaxPlayers.GetInt() );
KickNow( kickMessage, LeaveReason.ServerFull );
return false;
}
Player.Info.ProcessLogin( Player );
// ----==== Beyond this point, player is considered connected (authenticated and registered) ====----
World startingWorld = Server.RaisePlayerConnectedEvent( Player, WorldManager.MainWorld );
// Send server information