Example #1
0
  public void addZone(
      String planet, String zone, float x, float z, float radius, int weight, int type) {
    CurrentServerGCWZonePercent zoneObject;

    if (!zoneMap().containsKey(planet)) {
      zoneMap().put(planet, new TreeMap<String, CurrentServerGCWZonePercent>());
      object
          .getCurrentServerGCWTotalPercentMap()
          .put(planet, new CurrentServerGCWZonePercent(new Point2D(0, 0), 0, 0, 0));
      object
          .getCurrentServerGCWTotalHistoryMap()
          .put(
              planet,
              new CurrentServerGCWZoneHistory(
                  object.getCurrentServerGCWTotalPercentMap().get(planet).clone()));
      object.getOtherServerGCWTotalPercentMap().put("SWG", new OtherServerGCWZonePercent(planet));
    }

    if (zoneMap().get(planet).containsKey(zone)) {
      zoneObject = zoneMap().get(planet).get(zone);

      if (zoneObject.getPosition().x != x) {
        zoneObject.getPosition().x = x;
      }

      if (zoneObject.getPosition().z != z) {
        zoneObject.getPosition().z = z;
      }

      if (zoneObject.getRadius() != radius) {
        zoneObject.setRadius(radius);
      }

      if (zoneObject.getWeight().unscaledValue().intValue() != weight) {
        zoneObject.setWeight(weight);
      }

      if (zoneObject.getType() != type) {
        zoneObject.setType(type);
      }
    } else {
      zoneObject = new CurrentServerGCWZonePercent(new Point2D(x, z), radius, weight, type);

      zoneMap().get(planet).put(zone, zoneObject);

      if (!planet.equals("galaxy")) {
        object
            .getCurrentServerGCWZonePercentMap()
            .put(zone, zoneMap().get(planet).get(zone).clone());
        object
            .getCurrentServerGCWZoneHistoryMap()
            .put(zone, new CurrentServerGCWZoneHistory(zoneMap().get(planet).get(zone).clone()));
        object.getOtherServerGCWZonePercentMap().put("SWG", new OtherServerGCWZonePercent(zone));
      }
    }
  }
Example #2
0
 private Map<String, Map<String, CurrentServerGCWZonePercent>> zoneMap() {
   return object.getZoneMap();
 }