Exemple #1
0
  // multi-purpose function that reaches every member of guild (except the character with
  // exceptionId) in all channels with as little access to rmi as possible
  public final void broadcast(final MaplePacket packet, final int exceptionId, final BCOp bcop) {
    final WorldRegistryImpl wr = WorldRegistryImpl.getInstance();
    final Set<Integer> chs = wr.getChannelServer();

    lock.lock();
    try {
      buildNotifications();

      try { // now call the channelworldinterface
        for (final Integer ch : chs) {
          final ChannelWorldInterface cwi = wr.getChannel(ch);
          if (notifications.get(ch).size() > 0) {
            if (bcop == BCOp.DISBAND) {
              cwi.setGuildAndRank(notifications.get(ch), 0, 5, exceptionId);
            } else if (bcop == BCOp.EMBLEMCHANGE) {
              cwi.changeEmblem(id, notifications.get(ch), new MapleGuildSummary(this));
            } else {
              cwi.sendPacket(notifications.get(ch), packet, exceptionId);
            }
          }
        }
      } catch (RemoteException re) {
        System.err.println("Failed to contact channel(s) for broadcast." + re);
      }
    } finally {
      lock.unlock();
    }
  }