001package com.ericlam.mc.minigames.core.event.player;
002
003import com.ericlam.mc.minigames.core.character.GamePlayer;
004import com.ericlam.mc.minigames.core.game.InGameState;
005import com.ericlam.mc.minigames.core.main.MinigamesCore;
006import org.bukkit.entity.Entity;
007
008import javax.annotation.Nullable;
009import java.util.Set;
010
011/**
012 * 因 CrackShot 而死亡的遊戲玩家事件
013 */
014public final class CrackShotDeathEvent extends GamePlayerDeathEvent {
015
016    private String weaponTitle;
017    private Entity bullet;
018    private Set<DamageType> types;
019
020    public CrackShotDeathEvent(@Nullable GamePlayer killer, GamePlayer gamePlayer, InGameState state, String weaponTitle, Entity bullet, Set<DamageType> types) {
021        super(killer, gamePlayer, DeathCause.CRACKSHOT, state, MinigamesCore.getProperties().getMessageGetter().getPure("death-msg.action.".concat(bullet == null ? "normal" : "gun")));
022        this.weaponTitle = weaponTitle;
023        this.bullet = bullet;
024        this.types = types;
025    }
026
027    /**
028     * @return 傷害類型
029     * @see DamageType
030     */
031    public Set<DamageType> getDamageTypes() {
032        return types;
033    }
034
035    /**
036     * 返回該槍械的 CrackShot Title
037     *
038     * @return 該槍械的 CrackShot Title
039     */
040    public String getWeaponTitle() {
041        return weaponTitle;
042    }
043
044    /**
045     * 返回子彈實體
046     *
047     * @return 子彈
048     */
049    public Entity getBullet() {
050        return bullet;
051    }
052
053    /**
054     * 傷害類型
055     */
056    public enum DamageType {
057        /**
058         * 後刺
059         */
060        BACKSTAB,
061        /**
062         * 重擊
063         */
064        CRITICAL,
065        /**
066         * 爆頭
067         */
068        HEADSHOT
069    }
070}