<commit_before>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.techcavern.wavetact.commands;

import com.techcavern.wavetact.utils.Command;
import com.techcavern.wavetact.utils.IRCUtils;
import org.pircbotx.UserLevel;
import org.pircbotx.hooks.events.MessageEvent;

public class BasicChanOp {
                
           public class kick extends Command {
            public kick(){
                        super("kick", 10);
              }
                
                @Override
		public void onCommand(MessageEvent<?> event) throws Exception{
                    String[] messageParts = event.getMessage().split(" ");
                    if(event.getChannel().getUserLevels(event.getBot().getUserBot()).contains(UserLevel.OP) && event.getChannel().isOwner(IRCUtils.getUserByNick(event.getChannel(), messageParts[1])) == false && event.getChannel().isSuperOp(IRCUtils.getUserByNick(event.getChannel(), messageParts[1])) == false){
                             event.getChannel().send().kick(IRCUtils.getUserByNick(event.getChannel(), messageParts[1]));
                            } else if(event.getChannel().getUserLevels(event.getBot().getUserBot()).contains(UserLevel.OWNER)){
                             event.getChannel().send().kick(IRCUtils.getUserByNick(event.getChannel(), messageParts[1]));
                            } else {
                                event.getChannel().send().message("Error: I must be ownered in the channel to kick someone that is protected or ownered");
                            }
                        }         
                    
                }                 
                   public class mode extends Command{

                    public mode(){
                        super("mode", 10);
                   }
                       @Override
                       public void onCommand(MessageEvent<?> event) throws Exception{
                    String[] messageParts = event.getMessage().split(" ");
                           	            	event.getChannel().send().setMode(messageParts[1]);
                       }
                   }
                        
                   public class part extends Command{

                    public part(){
                        super("part", 5);
                   }
                       @Override
                       public void onCommand(MessageEvent<?> event) throws Exception{
                           	            	event.getChannel().send().part();
                       }
                   }
                    public class voice extends Command{

                    public voice(){
                        super("voice", 10);
                   }
                       @Override
                       public void onCommand(MessageEvent<?> event) throws Exception{
                    String[] messageParts = event.getMessage().split(" ");
 if(messageParts[1].startsWith("-"))
	            	event.getChannel().send().deVoice(IRCUtils.getUserByNick(event.getChannel(), messageParts[1].replace("-", "")));
                             else{
                               event.getChannel().send().voice(IRCUtils.getUserByNick(event.getChannel(), messageParts[1]));

                             }                       }
                   }
            public class op extends Command{

                    public op(){
                        super("op", 10);
                   }
                       @Override
                       public void onCommand(MessageEvent<?> event) throws Exception{
                       String[] messageParts = event.getMessage().split(" ");
                           if(messageParts[1].startsWith("-"))
	            	event.getChannel().send().deOp(IRCUtils.getUserByNick(event.getChannel(), messageParts[1].replace("-", "")));
                             else{
                               event.getChannel().send().op(IRCUtils.getUserByNick(event.getChannel(), messageParts[1]));

                             }	
                       }
                   }
            public class owner extends Command{

                    public owner(){
                        super("owner", 15);
                   }
                       @Override
                       public void onCommand(MessageEvent<?> event) throws Exception{
                    String[] messageParts = event.getMessage().split(" ");
                    
                if(messageParts[1].startsWith("-"))
	            	event.getChannel().send().deOwner(IRCUtils.getUserByNick(event.getChannel(), messageParts[1].replace("-", "")));
                             else{
                               event.getChannel().send().owner(IRCUtils.getUserByNick(event.getChannel(), messageParts[1]));

                             }                       }
                   }
                 public class protect extends Command{

                    public protect(){
                        super("protect", 15);
                   }
                       @Override
                       public void onCommand(MessageEvent<?> event) throws Exception{
                    String[] messageParts = event.getMessage().split(" ");
                if(messageParts[1].startsWith("-"))
	            	event.getChannel().send().deSuperOp(IRCUtils.getUserByNick(event.getChannel(), messageParts[1].replace("-", "")));
                             else{
                               event.getChannel().send().superOp(IRCUtils.getUserByNick(event.getChannel(), messageParts[1]));

                             }                       }
                   }
                
                  
                       <commit_msg>Fixed Removal of User Modes whose nicks contain "-"<commit_after>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.techcavern.wavetact.commands;

import com.techcavern.wavetact.utils.Command;
import com.techcavern.wavetact.utils.IRCUtils;
import org.pircbotx.UserLevel;
import org.pircbotx.hooks.events.MessageEvent;

public class BasicChanOp {
                
           public class kick extends Command {
            public kick(){
                        super("kick", 10);
              }
                
                @Override
		public void onCommand(MessageEvent<?> event) throws Exception{
                    String[] messageParts = event.getMessage().split(" ");
                    if(event.getChannel().getUserLevels(event.getBot().getUserBot()).contains(UserLevel.OP) && event.getChannel().isOwner(IRCUtils.getUserByNick(event.getChannel(), messageParts[1])) == false && event.getChannel().isSuperOp(IRCUtils.getUserByNick(event.getChannel(), messageParts[1])) == false){
                             event.getChannel().send().kick(IRCUtils.getUserByNick(event.getChannel(), messageParts[1]));
                            } else if(event.getChannel().getUserLevels(event.getBot().getUserBot()).contains(UserLevel.OWNER)){
                             event.getChannel().send().kick(IRCUtils.getUserByNick(event.getChannel(), messageParts[1]));
                            } else {
                                event.getChannel().send().message("Error: I must be ownered in the channel to kick someone that is protected or ownered");
                            }
                        }         
                    
                }                 
                   public class mode extends Command{

                    public mode(){
                        super("mode", 10);
                   }
                       @Override
                       public void onCommand(MessageEvent<?> event) throws Exception{
                    String[] messageParts = event.getMessage().split(" ");
                           	            	event.getChannel().send().setMode(messageParts[1]);
                       }
                   }
                        
                   public class part extends Command{

                    public part(){
                        super("part", 5);
                   }
                       @Override
                       public void onCommand(MessageEvent<?> event) throws Exception{
                           	            	event.getChannel().send().part();
                       }
                   }
                    public class voice extends Command{

                    public voice(){
                        super("voice", 10);
                   }
                       @Override
                       public void onCommand(MessageEvent<?> event) throws Exception{
                    String[] messageParts = event.getMessage().split(" ");
 if(messageParts[1].startsWith("-"))
	            	event.getChannel().send().deVoice(IRCUtils.getUserByNick(event.getChannel(), messageParts[1].replaceFirst("-","")));
                             else{
                               event.getChannel().send().voice(IRCUtils.getUserByNick(event.getChannel(), messageParts[1]));

                             }                       }
                   }
            public class op extends Command{

                    public op(){
                        super("op", 10);
                   }
                       @Override
                       public void onCommand(MessageEvent<?> event) throws Exception{
                       String[] messageParts = event.getMessage().split(" ");
                           if(messageParts[1].startsWith("-")){
	            	event.getChannel().send().deOp(IRCUtils.getUserByNick(event.getChannel(), messageParts[1].replaceFirst("-","")));
                           }else{
                               event.getChannel().send().op(IRCUtils.getUserByNick(event.getChannel(), messageParts[1]));

                             }	
                       }
                   }
            public class owner extends Command{

                    public owner(){
                        super("owner", 15);
                   }
                       @Override
                       public void onCommand(MessageEvent<?> event) throws Exception{
                    String[] messageParts = event.getMessage().split(" ");
                    
                if(messageParts[1].startsWith("-"))
	            	event.getChannel().send().deOwner(IRCUtils.getUserByNick(event.getChannel(), messageParts[1].replaceFirst("-","")));
                             else{
                               event.getChannel().send().owner(IRCUtils.getUserByNick(event.getChannel(), messageParts[1]));

                             }                       }
                   }
                 public class protect extends Command{

                    public protect(){
                        super("protect", 15);
                   }
                       @Override
                       public void onCommand(MessageEvent<?> event) throws Exception{
                    String[] messageParts = event.getMessage().split(" ");
                if(messageParts[1].startsWith("-"))
	            	event.getChannel().send().deSuperOp(IRCUtils.getUserByNick(event.getChannel(), messageParts[1].replaceFirst("-","")));
                             else{
                               event.getChannel().send().superOp(IRCUtils.getUserByNick(event.getChannel(), messageParts[1]));

                             }                       }
                   }
                
                  
                       
{'fraction_non_alphanumeric': 0.1097519247219846, 'fraction_numerical': 0.0051325919589392645, 'mean_word_length': 1.2422324510932106, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3745184', 'n_tokens_mistral': 2669, 'n_tokens_neox': 2488, 'n_words': 460}