All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.pircbotx.hooks.events.JoinEvent Maven / Gradle / Ivy

Go to download

PircBotX is a simple, easy to use, Java IRC Bot Framework based off of a fork of the popular PircBot? framework, bringing many new up-to-date features and bug fixes in an official alternative distribution.

The newest version!
// Generated by delombok at Sun Jan 24 05:06:42 EST 2016
/**
 * Copyright (C) 2010-2014 Leon Blakey 
 *
 * This file is part of PircBotX.
 *
 * PircBotX is free software: you can redistribute it and/or modify it under the
 * terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 *
 * PircBotX is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * PircBotX. If not, see .
 */
package org.pircbotx.hooks.events;

import javax.annotation.Nullable;
import org.pircbotx.Channel;
import org.pircbotx.User;
import lombok.NonNull;
import org.pircbotx.hooks.Event;
import org.pircbotx.PircBotX;
import org.pircbotx.UserHostmask;
import org.pircbotx.hooks.types.GenericChannelUserEvent;

/**
 * This event is dispatched whenever someone (possibly us) joins a channel which
 * we are on.
 *
 * @author Leon Blakey
 */
public class JoinEvent extends Event implements GenericChannelUserEvent {
	
	/**
	 * The channel which somebody joined.
	 */
	protected final Channel channel;
	
	/**
	 * The user who joined the channel.
	 */
	protected final User user;
	
	/**
	 * The user hostmask who joined the channel.
	 */
	protected final UserHostmask userHostmask;

	public JoinEvent(PircBotX bot, @NonNull Channel channel, @NonNull UserHostmask userHostmask, User user) {
		super(bot);
		if (channel == null) {
			throw new java.lang.NullPointerException("channel");
		}
		if (userHostmask == null) {
			throw new java.lang.NullPointerException("userHostmask");
		}
		this.channel = channel;
		this.user = user;
		this.userHostmask = userHostmask;
	}

	/**
	 * Respond with a channel message in user: message format to
	 * the user that joined
	 *
	 * @param response The response to send
	 */
	@Override
	public void respond(String response) {
		getChannel().send().message(getUser(), response);
	}

	@java.lang.Override
	@java.lang.SuppressWarnings("all")
	@javax.annotation.Generated("lombok")
	public java.lang.String toString() {
		return "JoinEvent(channel=" + this.getChannel() + ", user=" + this.getUser() + ", userHostmask=" + this.getUserHostmask() + ")";
	}

	@java.lang.Override
	@java.lang.SuppressWarnings("all")
	@javax.annotation.Generated("lombok")
	public boolean equals(final java.lang.Object o) {
		if (o == this) return true;
		if (!(o instanceof JoinEvent)) return false;
		final JoinEvent other = (JoinEvent)o;
		if (!other.canEqual((java.lang.Object)this)) return false;
		if (!super.equals(o)) return false;
		final java.lang.Object this$channel = this.getChannel();
		final java.lang.Object other$channel = other.getChannel();
		if (this$channel == null ? other$channel != null : !this$channel.equals(other$channel)) return false;
		final java.lang.Object this$user = this.getUser();
		final java.lang.Object other$user = other.getUser();
		if (this$user == null ? other$user != null : !this$user.equals(other$user)) return false;
		final java.lang.Object this$userHostmask = this.getUserHostmask();
		final java.lang.Object other$userHostmask = other.getUserHostmask();
		if (this$userHostmask == null ? other$userHostmask != null : !this$userHostmask.equals(other$userHostmask)) return false;
		return true;
	}

	@java.lang.SuppressWarnings("all")
	@javax.annotation.Generated("lombok")
	protected boolean canEqual(final java.lang.Object other) {
		return other instanceof JoinEvent;
	}

	@java.lang.Override
	@java.lang.SuppressWarnings("all")
	@javax.annotation.Generated("lombok")
	public int hashCode() {
		final int PRIME = 59;
		int result = 1;
		result = result * PRIME + super.hashCode();
		final java.lang.Object $channel = this.getChannel();
		result = result * PRIME + ($channel == null ? 43 : $channel.hashCode());
		final java.lang.Object $user = this.getUser();
		result = result * PRIME + ($user == null ? 43 : $user.hashCode());
		final java.lang.Object $userHostmask = this.getUserHostmask();
		result = result * PRIME + ($userHostmask == null ? 43 : $userHostmask.hashCode());
		return result;
	}

	/**
	 * The channel which somebody joined.
	 */
	@Override
	@java.lang.SuppressWarnings("all")
	@javax.annotation.Generated("lombok")
	public Channel getChannel() {
		return this.channel;
	}

	/**
	 * The user who joined the channel.
	 */
	@Override
	@Nullable
	@java.lang.SuppressWarnings("all")
	@javax.annotation.Generated("lombok")
	public User getUser() {
		return this.user;
	}

	/**
	 * The user hostmask who joined the channel.
	 */
	@Override
	@java.lang.SuppressWarnings("all")
	@javax.annotation.Generated("lombok")
	public UserHostmask getUserHostmask() {
		return this.userHostmask;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy