Ejemplo n.º 1
0
  // Events
  public void onPlayerLogin(ChatPlayer cp) {
    ((ChatChannel) getDefaultChannel()).connectWithoutBroadcast(cp.getPlayer().getName());

    if (cp.hasAutoJoin()) {
      if (cp.isJoinAllAvailableEnabled()) {
        ISMain.getChannelManager().joinAllAvailableChannels(cp);
      } else {
        List<String> channelNames = cp.getAutoJoinList();

        for (String channelName : channelNames) {
          List<Channel> l = matchChannel(channelName);

          if ((l.size() == 1) && (cp.canConnect((Channel) l.get(0), ""))) {
            ((ChatChannel) l.get(0)).connectWithoutBroadcast(cp.getPlayer().getName());
          }
        }
      }
    }

    getDefaultChannel().assignFocus(cp.getPlayer().getName(), true);

    if ((cp.getPlayer().isOp())
        && (cp.canConnect(ISMain.getChannelManager().getHelpOpChannel(), ""))) {
      getHelpOpChannel().addListener(cp.getPlayer().getName(), false);
    }
  }
Ejemplo n.º 2
0
  private void joinAllAvailableChannels(ChatPlayer cp) {
    for (Map.Entry channel : getMap().entrySet()) {
      if (cp.canConnect((Channel) channel.getKey(), "")) {
        ChatChannel c = (ChatChannel) channel.getKey();
        c.connectWithoutBroadcast(cp.getPlayer().getName());
      }
    }

    getDefaultChannel().assignFocus(cp.getPlayer().getName(), true);
  }