DungeonsXL/api/src/main/java/de/erethon/dungeonsxl/api/event/player/GamePlayerFinishEvent.java

72 lines
2.2 KiB
Java
Raw Normal View History

2016-03-01 22:08:07 +01:00
/*
* Copyright (C) 2012-2020 Frank Baumann
2016-03-01 22:08:07 +01:00
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
2020-04-25 15:21:51 +02:00
package de.erethon.dungeonsxl.api.event.player;
2016-03-01 22:08:07 +01:00
2020-04-25 15:21:51 +02:00
import de.erethon.dungeonsxl.api.player.GamePlayer;
2016-03-01 22:08:07 +01:00
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
/**
2020-04-25 15:21:51 +02:00
* Fired when a player finishs a game.
* <p>
* Do not confuse this with {@link de.erethon.dungeonsxl.api.event.group.GroupFinishDungeonEvent}. GamePlayerFinishEvent is fired when a player triggers an end
* sign, while GroupFinishDungeonEvent is triggered when all group members have triggered the ready sign and the game actually ends.
*
2016-03-01 22:08:07 +01:00
* @author Daniel Saukel
*/
2020-04-25 15:21:51 +02:00
public class GamePlayerFinishEvent extends GamePlayerEvent implements Cancellable {
2016-03-01 22:08:07 +01:00
private static final HandlerList handlers = new HandlerList();
private boolean cancelled;
private boolean hasToWait;
2020-04-25 15:21:51 +02:00
public GamePlayerFinishEvent(GamePlayer gamePlayer, boolean hasToWait) {
super(gamePlayer);
2016-03-01 22:08:07 +01:00
this.hasToWait = hasToWait;
}
/**
2020-04-25 15:21:51 +02:00
* Returns false if the other group members have all already triggered the end sign, true if not.
*
* @return false if the other group members have all already triggered the end sign, true if not
2016-03-01 22:08:07 +01:00
*/
public boolean getHasToWait() {
return hasToWait;
}
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}
}