update kill best surviving team event

This commit is contained in:
Xander 2024-09-21 21:25:12 +02:00
parent 6ebb48f7ce
commit 081502b64c
No known key found for this signature in database
GPG key ID: 79979C7BA303E003

View file

@ -5,8 +5,10 @@ import gent.zeus.mc13dtl.events.Difficulty;
import gent.zeus.mc13dtl.events.Event; import gent.zeus.mc13dtl.events.Event;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.NamedTextColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.scoreboard.Team; import org.bukkit.scoreboard.Team;
public class KillSurvivingTeamEvent extends Event { public class KillSurvivingTeamEvent extends Event {
@ -28,12 +30,30 @@ public class KillSurvivingTeamEvent extends Event {
@EventHandler @EventHandler
@Override @Override
public void onPlayerDeath(PlayerDeathEvent event) { public void onPlayerDeath(PlayerDeathEvent event) {
if (MC13DTL.board.getPlayers(team).contains(event.getPlayer())) { if (MC13DTL.board.getPlayers(huntingTeam).contains(event.getPlayer())) {
if (team.getName().equals(huntingTeam.getName())) {
eventFailed(); eventFailed();
} else if (MC13DTL.board.getPlayers(huntingTeam).contains(event.getPlayer())) { } else {
eventSuccess(); eventSuccess();
} }
} }
}
@Override
public void eventTimeEnded() {
if (team.getName().equals(huntingTeam.getName())) {
eventSuccess();
} else {
eventFailed();
}
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
if (team.getName().equals(huntingTeam.getName()) && MC13DTL.board.getPlayers(team).contains(event.getPlayer())) {
eventFailed();
}
}
@Override @Override
protected String getMessage() { protected String getMessage() {