org.pircbotx.hooks.events.RemoveChannelKeyEvent 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.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.GenericChannelModeEvent;
/**
* Called when a channel key is removed.
*
* This is a type of mode change and therefor is also dispatched in a
* {@link org.pircbotx.hooks.events.ModeEvent}
*
* @author Leon Blakey
*/
public class RemoveChannelKeyEvent extends Event implements GenericChannelModeEvent {
protected final Channel channel;
protected final UserHostmask userHostmask;
protected final User user;
/**
* The key that was in use before the channel key was removed.
*/
protected final String key;
public RemoveChannelKeyEvent(PircBotX bot, @NonNull Channel channel, @NonNull UserHostmask userHostmask, User user, String key) {
super(bot);
if (channel == null) {
throw new java.lang.NullPointerException("channel");
}
if (userHostmask == null) {
throw new java.lang.NullPointerException("userHostmask");
}
this.channel = channel;
this.userHostmask = userHostmask;
this.user = user;
this.key = key;
}
/**
* Respond by send a message in the channel to the user that removed the
* mode in user: message
format
*
* @param response The response to send
*/
@Override
public void respond(String response) {
getChannel().send().message(getUser(), response);
}
/**
* The key that was in use before the channel key was removed.
*/
@java.lang.SuppressWarnings("all")
@javax.annotation.Generated("lombok")
public String getKey() {
return this.key;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@javax.annotation.Generated("lombok")
public java.lang.String toString() {
return "RemoveChannelKeyEvent(channel=" + this.getChannel() + ", userHostmask=" + this.getUserHostmask() + ", user=" + this.getUser() + ", key=" + this.getKey() + ")";
}
@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 RemoveChannelKeyEvent)) return false;
final RemoveChannelKeyEvent other = (RemoveChannelKeyEvent)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$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$key = this.getKey();
final java.lang.Object other$key = other.getKey();
if (this$key == null ? other$key != null : !this$key.equals(other$key)) return false;
return true;
}
@java.lang.SuppressWarnings("all")
@javax.annotation.Generated("lombok")
protected boolean canEqual(final java.lang.Object other) {
return other instanceof RemoveChannelKeyEvent;
}
@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 $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 $key = this.getKey();
result = result * PRIME + ($key == null ? 43 : $key.hashCode());
return result;
}
@Override
@java.lang.SuppressWarnings("all")
@javax.annotation.Generated("lombok")
public Channel getChannel() {
return this.channel;
}
@Override
@java.lang.SuppressWarnings("all")
@javax.annotation.Generated("lombok")
public UserHostmask getUserHostmask() {
return this.userHostmask;
}
@Override
@java.lang.SuppressWarnings("all")
@javax.annotation.Generated("lombok")
public User getUser() {
return this.user;
}
}