Package org.pircbotx

Examples of org.pircbotx.User


     *            the item
     * @param m
     *            the m
     */
    private void ctcpItems(TreeItem item, Menu m) {
      final User tUser = (User) item.getData();

      Menu parent = new Menu(m);
      MenuItem mitem = new MenuItem(m, SWT.CASCADE);
      mitem.setText("CTCP");
      mitem.setMenu(parent);
View Full Code Here


     * @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");
          mitem.addSelectionListener(new SelectionListener() {

            @Override
            public void widgetDefaultSelected(SelectionEvent arg0) {
            }

            @Override
            public void widgetSelected(SelectionEvent arg0) {
              bot.op(thisChan, tUser);

            }
          });
        }
        if (!tUser.getChannelsVoiceIn().contains(thisChan)) {
          MenuItem mitem = new MenuItem(m, SWT.PUSH);
          mitem.setText("Voice");
          mitem.addSelectionListener(new SelectionListener() {

            @Override
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

    public boolean execute(MessageEvent event) {
        String[] args = event.getMessage().split(" ");
        if (args.length >= 1) {
            if (args[1].toLowerCase().equals("addu")) {
                if (args.length == 4) {
                    User u = event.getBot().getUserChannelDao().getUser(args[2]);
                    Group g = manager.getGroupByName(args[3]);
                    if (manager.getUserGroup(event.getUser()).getInheritance().contains(g.getName())) {
                        if (u != null) {
                            g.addUser(u, "*@" + u.getHostmask());
                            event.getUser().send().notice("Granted access to group  " + g.getName() + " to user " + u.getNick());
                        } else {
                            event.getUser().send().notice("Couldn't find the user " + args[2]);
                            return true;
                        }
                    } else {
                        event.getUser().send().notice(Colors.RED + "You can't give someone a group higher than you!");
                    }
                } else {
                    event.getUser().send().notice("Syntax: manager addu <user> <group>");
                }
            }

            if (args[1].toLowerCase().equals("addp")) {
                if (args.length == 4) {
                    Permission permission = new Permission(args[2], false);
                    Group group = manager.getGroupByName(args[3]);
                    if (group != null) {
                        if (manager.getUserGroup(event.getUser()).hasPermission(permission)) {
                            group.addPermission(permission);
                            event.getUser().send().notice("Added permission " + permission.getPermission() + " to group  " + group.getName());
                        } else {
                            event.getUser().send().notice(Colors.RED + "You can't give someone a permission you don't have!");
                        }
                    } else {
                        event.getUser().send().notice("Couldn't find the group " + args[3]);
                        return true;
                    }
                } else {
                    event.getUser().send().notice("Syntax: manager addp <permission> <group> ");
                }
            }

            if (args[1].toLowerCase().contains("delp")) {
                if (args.length == 4) {
                    Permission permission = new Permission(args[2], false);
                    Group group = manager.getGroupByName(args[3]);
                    Group usergroup = manager.getUserGroup(event.getUser());
                    if (group != null) {
                        if (usergroup.hasPermission(permission) && usergroup.getInheritance().contains(group.getName()) || usergroup == group) {
                            group.removePermission(permission.getPermission());
                        } else {
                            event.getUser().send().notice(Colors.RED + "You can't remove permissions from a group higher than you!");
                        }
                    } else {
                        event.getUser().send().notice("Couldn't find the group " + args[3]);
                        return true;
                    }
                } else {
                    event.getUser().send().notice("Syntax: manager delp <permission> <group> ");
                }
            }

            if (args[1].toLowerCase().contains("delu")) {

                //delete user args[3] from group args[2]
                if (args.length == 4) {
                    User u = event.getBot().getUserChannelDao().getUser(args[2]);
                    Group g = manager.getGroupByName(args[3]);
                    if (manager.getUserGroup(event.getUser()).getInheritance().contains(g.getName())) {
                        if (u != null) {
                            g.getUsers().remove(u);
                            event.getUser().send().notice("Removed access to group " + g.getName() + " from " + u.getNick());
                        } else {
                            event.getUser().send().notice("Couldn't find the user " + args[2] + " are they online?");
                            return true;
                        }
                    } else {
View Full Code Here

    //huehuehue le copypasta faec
    @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;
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 void onMessage(MessageEvent<SimpleIRCBot> event){
    Channel channel = event.getChannel();
    User user = event.getUser();
    String sender = user.getNick();
   
    if (sender.equals(event.getBot().getNick())){
      return;
    }
   
View Full Code Here

    }
  }
 
  @Override
  public void onPrivateMessage(PrivateMessageEvent<SimpleIRCBot> event){
    User user = event.getUser();
    String sender = user.getNick();
    String message = event.getMessage();
    String senderLower = sender.toLowerCase();
    String playerName = (plugin.ircAliases.containsKey(senderLower)) ? plugin.ircAliases.get(senderLower) : sender;
   
    if (!plugin.gameAliases.containsKey(senderLower)){
View Full Code Here

    }
  }
 
  @Override
  public void onAction(ActionEvent<SimpleIRCBot> event){
    User user = event.getUser();
    String sender = user.getNick();
   
    if (sender.equals(event.getBot().getNick())){
      return;
    }
   
View Full Code Here

    plugin.server.broadcastMessage("* " + playerName + " " + event.getAction());
  }
 
  @Override
  public void onNickChange(NickChangeEvent<SimpleIRCBot> event){
    User user = event.getUser();
    String nick = event.getNewNick();
   
    if (plugin.gameAliases.containsKey(nick.toLowerCase())){
      for (Channel channel : user.getChannels()){
        this.bot.kick(channel, user, "Attempting to impersonate another player");
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.pircbotx.User

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.