2020-08-26 18:24:44 +02:00
|
|
|
/*
|
|
|
|
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 <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2019-09-05 18:26:13 +02:00
|
|
|
package de.steamwar.fightsystem.fight;
|
2019-02-14 18:37:38 +01:00
|
|
|
|
2020-06-03 10:19:57 +02:00
|
|
|
import de.steamwar.fightsystem.FightSystem;
|
2019-09-05 18:26:13 +02:00
|
|
|
import de.steamwar.fightsystem.kit.KitManager;
|
2019-11-16 08:37:33 +01:00
|
|
|
import de.steamwar.fightsystem.Config;
|
2019-09-05 18:26:13 +02:00
|
|
|
import de.steamwar.fightsystem.kit.Kit;
|
2019-02-14 18:37:38 +01:00
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
|
|
|
public class FightPlayer {
|
|
|
|
|
|
|
|
private final Player player;
|
2019-09-05 18:26:13 +02:00
|
|
|
private final FightTeam team;
|
2019-02-14 18:37:38 +01:00
|
|
|
private boolean isOut;
|
2019-04-08 19:30:23 +02:00
|
|
|
private Kit kit;
|
2020-01-23 17:33:29 +01:00
|
|
|
private int kills;
|
2019-02-14 18:37:38 +01:00
|
|
|
|
|
|
|
public void sendMessage(String message) {
|
2019-02-23 16:07:31 +01:00
|
|
|
if (this.player != null && this.player.isOnline())
|
2019-02-14 18:37:38 +01:00
|
|
|
this.player.sendMessage(message);
|
|
|
|
}
|
|
|
|
|
2019-09-05 18:26:13 +02:00
|
|
|
FightPlayer(Player player, FightTeam team) {
|
2019-02-14 18:37:38 +01:00
|
|
|
this.player = player;
|
2019-09-05 18:26:13 +02:00
|
|
|
this.team = team;
|
|
|
|
this.isOut = false;
|
2019-04-13 16:30:25 +02:00
|
|
|
kit = KitManager.getKitByName(Config.MemberDefault);
|
2020-01-23 17:33:29 +01:00
|
|
|
kills = 0;
|
2019-02-14 18:37:38 +01:00
|
|
|
}
|
|
|
|
|
2019-09-05 18:26:13 +02:00
|
|
|
public void setOut() {
|
|
|
|
isOut = true;
|
2019-02-14 18:37:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public Player getPlayer() {
|
|
|
|
return this.player;
|
|
|
|
}
|
|
|
|
|
2019-09-05 18:26:13 +02:00
|
|
|
public boolean isLiving() {
|
|
|
|
return !this.isOut;
|
2019-02-14 18:37:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isLeader() {
|
2019-09-05 18:26:13 +02:00
|
|
|
FightPlayer leader = team.getLeader();
|
2020-12-11 17:53:37 +01:00
|
|
|
return leader != null && leader.getPlayer() == player;
|
2019-02-14 18:37:38 +01:00
|
|
|
}
|
|
|
|
|
2019-04-08 19:30:23 +02:00
|
|
|
public Kit getKit() {
|
|
|
|
return kit;
|
|
|
|
}
|
2019-02-14 18:37:38 +01:00
|
|
|
|
2019-04-08 19:30:23 +02:00
|
|
|
public void setKit(Kit kit) {
|
|
|
|
this.kit = kit;
|
|
|
|
}
|
2019-09-05 18:26:13 +02:00
|
|
|
|
|
|
|
public FightTeam getTeam(){
|
|
|
|
return team;
|
|
|
|
}
|
2020-01-23 17:33:29 +01:00
|
|
|
|
|
|
|
public int getKills(){
|
|
|
|
return kills;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void addKill(){
|
|
|
|
kills++;
|
|
|
|
}
|
2020-06-03 10:19:57 +02:00
|
|
|
|
|
|
|
public boolean canEntern(){
|
|
|
|
if(Config.EnterStages.size() <= kit.getEnterStage() || kit.getEnterStage() < 0)
|
|
|
|
return false;
|
|
|
|
return Config.EnterStages.get(kit.getEnterStage()) >= FightSystem.getFightTime();
|
|
|
|
}
|
2019-02-14 18:37:38 +01:00
|
|
|
}
|