public bool NextBlockWithParam( [CanBeNull] Player player, bool allowNoneBlock, out Block block, out int param ) {
block = Block.None;
param = 1;
string jointString = Next();
if( jointString == null ) {
return false;
}
int slashIndex = jointString.IndexOf( '/' );
if( slashIndex != -1 ) {
string blockName = jointString.Substring( 0, slashIndex );
string paramString = jointString.Substring( slashIndex + 1 );
if( Map.GetBlockByName( blockName, true, out block ) ) {
if( block == Block.None && !allowNoneBlock ) {
if( player != null ) {
player.Message( "The \"none\" block is not allowed here" );
}
} else if( Int32.TryParse( paramString, out param ) ) {
return true;
} else if( player != null ) {
player.Message( "Could not parse \"{0}\" as an integer.", paramString );
}
} else if( player != null ) {
player.Message( "Unrecognized blocktype \"{0}\"", blockName );
}
} else {
if( Map.GetBlockByName( jointString, true, out block ) ) {
if( block != Block.None || allowNoneBlock ) {
return true;
} else if( player != null ) {
player.Message( "The \"none\" block is not allowed here" );
}
} else if( player != null ) {
player.Message( "Unrecognized blocktype \"{0}\"", jointString );
}
}
return false;
}