Пример #1
0
  public void registerChannel(Channel channel) {
    if (channel instanceof ChatChannel) {
      ChatChannel _channel = (ChatChannel) channel;
      channels.put(_channel, _channel.isEnabled());
    }

    if (channel instanceof DebugChannel) {
      debug = (DebugChannel) channel;
    }
  }
Пример #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);
  }
Пример #3
0
  // ChatChannel stuff
  public void removeChannel(ChatChannel channel) {
    unregisterChannel(channel);

    for (Map.Entry<String, Boolean> listener : channel.listeners.entrySet()) {
      if (listener.getValue()) {
        if (!def.hasListener(listener.getKey())) {
          def.addListener(listener.getKey(), true);
        } else {
          def.assignFocus(listener.getKey(), true);
        }
      }
    }

    List<String> l = new LinkedList<String>();

    for (Map.Entry<Channel, Boolean> entry : channels.entrySet()) {
      if (entry.getKey().getName().equals(channel.getName())) continue;

      l.add(entry.getKey().getName());
    }

    ISMain.getChannelConfig().set("channels", l);
    ISMain.getChannelConfig().set(channel.getName(), null);
  }
Пример #4
0
  private void writeDefaults() {
    channels.clear();

    ChatChannel pub = new ChatChannel("Public");
    pub.setDefault(true);
    pub.setGhostFormat("&8[&aPublic&8] $group&8: &7$message");
    registerChannel(pub);
    this.def = pub;

    ChatChannel _helpop = new ChatChannel("HelpOp");
    _helpop.setHelpOp(true);
    _helpop.setGhostFormat("&4[&cHELPOP&4] &7$name&f:&d $message");
    registerChannel(_helpop);
    this.helpop = _helpop;
  }
Пример #5
0
 private void disconnectFromAllChannels(ChatPlayer cp) {
   for (Map.Entry entry : getMap().entrySet()) {
     ChatChannel c = (ChatChannel) entry.getKey();
     c.silentDisconnect(cp.getPlayer().getName());
   }
 }