mirror of https://github.com/PikaMug/Quests.git
61 lines
1.7 KiB
Java
61 lines
1.7 KiB
Java
/*
|
|
* Copyright (c) PikaMug and contributors
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
|
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
*/
|
|
|
|
package me.pikamug.quests.events.quest;
|
|
|
|
import me.pikamug.quests.player.Quester;
|
|
import me.pikamug.quests.quests.Quest;
|
|
import org.bukkit.event.Cancellable;
|
|
import org.bukkit.event.HandlerList;
|
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
/**
|
|
* Called when a quest is taken by a quester
|
|
*/
|
|
public class QuestTakeEvent extends QuestEvent implements Cancellable {
|
|
private static final HandlerList HANDLERS = new HandlerList();
|
|
private final Quester quester;
|
|
private boolean cancel = false;
|
|
|
|
public QuestTakeEvent(final Quest quest, final Quester who) {
|
|
super(quest);
|
|
this.quester = who;
|
|
}
|
|
|
|
/**
|
|
* Returns the quester involved in this event
|
|
*
|
|
* @return Quester who is involved in this event
|
|
*/
|
|
public Quester getQuester() {
|
|
return quester;
|
|
}
|
|
|
|
@Override
|
|
public boolean isCancelled() {
|
|
return cancel;
|
|
}
|
|
|
|
@Override
|
|
public void setCancelled(final boolean cancel) {
|
|
this.cancel = cancel;
|
|
}
|
|
|
|
@Override
|
|
public @NotNull HandlerList getHandlers() {
|
|
return HANDLERS;
|
|
}
|
|
|
|
public static HandlerList getHandlerList() {
|
|
return HANDLERS;
|
|
}
|
|
}
|