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

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

// 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.User;
import lombok.NonNull;
import org.pircbotx.hooks.Event;
import org.pircbotx.PircBotX;
import org.pircbotx.UserHostmask;
import org.pircbotx.hooks.types.GenericMessageEvent;

/**
 * This event is dispatched whenever a private message is sent to us.
 *
 * @author Leon Blakey
 */
public class PrivateMessageEvent extends Event implements GenericMessageEvent {
	
	/**
	 * The user hostmask who sent the private message.
	 */
	protected final UserHostmask userHostmask;
	
	/**
	 * The user who sent the private message.
	 */
	protected final User user;
	
	/**
	 * The actual message.
	 */
	protected final String message;
	
	public PrivateMessageEvent(PircBotX bot, @NonNull UserHostmask userHostmask, User user, @NonNull String message) {
		super(bot);
		if (userHostmask == null) {
			throw new java.lang.NullPointerException("userHostmask");
		}
		if (message == null) {
			throw new java.lang.NullPointerException("message");
		}
		this.userHostmask = userHostmask;
		this.user = user;
		this.message = message;
	}
	
	/**
	 * Respond with a private message to the user that sent the message
	 *
	 * @param response The response to send
	 */
	@Override
	public void respond(String response) {
		respondWith(response);
	}
	
	@Override
	public void respondWith(String fullLine) {
		getUser().send().message(fullLine);
	}
	
	@Override
	public void respondPrivateMessage(String message) {
		respond(message);
	}
	
	@java.lang.Override
	@java.lang.SuppressWarnings("all")
	@javax.annotation.Generated("lombok")
	public java.lang.String toString() {
		return "PrivateMessageEvent(userHostmask=" + this.getUserHostmask() + ", user=" + this.getUser() + ", message=" + this.getMessage() + ")";
	}
	
	@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 PrivateMessageEvent)) return false;
		final PrivateMessageEvent other = (PrivateMessageEvent)o;
		if (!other.canEqual((java.lang.Object)this)) return false;
		if (!super.equals(o)) 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;
		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$message = this.getMessage();
		final java.lang.Object other$message = other.getMessage();
		if (this$message == null ? other$message != null : !this$message.equals(other$message)) return false;
		return true;
	}
	
	@java.lang.SuppressWarnings("all")
	@javax.annotation.Generated("lombok")
	protected boolean canEqual(final java.lang.Object other) {
		return other instanceof PrivateMessageEvent;
	}
	
	@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 $userHostmask = this.getUserHostmask();
		result = result * PRIME + ($userHostmask == null ? 43 : $userHostmask.hashCode());
		final java.lang.Object $user = this.getUser();
		result = result * PRIME + ($user == null ? 43 : $user.hashCode());
		final java.lang.Object $message = this.getMessage();
		result = result * PRIME + ($message == null ? 43 : $message.hashCode());
		return result;
	}
	
	/**
	 * The user hostmask who sent the private message.
	 */
	@Override
	@java.lang.SuppressWarnings("all")
	@javax.annotation.Generated("lombok")
	public UserHostmask getUserHostmask() {
		return this.userHostmask;
	}
	
	/**
	 * The user who sent the private message.
	 */
	@Override
	@Nullable
	@java.lang.SuppressWarnings("all")
	@javax.annotation.Generated("lombok")
	public User getUser() {
		return this.user;
	}
	
	/**
	 * The actual message.
	 */
	@Override
	@java.lang.SuppressWarnings("all")
	@javax.annotation.Generated("lombok")
	public String getMessage() {
		return this.message;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy