public static void updateSSOwnership(
      EntityPlayerMP player,
      String playerName,
      GCPlayerStats stats,
      int stationID,
      SpaceStationWorldData stationData) {
    if (stationData == null) {
      stationData = SpaceStationWorldData.getMPSpaceStationData(null, stationID, null);
    }

    if (stationData.owner.equals(playerName)) {
      // This player is the owner of the station - ensure stats data matches
      if (!(stats.spaceStationDimensionData.values().contains(stationID))) {
        GCLog.debug(
            "Player owns station: "
                + stationData.getSpaceStationName()
                + " with home planet "
                + stationData.getHomePlanet());
        stats.spaceStationDimensionData.put(stationData.getHomePlanet(), stationID);
      }
    } else {
      // This player is the owner of the station - remove from stats data
      Integer savedOwned = stats.spaceStationDimensionData.get(stationData.getHomePlanet());
      if (savedOwned != null && savedOwned == stationID) {
        GCLog.debug(
            "Player does not own station: "
                + stationData.getSpaceStationName()
                + " with home planet "
                + stationData.getHomePlanet());
        stats.spaceStationDimensionData.remove(savedOwned);
      }
    }
  }
  public boolean setFrequency() {
    if (!GalacticraftCore.isPlanetsLoaded) {
      return false;
    }

    for (int x = MathHelper.floor_double(this.posX) - 1;
        x <= MathHelper.floor_double(this.posX) + 1;
        x++) {
      for (int y = MathHelper.floor_double(this.posY) - 3;
          y <= MathHelper.floor_double(this.posY) + 1;
          y++) {
        for (int z = MathHelper.floor_double(this.posZ) - 1;
            z <= MathHelper.floor_double(this.posZ) + 1;
            z++) {
          BlockPos pos = new BlockPos(x, y, z);
          TileEntity tile = this.worldObj.getTileEntity(pos);

          if (tile instanceof IFuelDock) {
            IFuelDock dock = (IFuelDock) tile;

            try {
              TileEntity launchController = null;
              Class<?> controllerClass =
                  Class.forName(
                      "micdoodle8.mods.galacticraft.planets.mars.tile.TileEntityLaunchController");

              for (ILandingPadAttachable connectedTile : dock.getConnectedTiles()) {
                try {
                  controllerClass.cast(connectedTile);
                } catch (ClassCastException e) {
                  continue;
                }

                launchController = (TileEntity) connectedTile;
                if (launchController != null) {
                  TileEntity tile2 =
                      launchController.getWorld().getTileEntity(launchController.getPos());

                  try {
                    controllerClass.cast(tile2);
                  } catch (ClassCastException e) {
                    launchController = null;
                    continue;
                  }

                  launchController = tile2;
                }

                if (launchController != null) {
                  break;
                }
              }

              if (launchController != null) {
                Boolean b =
                    (Boolean) controllerClass.getMethod("validFrequency").invoke(launchController);

                if (b != null && b) {
                  int controllerFrequency =
                      controllerClass.getField("destFrequency").getInt(launchController);
                  boolean foundPad = this.setTarget(false, controllerFrequency);

                  if (foundPad) {
                    this.destinationFrequency = controllerFrequency;
                    GCLog.debug(
                        "Rocket under launch control: going to target frequency "
                            + controllerFrequency);
                    return true;
                  }
                }
              }
            } catch (ClassCastException e) {
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        }
      }
    }

    this.destinationFrequency = -1;
    return false;
  }