fCraft.LifeHandler.LifeCreateCallback C# (CSharp) Method

LifeCreateCallback() private method

private LifeCreateCallback ( Player player, Vector3I marks, object state ) : void
player Player
marks Vector3I
state object
return void
        private void LifeCreateCallback( Player player, Vector3I[] marks, object state )
        {
            try {
                lock ( _world.SyncRoot ) {
                    if ( !CheckWorldPermissions( player ) )
                        return;
                    if ( null == _world.Map )
                        return;
                    if ( null != _world.GetLife( _name ) ) //check it again, since smone could create it in between
                    {
                        player.Message( "&WLife with such name exists already, choose another" );
                        return;
                    }
                    Life2DZone life = new Life2DZone( _name, _world.Map, marks, player, ( player.Info.Rank.NextRankUp ?? player.Info.Rank ).Name );
                    if ( _world.TryAddLife( life ) )
                        player.Message( "&yLife was created. Named " + _name );
                    else
                        player.Message( "&WCoulnd't create life for some reason unknown." ); //really unknown: we are under a lock so nobody could create a life with the same name in between
                }
            } catch ( Exception e ) {
                player.Message( "&WCreate life error: " + e.Message );
            }
        }