Quests/api/src/main/java/me/pikamug/quests/events/quest/QuestUpdateCompassEvent.java

73 lines
2.0 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.Location;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
/**
* Called when a quest has its compass target updated for a quester
*/
public class QuestUpdateCompassEvent extends QuestEvent implements Cancellable {
private static final HandlerList HANDLERS = new HandlerList();
private final Quester quester;
private final Location target;
private boolean cancel = false;
public QuestUpdateCompassEvent(final Quest quest, final Quester who, final Location target) {
super(quest);
this.quester = who;
this.target = target;
}
/**
* Returns the quester involved in this event
*
* @return Quester who is involved in this event
*/
public Quester getQuester() {
return quester;
}
/**
* Returns the new compass target in this event
*
* @return Location which shall be the new target
*/
public Location getNewCompassTarget() {
return target;
}
@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;
}
}