Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //------------------------ old GroupUp command ---------------------
- @AliasAnnotation(alias = {"GroupUp", "GU", "Waiting", "Group"})
- @CommandAnnotation(name = "GroupUp", channel = Globals.CHANNEL_SERVERS, description = "Adds you to a Waiting list for grouping up for a game")
- public String groupUp() {
- String response;
- String userID = author.getID();
- response = guildConfig.toggleWaiting(userID, guild);
- return response;
- }
- public String toggleWaiting(String userID, Guild guild){
- for (int i = 0; i < groupWaitingList.size();i++){
- if (userID.equals(groupWaitingList.get(i))){
- groupWaitingList.remove(i);
- return "> Toggled GroupUp. You will no longer be Mentioned when this command is run.";
- }
- }
- groupWaitingList.add(userID);
- StringBuilder builder = new StringBuilder();
- builder.append("**You have been added to the GroupUp Waiting list.**\n" +
- "Here are other people that are waiting for a partner:\n");
- for (String s: groupWaitingList){
- builder.append(" "+guild.getUserByID(s).mention() + ", Currently Playing: `"+ guild.getUserByID(s).getStatus().getStatusMessage() +"`\n");
- }
- builder.append("If you want to opt out of this list just run this command again.");
- return builder.toString();
- }
- //--------------- new GroupUp command ------------------
- public class GroupUp implements Command {
- @Override
- public String execute(String args, CommandObject command) {
- String presence = null;
- if (!args.isEmpty()) {
- presence = args;
- }
- ArrayList<GroupUpObject> list = command.channelData.getGroupUpObjects();
- for (GroupUpObject g : list) {
- if (command.authorID == g.getUserID()) {
- list.remove(g);
- return "> You have been removed from the list.";
- }
- }
- list.add(new GroupUpObject(presence, command.authorID));
- //person added to list :D
- ArrayList<String> completeList = new ArrayList<>();
- for (GroupUpObject g : list) {
- IUser user = command.client.getUserByID(g.getUserID());
- IPresence userPres = user.getPresence();
- if (!userPres.getStatus().equals(StatusType.DND) || !userPres.getStatus().equals(StatusType.OFFLINE) || !userPres.getStatus().equals(StatusType.UNKNOWN)) {
- if (g.getPresence() != null || userPres.getPlayingText().isPresent()) {
- if (g.getPresence() != null) {
- completeList.add(indent + user.mention() + " Playing: " + g.getPresence());
- } else {
- completeList.add(indent + user.mention() + " Playing: " + userPres.getPlayingText());
- }
- } else {
- completeList.add(indent + user.mention());
- }
- }
- }
- return "**> You have been added to the GroupUp list.**\n\n" + "Here are the others currently waiting:\n" +
- Utility.listFormatter(completeList, false) + "\n*To opt out simply run this command again*\n" +
- Utility.getCommandInfo(this, command);
- }
- @Override
- public String[] names() {
- return new String[]{"GroupUp", "GroupMe"};
- }
- @Override
- public String description() {
- return "Adds you to a list of people that will be mentioned when this command is run.\nRun this command again to leave the list.";
- }
- @Override
- public String usage() {
- return "(Game)";
- }
- @Override
- public String type() {
- return TYPE_GROUPS;
- }
- @Override
- public String channel() {
- return CHANNEL_GROUPS;
- }
- @Override
- public Permissions[] perms() {
- return new Permissions[0];
- }
- @Override
- public boolean requiresArgs() {
- return false;
- }
- @Override
- public boolean doAdminLogging() {
- return false;
- }
- @Override
- public String dualDescription() {
- return null;
- }
- @Override
- public String dualUsage() {
- return null;
- }
- @Override
- public String dualType() {
- return null;
- }
- @Override
- public Permissions[] dualPerms() {
- return new Permissions[0];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment