All pastes #195420 Raw Edit

Something

public java v1 · immutable
·published 2006-10-09 14:37 UTC
rendered paste body
package bububot;import java.io.IOException;import org.jibble.pircbot.IrcException;import org.jibble.pircbot.NickAlreadyInUseException;import org.jibble.pircbot.PircBot;/* $Id: BuBuBot.java,v 1.1 2006/02/19 15:56:52 shampoo Exp $                      * Created on 03.10.2005 */public class BuBuBot extends PircBot{	private Thread Flood;	private Thread joinpart;	private volatile String channel;	private volatile String mainchannel;	private volatile int counter = 0;	private volatile String who = null;	private volatile boolean chatflood = true;	private volatile String name;	private volatile String message;	private boolean first = true;	/**	 * Constructor.	 * 	 * @param name	 * @param message	 * @param i	 * @throws IrcException	 * @throws IOException	 * @throws NickAlreadyInUseException	 */	public BuBuBot(String channel, String name, String message, int i)		throws NickAlreadyInUseException, IOException, IrcException	{		super();		if (i > 0)		{			i--;			new BuBuBot(channel, name + i, message, i);		}		this.channel = channel;		this.mainchannel=channel;		this.name = name;		this.message = message;		this.setName(this.name + Math.round(Math.random() * 1000));		this.setVersion("0.4");		Flood = new Thread(new Runnable()			{				int counter2 = 0;				public void run()				{					while (true)				%0ot.this.message + bla);						}					}				}			});		joinpart = new Thread(new Runnable()			{				public void run()				{					while (true)					{						try						{							Thread.sleep(15000);							partChannel(BuBuBot.this.channel);							Thread.sleep(2000);							joinChannel(BuBuBot.this.channel);						}						catch (InterruptedException e)						{							// TODO Auto-generated catch block							e.printStackTrace();						}					}				}			});		this.setVerbose(true);		// Connect to the IRC server.		this.connect("irc.euirc.net");		// Join the #pircbot channel.		this.joinChannel(channel);	}	/**	 * {@inheritDoc}	 */	protected void onJoin(String arg0, String arg1, String arg2, String arg3)	{		// sendMessage("#singles", "This is BuBuBot "+getVersion()+" welcome " + arg1);	}	/**	 * {@inheritDoc}	 */	protected void onMessage(String channel, String sender, String login, String hostname,		String message)	{		BuBuBot.this.counter = 0;		int index = message.indexOf(' ');		if (index <= -1)			return;		String order = message.substring(0, index);29;				joinpart.start();			}			else			{				Flood.resume();				joinpart.resume();			}		}		else		{			this.channel = this.who;							if (first)				{					Flood.start();					if (this.channel.contains("#"))joinpart.start();				}				else				{					Flood.resume();					if (this.channel.contains("#"))joinpart.resume();				}		}		if (first == true)			first = false;	}}