예제 #1
0
        public static void Initialize()
        {
            ArrayList wordList = new ArrayList();

            try
            {
                using (StreamReader sr = new StreamReader(JailConfig.JailWordFile))
                {
                    String line;
                    while ((line = sr.ReadLine()) != null)
                    {
                        line = line.Trim();
                        if (line != "")
                        {
                            wordList.Add(line);
                        }
                    }
                }

                if (wordList.Count > 0)
                {
                    m_JailWords = new Hashtable(wordList.Count, StringComparer.OrdinalIgnoreCase);

                    for (int i = 0; i < wordList.Count; ++i)
                    {
                        m_JailWords[wordList[i]] = wordList[i];
                    }
                }
            }
            catch (Exception e)
            {
                World.Broadcast(0, true, "Jail: error reading jail words file {0}.", JailConfig.JailWordFile);
                World.Broadcast(0, true, e.Message);
            }

            CommandHandlers.Register("Jail", AccessLevel.GameMaster, new CommandEventHandler(Jail_OnCommand));
            CommandHandlers.Register("UnJail", AccessLevel.GameMaster, new CommandEventHandler(UnJail_OnCommand));
            CommandHandlers.Register("AddJailWord", AccessLevel.GameMaster, new CommandEventHandler(AddJailWord_OnCommand));
            CommandHandlers.Register("DeleteJailWord", AccessLevel.GameMaster, new CommandEventHandler(DeleteJailWord_OnCommand));
            CommandHandlers.Register("ListJailWords", AccessLevel.GameMaster, new CommandEventHandler(ListJailWords_OnCommand));
            EventSink.Speech += new SpeechEventHandler(EventSink_Speech);

            s_JailProcessingQueue = new JailQueue();
            s_KickProcessingQueue = new JailQueue();
        }
예제 #2
0
		public static void Initialize()
		{
			ArrayList wordList = new ArrayList();
			try
			{
				using ( StreamReader sr = new StreamReader( JailConfig.JailWordFile ) ) 
				{
					String line;
					while (( line = sr.ReadLine() ) != null ) 
					{
						line = line.Trim();
						if ( line != "" )
							wordList.Add( line );
					}
				}

				if ( wordList.Count > 0 )
				{
					m_JailWords = new Hashtable( wordList.Count, StringComparer.OrdinalIgnoreCase );

					for ( int i = 0; i < wordList.Count; ++i )
					{
						m_JailWords[ wordList[ i ] ] = wordList[ i ];
					}
				}
			}
			catch ( Exception e )
			{
				World.Broadcast( 0, true, "Jail: error reading jail words file {0}.", JailConfig.JailWordFile );
				World.Broadcast( 0, true, e.Message );
			}

			CommandHandlers.Register( "Jail", AccessLevel.GameMaster, new CommandEventHandler( Jail_OnCommand ) );
			CommandHandlers.Register( "UnJail", AccessLevel.GameMaster, new CommandEventHandler( UnJail_OnCommand ) );
			CommandHandlers.Register( "AddJailWord", AccessLevel.GameMaster, new CommandEventHandler( AddJailWord_OnCommand ) );
			CommandHandlers.Register( "DeleteJailWord", AccessLevel.GameMaster, new CommandEventHandler( DeleteJailWord_OnCommand ) );
			CommandHandlers.Register( "ListJailWords", AccessLevel.GameMaster, new CommandEventHandler( ListJailWords_OnCommand ) );
			EventSink.Speech += new SpeechEventHandler( EventSink_Speech );

			s_JailProcessingQueue = new JailQueue();
			s_KickProcessingQueue = new JailQueue();
		}