Пример #1
0
 /**
  * Unbans a name from the channel.
  *
  * @param name
  */
 public void unban(String name) {
   ChannelUnbanEvent event =
       plugin.getEngine().getEventManager().callEvent(new ChannelUnbanEvent(this, name));
   if (event.isCancelled()) {
     return;
   }
   banned.remove(event.getName());
   if (autoSave) {
     save();
   }
 }
Пример #2
0
 /**
  * Censors a word in the channel
  *
  * @param word
  * @param replacement
  */
 public void censor(String word, String replacement) {
   ChannelCensorEvent event =
       plugin
           .getEngine()
           .getEventManager()
           .callEvent(new ChannelCensorEvent(this, word, replacement));
   censoredWords.put(event.getWord().toLowerCase(), event.getReplacement());
   if (autoSave) {
     save();
   }
 }
Пример #3
0
 /**
  * Allows the chatter to chat in the channel.
  *
  * @param name
  */
 public void unmute(String name) {
   ChannelMuteChangeEvent event =
       plugin
           .getEngine()
           .getEventManager()
           .callEvent(new ChannelMuteChangeEvent(this, name, false));
   name = event.getName();
   if (event.isMuted()) {
     mute(name);
     return;
   }
   muted.remove(name);
   if (autoSave) {
     save();
   }
 }
Пример #4
0
 /**
  * Broadcasts a message to all listeners of the channel.
  *
  * @param message
  */
 public void broadcast(Chatter sender, ChatArguments message) {
   ChannelBroadcastEvent event =
       plugin
           .getEngine()
           .getEventManager()
           .callEvent(new ChannelBroadcastEvent(this, sender, message));
   sender = event.getSender();
   message = event.getMessage();
   Placeholders.format(Placeholders.MESSAGE, format, message);
   for (Chatter chatter : listeners) {
     if (sender != null && !chatter.canHear(sender, this)) {
       continue;
     }
     chatter.getParent().sendMessage(format);
   }
   if (bot != null && ircEnabled) {
     bot.sendMessage(message);
   }
   plugin.getChatLogger().log(message);
 }
Пример #5
0
 /**
  * Bans a name from the channel
  *
  * @param name of chatter
  * @param kick whether to kick if online
  * @param reason for kick
  */
 public void ban(String name, boolean kick, ChatArguments reason) {
   ChannelBanEvent event =
       plugin
           .getEngine()
           .getEventManager()
           .callEvent(new ChannelBanEvent(this, name, kick, reason));
   if (event.isCancelled()) {
     return;
   }
   name = event.getName();
   if (event.isKicked()) {
     Chatter chatter = plugin.getChatters().get(name);
     if (chatter == null) {
       return;
     }
     chatter.kick(this, event.getReason());
   }
   banned.add(name);
   if (autoSave) {
     save();
   }
 }