fCraft.Command.NextBlock C# (CSharp) Method

NextBlock() private method

private NextBlock ( [ player ) : Block
player [
return Block
        public Block NextBlock( [NotNull] Player player )
        {
            if ( player == null )
                throw new ArgumentNullException( "player" );
            string blockName = Next();
            Block targetBlock = Block.Undefined;
            if ( blockName != null ) {
                targetBlock = Map.GetBlockByName( blockName );
                if ( targetBlock == Block.Undefined ) {
                    player.Message( "Unrecognized blocktype \"{0}\"", blockName );
                }
            }
            return targetBlock;
        }

Usage Example

        static void CutHandler( Player player, Command cmd )
        {
            Block fillBlock = Block.Air;
            if( cmd.HasNext ) {
                fillBlock = cmd.NextBlock( player );
                if( fillBlock == Block.Undefined ) return;
                if( cmd.HasNext ) {
                    CdCut.PrintUsage( player );
                    return;
                }
            }

            CutDrawOperation op = new CutDrawOperation( player ) {
                Brush = new NormalBrush( fillBlock )
            };

            player.SelectionStart( 2, DrawOperationCallback, op, Permission.Draw );
            if( fillBlock != Block.Air ) {
                player.Message( "Cut/{0}: Click 2 blocks or use &H/Mark&S to make a selection.",
                                fillBlock );
            } else {
                player.Message( "Cut: Click 2 blocks or use &H/Mark&S to make a selection." );
            }
        }
All Usage Examples Of fCraft.Command::NextBlock