SteamWar/FightSystem
Archiviert
13
1

Fix team leave
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2024-01-26 09:06:54 +01:00
Ursprung 75af1f00ba
Commit 33a84d6a66
2 geänderte Dateien mit 13 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -58,7 +58,10 @@ public class Border {
} }
public void addPlayer(Player player) { public void addPlayer(Player player) {
ghostBarriers.computeIfAbsent(player, uuid -> new HashSet<>()); if(ghostBarriers.containsKey(player))
return;
ghostBarriers.put(player, new HashSet<>());
lastLocation.put(player, player.getLocation()); lastLocation.put(player, player.getLocation());
} }

Datei anzeigen

@ -24,6 +24,7 @@ import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.events.BoardingEvent; import de.steamwar.fightsystem.events.BoardingEvent;
import de.steamwar.fightsystem.events.TeamDeathEvent; import de.steamwar.fightsystem.events.TeamDeathEvent;
import de.steamwar.fightsystem.events.TeamLeaveEvent;
import de.steamwar.fightsystem.events.TeamSpawnEvent; import de.steamwar.fightsystem.events.TeamSpawnEvent;
import de.steamwar.fightsystem.fight.Fight; import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightPlayer; import de.steamwar.fightsystem.fight.FightPlayer;
@ -77,6 +78,14 @@ public class TeamArea implements Listener {
} }
} }
@EventHandler
public void teamLeave(TeamLeaveEvent e) {
FightPlayer fightPlayer = e.getFightPlayer();
fightPlayer.ifPlayer(spectatorBorder::addPlayer);
if(fightPlayer.getTeam() == team)
fightPlayer.ifPlayer(bordingBorder::removePlayer);
}
@EventHandler @EventHandler
public void boarding(BoardingEvent e) { public void boarding(BoardingEvent e) {
FightPlayer fightPlayer = e.getFightPlayer(); FightPlayer fightPlayer = e.getFightPlayer();