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();
|
2019-06-05 22:14:27 +02: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
|
|
|
}
|