SteamWar/FightSystem
Archiviert
13
1
Dieses Repository wurde am 2024-08-05 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
FightSystem/FightSystem_Main/src/de/steamwar/fightsystem/fight/FightPlayer.java
Lixfel 9b65277c66 Full resettable + config simplification
Signed-off-by: Lixfel <agga-games@gmx.de>
2021-03-20 17:25:13 +01:00

109 Zeilen
2.8 KiB
Java

/*
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/>.
*/
package de.steamwar.fightsystem.fight;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.countdown.EnternCountdown;
import de.steamwar.sql.PersonalKit;
import de.steamwar.sql.SteamwarUser;
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;
private EnternCountdown enternCountdown = null;
public void sendMessage(String message) {
this.player.sendMessage(message);
}
FightPlayer(Player player, FightTeam team) {
this.player = player;
this.team = team;
this.isOut = false;
kit = Kit.getKitByName(Config.MemberDefault);
if(Config.PersonalKits){
PersonalKit personalKit = PersonalKit.getKitInUse(SteamwarUser.get(player.getUniqueId()).getId(), Config.SchematicType.toDB());
if(personalKit != null){
kit = new Kit(personalKit);
}
}
kills = 0;
}
public void setOut() {
isOut = true;
stopEnternCountdown();
}
public void setEnternCountdown(EnternCountdown countdown){
enternCountdown = countdown;
}
public void stopEnternCountdown(){
if(enternCountdown != null){
enternCountdown.disable();
}
}
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(enternCountdown == null)
return false;
return enternCountdown.getTimeLeft() == 0;
}
}