/* This file is a part of the SteamWar software. Copyright (C) 2020 SteamWar.de-Serverteam This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero 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 Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ package de.steamwar.fightsystem.fight; import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.kit.KitManager; import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.kit.Kit; import org.bukkit.entity.Player; public class FightPlayer { private final Player player; private final FightTeam team; private boolean isOut; private Kit kit; private int kills; public void sendMessage(String message) { if (this.player != null && this.player.isOnline()) this.player.sendMessage(message); } FightPlayer(Player player, FightTeam team) { this.player = player; this.team = team; this.isOut = false; kit = KitManager.getKitByName(Config.MemberDefault); kills = 0; } public void setOut() { isOut = true; } public Player getPlayer() { return this.player; } public boolean isLiving() { return !this.isOut; } public boolean isLeader() { FightPlayer leader = team.getLeader(); return leader != null && leader.getPlayer() == player; } public Kit getKit() { return kit; } public void setKit(Kit kit) { this.kit = kit; } public FightTeam getTeam(){ return team; } public int getKills(){ return kills; } public void addKill(){ kills++; } public boolean canEntern(){ if(Config.EnterStages.size() <= kit.getEnterStage() || kit.getEnterStage() < 0) return false; return Config.EnterStages.get(kit.getEnterStage()) >= FightSystem.getFightTime(); } }