// Path: vilebot/src/main/java/com/oldterns/vilebot/util/BaseNick.java
// public class BaseNick
// {
//     // This would grab the leading x out of a nick that actually contains it
//     private static Pattern nickPattern = Pattern.compile( "(?:x|)([a-zA-Z0-9]+)(?:\\p{Punct}+[a-zA-Z0-9]*|)" );
// 
//     private static String primaryBotNick;
// 
//     private static Set<String> allBotNicks = new HashSet<>();
// 
//     public static String toBaseNick( String nick )
//     {
//         if ( allBotNicks.contains( nick ) )
//         {
//             nick = primaryBotNick;
//         }
//         else
//         {
//             Matcher nickMatcher = nickPattern.matcher( nick );
// 
//             if ( nickMatcher.find() )
//             {
//                 return nickMatcher.group( 1 );
//             }
//         }
//         return nick;
//     }
// 
//     public static String getPrimaryBotNick()
//     {
//         return primaryBotNick;
//     }
// 
//     public static void setPrimaryBotNick( String primaryNick )
//     {
//         primaryBotNick = primaryNick;
//     }
// 
//     public static Set<String> getBotNicks()
//     {
//         return allBotNicks;
//     }
// 
//     public static void addBotNick( String nick )
//     {
//         allBotNicks.add( nick );
//     }
// }


import com.oldterns.vilebot.Vilebot;
import com.oldterns.vilebot.util.BaseNick;
import org.pircbotx.hooks.ListenerAdapter;
import org.pircbotx.hooks.events.MessageEvent;
import org.pircbotx.hooks.events.PrivateMessageEvent;
import org.pircbotx.hooks.types.GenericMessageEvent;
import java.util.Random;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
        return event instanceof PrivateMessageEvent;
    }

    private boolean inGameChannel( GenericMessageEvent event )
    {
        return event instanceof MessageEvent && ( (MessageEvent) event ).getChannel().getName().equals( RPS_CHANNEL );
    }

    private boolean correctSolutionChannel( GenericMessageEvent event )
    {
        if ( ( isPrivate( event ) && inGameChannel( event ) ) )
        {
            return true;
        }
        else if ( ( (MessageEvent) event ).getChannel().getName().equals( RPS_CHANNEL ) )
        {
            event.respondWith( getSubmissionRuleString( event ) );
            return false;
        }
        else
        {
            event.respondWith( "To play Rock Paper Scissors join : " + RPS_CHANNEL );
            return false;
        }
    }

    private synchronized void cancelGame( GenericMessageEvent event )
    {
        if ( null != currGame )
        {
// Path: vilebot/src/main/java/com/oldterns/vilebot/util/BaseNick.java
// public class BaseNick
// {
//     // This would grab the leading x out of a nick that actually contains it
//     private static Pattern nickPattern = Pattern.compile( "(?:x|)([a-zA-Z0-9]+)(?:\\p{Punct}+[a-zA-Z0-9]*|)" );
// 
//     private static String primaryBotNick;
// 
//     private static Set<String> allBotNicks = new HashSet<>();
// 
//     public static String toBaseNick( String nick )
//     {
//         if ( allBotNicks.contains( nick ) )
//         {
//             nick = primaryBotNick;
//         }
//         else
//         {
//             Matcher nickMatcher = nickPattern.matcher( nick );
// 
//             if ( nickMatcher.find() )
//             {
//                 return nickMatcher.group( 1 );
//             }
//         }
//         return nick;
//     }
// 
//     public static String getPrimaryBotNick()
//     {
//         return primaryBotNick;
//     }
// 
//     public static void setPrimaryBotNick( String primaryNick )
//     {
//         primaryBotNick = primaryNick;
//     }
// 
//     public static Set<String> getBotNicks()
//     {
//         return allBotNicks;
//     }
// 
//     public static void addBotNick( String nick )
//     {
//         allBotNicks.add( nick );
//     }
// }


// Path: vilebot/src/main/java/com/oldterns/vilebot/handlers/user/RockPaperScissors.java
import com.oldterns.vilebot.Vilebot;
import com.oldterns.vilebot.util.BaseNick;
import org.pircbotx.hooks.ListenerAdapter;
import org.pircbotx.hooks.events.MessageEvent;
import org.pircbotx.hooks.events.PrivateMessageEvent;
import org.pircbotx.hooks.types.GenericMessageEvent;
import java.util.Random;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

        return event instanceof PrivateMessageEvent;
    }

    private boolean inGameChannel( GenericMessageEvent event )
    {
        return event instanceof MessageEvent && ( (MessageEvent) event ).getChannel().getName().equals( RPS_CHANNEL );
    }

    private boolean correctSolutionChannel( GenericMessageEvent event )
    {
        if ( ( isPrivate( event ) && inGameChannel( event ) ) )
        {
            return true;
        }
        else if ( ( (MessageEvent) event ).getChannel().getName().equals( RPS_CHANNEL ) )
        {
            event.respondWith( getSubmissionRuleString( event ) );
            return false;
        }
        else
        {
            event.respondWith( "To play Rock Paper Scissors join : " + RPS_CHANNEL );
            return false;
        }
    }

    private synchronized void cancelGame( GenericMessageEvent event )
    {
        if ( null != currGame )
        {
            String caller = BaseNick.toBaseNick( event.getUser().getNick() );