47 Zeilen
1.6 KiB
Java
47 Zeilen
1.6 KiB
Java
|
package de.steamwar.fightsystem.winconditions;
|
||
|
|
||
|
import de.steamwar.fightsystem.FightSystem;
|
||
|
import de.steamwar.fightsystem.fight.Fight;
|
||
|
import de.steamwar.fightsystem.fight.FightTeam;
|
||
|
import de.steamwar.fightsystem.utils.Config;
|
||
|
import org.bukkit.Bukkit;
|
||
|
import org.bukkit.entity.Player;
|
||
|
import org.bukkit.event.EventHandler;
|
||
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||
|
|
||
|
public class WinconditionAllDead extends PlayerWincondition {
|
||
|
|
||
|
public WinconditionAllDead(){
|
||
|
init(Config.AllDead);
|
||
|
}
|
||
|
|
||
|
@EventHandler
|
||
|
public void handlePlayerDeath(PlayerDeathEvent event) {
|
||
|
Player player = event.getEntity().getPlayer();
|
||
|
|
||
|
if(!isTarget(player))
|
||
|
return;
|
||
|
|
||
|
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
||
|
if(fightTeam.allPlayersOut()) {
|
||
|
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer letzte Spieler aus " + fightTeam.getPrefix() + fightTeam.getName() + " §cist gestorben!");
|
||
|
FightSystem.setSpectateState(Fight.getOpposite(fightTeam));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@EventHandler
|
||
|
public void handlePlayerQuit(PlayerQuitEvent event) {
|
||
|
Player player = event.getPlayer();
|
||
|
|
||
|
if(!isTarget(player))
|
||
|
return;
|
||
|
|
||
|
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
||
|
if(fightTeam.allPlayersOut()) {
|
||
|
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer letzte Spieler aus §6" + fightTeam.getPrefix() + fightTeam.getName() + " §chat den Kampf verlassen!");
|
||
|
FightSystem.setSpectateState(Fight.getOpposite(fightTeam));
|
||
|
}
|
||
|
}
|
||
|
}
|