fCraft.MessageBlockHandler.IsInRangeOfSpawnpoint C# (CSharp) Method

IsInRangeOfSpawnpoint() public static method

public static IsInRangeOfSpawnpoint ( World world, Vector3I block ) : bool
world World
block Vector3I
return bool
        public static bool IsInRangeOfSpawnpoint( World world, Vector3I block )
        {
            try {
                int Xdistance = ( world.Map.Spawn.X / 32 ) - block.X;
                int Ydistance = ( world.Map.Spawn.Y / 32 ) - block.Y;
                int Zdistance = ( world.Map.Spawn.Z / 32 ) - block.Z;

                if ( Xdistance <= 10 && Xdistance >= -10 ) {
                    if ( Ydistance <= 10 && Ydistance >= -10 ) {
                        if ( Zdistance <= 10 && Zdistance >= -10 ) {
                            return true;
                        }
                    }
                }
            } catch ( Exception ex ) {
                Logger.Log( LogType.Error, "MessageBlockHandler.IsInRangeOfSpawnpoint: " + ex );
            }

            return false;
        }