本文整理汇总了C#中fCraft.PlayerInfo类的典型用法代码示例。如果您正苦于以下问题:C# PlayerInfo类的具体用法?C# PlayerInfo怎么用?C# PlayerInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PlayerInfo类属于fCraft命名空间,在下文中一共展示了PlayerInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Player
// This constructor is used to create dummy players (such as Console and /dummy)
// It will soon be replaced by a generic Entity class
internal Player( World world, string name ) {
if( name == null ) throw new ArgumentNullException( "name" );
World = world;
Info = new PlayerInfo( name, RankManager.HighestRank, true, RankChangeType.AutoPromoted );
spamBlockLog = new Queue<DateTime>( Info.Rank.AntiGriefBlocks );
ResetAllBinds();
}
示例2: Create
public void Create( BoundingBox bounds, PlayerInfo createdBy ) {
if( bounds == null ) throw new ArgumentNullException( "bounds" );
if( createdBy == null ) throw new ArgumentNullException( "createdBy" );
CreatedDate = DateTime.UtcNow;
Bounds = bounds;
CreatedBy = createdBy;
}
示例3: Player
// This constructor is used to create dummy players (such as Console and /dummy)
// It will soon be replaced by a generic Entity class
internal Player( World _world, string _name )
{
world = _world;
name = _name;
nick = name;
info = new PlayerInfo( _name, ClassList.highestClass );
}
示例4: AddUnrecognizedPlayer
/// <summary> Adds a new PlayerInfo entry for a player who has never been online, by name. </summary>
/// <returns> A newly-created PlayerInfo entry. </returns>
public PlayerInfo AddUnrecognizedPlayer( string name, Rank startingRank, RankChangeType rankChangeType ) {
if( name == null ) throw new ArgumentNullException( "name" );
if( startingRank == null ) throw new ArgumentNullException( "startingRank" );
int id = GetNextID();
PlayerInfo info = new PlayerInfo( id, name, startingRank, rankChangeType, false );
trie.Add( name, info );
return info;
}
示例5: AddPlayer
/// <summary> Adds a new PlayerInfo entry for an actual, logged-in player. </summary>
/// <returns> A newly-created PlayerInfo entry. </returns>
public PlayerInfo AddPlayer( string name, Rank startingRank, RankChangeType rankChangeType, IPAddress address ) {
if( name == null ) throw new ArgumentNullException( "name" );
if( address == null ) throw new ArgumentNullException( "address" );
int id = GetNextID();
PlayerInfo info = new PlayerInfo( id, name, startingRank, rankChangeType, address );
trie.Add( name, info );
return info;
}
示例6: Player
// Normal constructor
internal Player( World _world, string _name, Session _session, Position _pos ) {
world = _world;
name = _name;
nick = name;
session = _session;
pos = _pos;
info = world.db.FindPlayerInfo( this );
}
示例7: CanRevoke
public bool CanRevoke( PlayerInfo player ) {
PermissionLimits limits = GetLimit( player );
if( limits == null ) {
return false;
} else {
return limits.CanRevoke;
}
}
示例8: AddSuperPlayer
internal static PlayerInfo AddSuperPlayer( ReservedPlayerID id, [NotNull] string name, [NotNull] Rank rank ) {
if( name == null ) throw new ArgumentNullException( "name" );
CheckIfLoaded();
PlayerInfo newInfo = new PlayerInfo( (int)id, name, rank, RankChangeType.AutoPromoted, true ) {
RaisePropertyChangedEvents = true
};
return newInfo;
}
示例9: CheckKickReason
// Throws a PlayerOpException if reason is required but missing.
internal static void CheckKickReason( [CanBeNull] string reason, [NotNull] Player player, PlayerInfo targetInfo ) {
if( player == null ) throw new ArgumentNullException( "player" );
if( ConfigKey.RequireKickReason.Enabled() && String.IsNullOrEmpty( reason ) ) {
const string msg = "Please specify a kick reason.";
const string colorMsg = "&S" + msg;
throw new PlayerOpException( player, targetInfo, PlayerOpExceptionCode.ReasonRequired, msg, colorMsg );
}
}
示例10: GetPlayerLimit
PermissionLimits GetPlayerLimit( PlayerInfo player ) {
PermissionLimits limiter;
if( playerInclusions.TryGetValue( player.Name, out limiter ) ) {
return limiter;
} else if( Parent != null ) {
return Parent.GetPlayerLimit( player );
} else {
return null;
}
}
示例11: Can
public bool Can( PlayerInfo player, int quantity ) {
if( ( Node.Flags & PermissionFlags.NeedsQuantity ) == 0 ) {
throw new PermissionCheckException( "Quantity limit is not applicable to " + Node.Name );
}
PermissionLimits limits = GetLimit( player );
if( limits == null ) {
return false;
} else {
return ( limits.MaxQuantity <= quantity );
}
}
示例12: GetPlayerScoreEntry
//Function to format and return a player's score entry. Returns null if no score found
public static String GetPlayerScoreEntry( PlayerInfo player )
{
string toReturn = null;
foreach ( String s in PlayerKillScores ) {
if ( s.Contains( '$' ) ) {
if ( s.Split( '$' )[0] == player.Name ) {
toReturn = s;
}
}
}
return toReturn;
}
示例13: PlayerOpException
public PlayerOpException( [NotNull] Player player, PlayerInfo target,
PlayerOpExceptionCode errorCode,
[NotNull] string message, [NotNull] string messageColored )
: base( message ) {
if( player == null ) throw new ArgumentNullException( "player" );
if( message == null ) throw new ArgumentNullException( "message" );
if( messageColored == null ) throw new ArgumentNullException( "messageColored" );
Player = player;
Target = target;
ErrorCode = errorCode;
MessageColored = messageColored;
}
示例14: CheckRankChangeReason
// Throws a PlayerOpException if reason is required but missing.
internal static void CheckRankChangeReason( [CanBeNull] string reason, [NotNull] Player player, PlayerInfo targetInfo, bool promoting ) {
if( player == null ) throw new ArgumentNullException( "player" );
if( ConfigKey.RequireRankChangeReason.Enabled() && String.IsNullOrEmpty( reason ) ) {
string msg;
if( promoting ) {
msg = "Please specify a promotion reason.";
} else {
msg = "Please specify a demotion reason.";
}
string colorMsg = "&S" + msg;
throw new PlayerOpException( player, targetInfo, PlayerOpExceptionCode.ReasonRequired, msg, colorMsg );
}
}
示例15: FindPlayerInfo
public PlayerInfo FindPlayerInfo( Player player ) {
if( player == null ) return null;
locker.EnterWriteLock();
PlayerInfo info = tree.Get( player.name );
if( info == null ) {
info = new PlayerInfo( world, player );
tree.Add( player.name, info );
list.Add( info );
}
locker.ExitWriteLock();
return info;
}