fCraft.LifeHandler.CheckWorldPermissions C# (CSharp) Method

CheckWorldPermissions() private method

private CheckWorldPermissions ( Player p ) : bool
p Player
return bool
        private bool CheckWorldPermissions( Player p )
        {
            if ( !p.Info.Rank.AllowSecurityCircumvention ) {
                SecurityCheckResult buildCheck = _world.BuildSecurity.CheckDetailed( p.Info );
                switch ( buildCheck ) {
                    case SecurityCheckResult.BlackListed:
                        p.Message( "Cannot add life to world {0}&S: You are barred from building here.",
                                        p.ClassyName );
                        return false;
                    case SecurityCheckResult.RankTooLow:
                        p.Message( "Cannot add life to world {0}&S: You are not allowed to build here.",
                                        p.ClassyName );
                        return false;
                }
            }
            return true;
        }

Usage Example

Example #1
0
        private static void OnCreate(Player p, Command cmd)
        {
            LifeHandler handler = new LifeHandler();

            if (!handler.CheckAndGetLifeZone(p, cmd))
            {
                return;
            }
            if (!handler.CheckWorldPermissions(p))
            {
                return;
            }
            if (null != handler._life)
            {
                p.Message("&WLife with such name exists already, choose another");
                return;
            }

            p.SelectionStart(2, handler.LifeCreateCallback, null, Permission.DrawAdvanced);
            p.MessageNow("Select life zone: place/remove a block or type /Mark to use your location.");
        }
All Usage Examples Of fCraft.LifeHandler::CheckWorldPermissions