Пример #1
0
 public void addSign(StatSign sign) {
   switch (sign.getSignType()) {
     case TOP:
       topSigns.put(sign.getLocationString(), sign);
       break;
     case PERSONAL:
       personalSigns.put(sign.getLocationString(), sign);
   }
 }
Пример #2
0
 public void clickedSign(Player player, Sign s, StatSign ss) {
   switch (ss.getSignType()) {
     case TOP:
       updateTopSign(player, s, ss);
       break;
     case PERSONAL:
       updatePersonalSign(player, s, ss);
       break;
   }
 }
Пример #3
0
  public synchronized void updateSigns() {
    if (updating || topSigns.isEmpty()) return;
    updating = true;
    final Map<String, StatSign> map;
    synchronized (topSigns) {
      map = new HashMap<String, StatSign>(topSigns);
    }
    Collection<String> badSigns = new HashSet<String>();
    Collection<TrackerInterface> interfaces = Tracker.getAllInterfaces();
    List<StatSign> tops = new ArrayList<StatSign>();

    for (TrackerInterface ti : interfaces) {
      final String tiName = ti.getInterfaceName().toUpperCase();
      for (String loc : map.keySet()) {
        StatSign ss = map.get(loc);
        if (!ss.getDBName().toUpperCase().equals(tiName)) {
          continue;
        }
        Sign s = getSign(loc);
        if (s == null) {
          badSigns.add(loc);
          continue;
        }

        switch (ss.getSignType()) {
          case TOP:
            tops.add(ss);
            break;
          default:
            break;
        }
      }
      doTopSigns(ti, tops);
      tops = new ArrayList<StatSign>();
    }
    synchronized (topSigns) {
      for (String s : badSigns) {
        topSigns.remove(s);
      }
    }
    updating = false;
  }