NPCLib/api/src/main/java/net/jitse/npclib/api/events/NPCHideEvent.java

66 lines
1.3 KiB
Java
Raw Normal View History

2018-04-26 13:52:49 +02:00
/*
* Copyright (c) 2018 Jitse Boonstra
*/
2019-08-03 13:47:12 +02:00
package net.jitse.npclib.api.events;
2018-04-26 13:52:49 +02:00
import net.jitse.npclib.api.NPC;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
* @author Jitse Boonstra
*/
2019-08-03 13:47:12 +02:00
public class NPCHideEvent extends Event implements Cancellable {
2018-04-26 13:52:49 +02:00
private static final HandlerList handlers = new HandlerList();
private boolean cancelled = false;
private final NPC npc;
private final Player player;
2019-08-03 13:47:12 +02:00
private final boolean automatic;
2018-04-26 13:52:49 +02:00
2019-08-03 13:47:12 +02:00
public NPCHideEvent(NPC npc, Player player, boolean automatic) {
2018-04-26 13:52:49 +02:00
this.npc = npc;
this.player = player;
2019-08-03 13:47:12 +02:00
this.automatic = automatic;
2018-04-26 13:52:49 +02:00
}
@Override
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
public NPC getNPC() {
return npc;
}
public Player getPlayer() {
return player;
}
2019-08-03 13:47:12 +02:00
/**
* @return Value on whether the hiding was triggered automatically.
*/
public boolean isAutomatic() {
return automatic;
2018-04-26 13:52:49 +02:00
}
@Override
public boolean isCancelled() {
return cancelled;
}
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}