Package org.pircbotx

Examples of org.pircbotx.Channel


     *            the item
     * @param m
     *            the m
     */
    private void operatorItems(final TreeItem item, Menu m) {
      final Channel thisChan = cChannel.getChannel();
      final User tUser = (User) item.getData();
      if (bot.getUserBot().getChannelsOpIn().contains(thisChan)) {
        if (!tUser.getChannelsOpIn().contains(thisChan)) {
          MenuItem mitem = new MenuItem(m, SWT.PUSH);
          mitem.setText("Op");
View Full Code Here


      public void run() {
        updateUserCount();

        getWho().removeAll();

        Channel chan = c.getCChannel().getChannel();

        Comparator<User> nickOrder = new Comparator<User>() {
          @Override
          public int compare(User u1, User u2) {
            ;
            return u1.getNick().compareTo(u2.getNick());
          }
        };

        if (chan.getOwners().size() > 0) {
          TreeItem t = new TreeItem(c.getWho(), SWT.NONE);
          t.setText("Owners");
          List<User> users = new LinkedList<User>(chan.getOwners());
          Collections.sort(users, nickOrder);
          for (User u : users) {
            UserTreeItem i = new UserTreeItem(t, SWT.NONE, u, c
                .getCChannel());
            i.getTree().setText(u.getNick());
          }
          t.setExpanded(true);
        }
        if (chan.getSuperOps().size() > 0) {
          TreeItem t = new TreeItem(c.getWho(), SWT.NONE);
          t.setText("Super-Ops");
          List<User> users = new LinkedList<User>(chan.getSuperOps());
          Collections.sort(users, nickOrder);
          for (User u : users) {
            UserTreeItem i = new UserTreeItem(t, SWT.NONE, u, c
                .getCChannel());
            i.getTree().setText(u.getNick());
          }
          t.setExpanded(true);
        }
        if (chan.getOps().size() > 0) {
          TreeItem t = new TreeItem(c.getWho(), SWT.NONE);
          t.setText("Ops");
          List<User> users = new LinkedList<User>(chan.getOps());
          Collections.sort(users, nickOrder);
          for (User u : users) {
            UserTreeItem i = new UserTreeItem(t, SWT.NONE, u, c
                .getCChannel());
            i.getTree().setText(u.getNick());
          }
          t.setExpanded(true);
        }
        if (chan.getHalfOps().size() > 0) {
          TreeItem t = new TreeItem(c.getWho(), SWT.NONE);
          t.setText("Half-Ops");
          List<User> users = new LinkedList<User>(chan.getHalfOps());
          Collections.sort(users, nickOrder);
          for (User u : users) {
            UserTreeItem i = new UserTreeItem(t, SWT.NONE, u, c
                .getCChannel());
            i.getTree().setText(u.getNick());
          }
          t.setExpanded(true);
        }
        if (chan.getVoices().size() > 0) {
          TreeItem t = new TreeItem(c.getWho(), SWT.NONE);
          t.setText("Voices");
          List<User> users = new LinkedList<User>(chan.getVoices());
          Collections.sort(users, nickOrder);
          for (User u : users) {
            UserTreeItem i = new UserTreeItem(t, SWT.NONE, u, c
                .getCChannel());
            i.getTree().setText(u.getNick());
          }
          t.setExpanded(true);
        }

        if (chan.getNormalUsers().size() > 0) {
          TreeItem t = new TreeItem(c.getWho(), SWT.NONE);
          t.setText("Normal");
          List<User> users = new LinkedList<User>(chan
              .getNormalUsers());
          Collections.sort(users, nickOrder);
          for (User u : users) {
            UserTreeItem i = new UserTreeItem(t, SWT.NONE, u, c
                .getCChannel());
View Full Code Here

    @Override
    public boolean execute(MessageEvent event) {
        String[] args = event.getMessage().split(" ");
        User sender = event.getUser();
        if (args.length == 3) {
            Channel chan = event.getBot().getUserChannelDao().getChannel(args[1]);
            User target = event.getBot().getUserChannelDao().getUser(args[2]);
            chan.send().kick(target);
            return true;
        }
        if (args.length == 2) {
            Channel chan = event.getChannel();
            User target = event.getBot().getUserChannelDao().getUser(args[1]);
            chan.send().kick(target);
            return true;
        }
        if (args.length > 3) {
            if (args[1].startsWith("#")) {
                StringBuilder sb = new StringBuilder();
                for (int i = 3; i < args.length; i++) {
                    sb.append(args[i]).append(" ");
                }
                String reason = sb.toString().trim();
                Channel chan = event.getBot().getUserChannelDao().getChannel(args[1]);
                User target = event.getBot().getUserChannelDao().getUser(args[2]);
                chan.send().kick(target, reason);
                return true;
            } else {
                StringBuilder sb = new StringBuilder();
                for (int i = 2; i < args.length; i++) {
                    sb.append(args[i]).append(" ");
                }
                Channel chan = event.getChannel();
                User target = event.getBot().getUserChannelDao().getUser(args[1]);
                chan.send().kick(target, sb.toString().trim());
                return true;
            }
        }
        return false;
    }
View Full Code Here

    @Override
    public boolean execute(MessageEvent event) {
        String[] args = event.getMessage().split(" ");
        if (args.length == 2) {
            Channel target = event.getBot().getUserChannelDao().getChannel(args[1]);
            event.getBot().getUserChannelDao().getAllChannels();
            if (event.getBot().getUserChannelDao().getAllChannels().contains(target)) {
                target.send().part();
                return true;
            } else {
                event.getUser().send().notice("I'm not in the channel " + args[1] + "!");
                return true;
            }
View Full Code Here

            event.getChannel().send().part();
            event.getBot().sendIRC().joinChannel(name);
            return true;
        }
        if (args.length == 2) {
            Channel target = event.getBot().getUserChannelDao().getChannel(args[1]);
            String name = target.getName();
            target.send().part();
            event.getBot().sendIRC().joinChannel(name);
            return true;
        }
        return false;
    }
View Full Code Here

    @Override
    public boolean execute(MessageEvent event) {
        String[] args = event.getMessage().split(" ");
        User sender = event.getUser();
        if (args.length == 3) {
            Channel target = event.getBot().getUserChannelDao().getChannel(args[1]);
            //target.send().unBan();
            target.send().ban(args[2]);
            return true;
        }
        if (args.length == 2) {
            event.getChannel().send().ban(args[1]);
            return true;
View Full Code Here

    @Override
    public boolean execute(MessageEvent event) {
        String[] args = event.getMessage().split(" ");
        User sender = event.getUser();
        if (args.length == 3) {
            Channel chan = event.getBot().getUserChannelDao().getChannel(args[1]);
            User target = event.getBot().getUserChannelDao().getUser(args[2]);
            int senderrank = Utils.getRank(chan, sender);
            int targetrank = Utils.getRank(chan, target);
            if (senderrank > targetrank) {
                chan.send().ban("*!*@" + target.getHostmask());
                chan.send().kick(target);
                return true;
            } else {
                sender.send().message("You cant kick someone with a higher rank than you!");
                return false;
            }
        }
        if (args.length == 2) {
            Channel chan = event.getChannel();
            int senderrank = Utils.getRank(event.getChannel(), event.getUser());
            User target = event.getBot().getUserChannelDao().getUser(args[1]);
            int targetrank = Utils.getRank(event.getChannel(), target);
            if (senderrank > targetrank) {
                chan.send().ban("*!*@" + target.getHostmask());
                chan.send().kick(target, "Ban requested by " + sender.getNick());
                return true;
            } else {
                sender.send().message("You cant kick someone with a higher rank than you!");
                return false;
            }
        }
        if (args.length > 3) {
            if (args[1].startsWith("#")) {
                StringBuilder sb = new StringBuilder();
                for (int i = 3; i < args.length; i++) {
                    sb.append(args[i]).append(" ");
                }
                String reason = sb.toString().trim();
                Channel chan = event.getBot().getUserChannelDao().getChannel(args[1]);
                User target = event.getBot().getUserChannelDao().getUser(args[2]);
                chan.send().ban("*!*@" + target.getHostmask());
                chan.send().kick(target, reason);
                return true;
            } else {
                StringBuilder sb = new StringBuilder();
                for (int i = 2; i < args.length; i++) {
                    sb.append(args[i]).append(" ");
                }
                Channel chan = event.getChannel();
                User target = event.getBot().getUserChannelDao().getUser(args[1]);
                chan.send().ban("*!*@" + target.getHostmask());
                chan.send().kick(target, sb.toString().trim());
                return true;
            }
        }
        return false;
    }
View Full Code Here

    }

    @Override
    public boolean execute(MessageEvent event) {
        String[] args = event.getMessage().split(" ");
        Channel target = event.getBot().getUserChannelDao().getChannel(args[1]);
        if (target.isInviteOnly()) {
            event.getBot().sendRaw().rawLineNow("KNOCK " + target.getName() + " :Asked to join this channel by user " + event.getUser().getNick() + " in channel " + event.getChannel().getName());
        }
        event.getBot().sendIRC().joinChannel(target.getName());
        return true;
    }
View Full Code Here

    this.commandSender = new IRCCommandSender(plugin, this.bot);
  }
 
  @Override
  public void onMessage(MessageEvent<SimpleIRCBot> event){
    Channel channel = event.getChannel();
    User user = event.getUser();
    String sender = user.getNick();
   
    if (sender.equals(event.getBot().getNick())){
      return;
    }
   
    String message = event.getMessage();
    String senderLower = sender.toLowerCase();
    String playerName = (plugin.ircAliases.containsKey(senderLower)) ? plugin.ircAliases.get(senderLower) : sender;
   
    if (message.startsWith("!") && !plugin.gameAliases.containsKey(senderLower) && channel.getOps().contains(user)){
      String command = message.substring(1);
     
      this.commandSender.setMessageTarget(event.getChannel().getName());
      this.commandSender.setName(playerName);
     
View Full Code Here

    if (args.length < 2){
      sender.sendMessage(ChatColor.RED + "Usage: /" + label + " kick <channel> <nick> <reason>");
      return;
    }
   
    Channel channel = plugin.bot.getChannel(args[0]);
    User user = plugin.bot.getUser(args[1]);
   
    if (args.length > 2){
      String reason = args[2];
     
View Full Code Here

TOP

Related Classes of org.pircbotx.Channel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.