SteamWar/FightSystem
Archiviert
13
1

Team Event API, Fancy Borders #413

Zusammengeführt
Lixfel hat 3 Commits von fancyBorder nach master 2024-01-24 12:05:04 +01:00 zusammengeführt
Nur Änderungen aus Commit c8b9263b70 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -28,6 +28,7 @@ import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightPlayer; import de.steamwar.fightsystem.fight.FightPlayer;
import de.steamwar.fightsystem.fight.FightTeam; import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.OneShotStateDependent;
import de.steamwar.fightsystem.states.StateDependentListener; import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.states.StateDependentTask; import de.steamwar.fightsystem.states.StateDependentTask;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -53,6 +54,7 @@ public class TeamArea implements Listener {
new StateDependentListener(ArenaMode.AntiTest, FightState.All, this); new StateDependentListener(ArenaMode.AntiTest, FightState.All, this);
new StateDependentTask(ArenaMode.AntiTest, FightState.TeamFix, this::realSpectatorCheck, 1, 1); new StateDependentTask(ArenaMode.AntiTest, FightState.TeamFix, this::realSpectatorCheck, 1, 1);
new OneShotStateDependent(ArenaMode.AntiTest, FightState.Spectate, () -> Fight.teams().forEach(t -> t.getPlayers().forEach(this::teamSpectator)));
} }
@EventHandler @EventHandler
@ -85,7 +87,10 @@ public class TeamArea implements Listener {
@EventHandler @EventHandler
public void teamDeath(TeamDeathEvent e) { public void teamDeath(TeamDeathEvent e) {
FightPlayer fightPlayer = e.getFightPlayer(); teamSpectator(e.getFightPlayer());
}
private void teamSpectator(FightPlayer fightPlayer) {
if(fightPlayer.getTeam() == team) { if(fightPlayer.getTeam() == team) {
fightPlayer.ifPlayer(bordingBorder::removePlayer); fightPlayer.ifPlayer(bordingBorder::removePlayer);
} else { } else {