001package com.ericlam.mc.minigames.core.event.player;
002
003import com.ericlam.mc.minigames.core.arena.Arena;
004import com.ericlam.mc.minigames.core.character.GamePlayer;
005import org.bukkit.event.Cancellable;
006
007import javax.annotation.Nonnull;
008
009/**
010 * 遊戲玩家投票地圖事件
011 * <p>
012 * 此事件可以被取消,當事件被取消後,投票數將不會生效。
013 */
014public final class GamePlayerVoteEvent extends GamePlayerEvent implements Cancellable {
015
016    private Arena voted;
017    private boolean cancel;
018
019    public GamePlayerVoteEvent(@Nonnull Arena voted, GamePlayer gamePlayer) {
020        super(gamePlayer, null);
021        this.voted = voted;
022        this.cancel = false;
023    }
024
025    /**
026     * 獲取投票的地圖
027     *
028     * @return 投票地圖
029     */
030    public Arena getVoted() {
031        return voted;
032    }
033
034
035    /**
036     * 設置投票的地圖
037     *
038     * @param voted 投票地圖
039     */
040    public void setVoted(Arena voted) {
041        this.voted = voted;
042    }
043
044    @Override
045    public boolean isCancelled() {
046        return cancel;
047    }
048
049    @Override
050    public void setCancelled(boolean b) {
051        this.cancel = b;
052    }
053}