Merge branch 'master' into lixfel-ai-v1
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Dieser Commit ist enthalten in:
Commit
dcfe141beb
@ -123,7 +123,7 @@ public class Fight {
|
|||||||
if(!player.isOnline())
|
if(!player.isOnline())
|
||||||
return;
|
return;
|
||||||
pseudoSpectator(player, true);
|
pseudoSpectator(player, true);
|
||||||
}, 2);
|
}, 1);
|
||||||
}else if(gameMode == GameMode.SURVIVAL) {
|
}else if(gameMode == GameMode.SURVIVAL) {
|
||||||
for(Player currentPlayer : Bukkit.getServer().getOnlinePlayers()) {
|
for(Player currentPlayer : Bukkit.getServer().getOnlinePlayers()) {
|
||||||
if(currentPlayer.getUniqueId() != player.getUniqueId() && currentPlayer.getGameMode() == GameMode.SPECTATOR) {
|
if(currentPlayer.getUniqueId() != player.getUniqueId() && currentPlayer.getGameMode() == GameMode.SPECTATOR) {
|
||||||
|
@ -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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,10 @@ package de.steamwar.fightsystem.listener;
|
|||||||
|
|
||||||
import de.steamwar.fightsystem.ArenaMode;
|
import de.steamwar.fightsystem.ArenaMode;
|
||||||
import de.steamwar.fightsystem.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
|
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;
|
||||||
@ -31,6 +33,7 @@ import de.steamwar.fightsystem.states.FightState;
|
|||||||
import de.steamwar.fightsystem.states.OneShotStateDependent;
|
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.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -75,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();
|
||||||
@ -114,8 +125,14 @@ public class TeamArea implements Listener {
|
|||||||
fightPlayer.ifPlayer(player -> {
|
fightPlayer.ifPlayer(player -> {
|
||||||
boolean inRegion = team.getExtendRegion().playerInRegion(player.getLocation());
|
boolean inRegion = team.getExtendRegion().playerInRegion(player.getLocation());
|
||||||
if(inRegion && !realSpectator.contains(player)) {
|
if(inRegion && !realSpectator.contains(player)) {
|
||||||
Fight.pseudoSpectator(player, false);
|
|
||||||
realSpectator.add(player);
|
realSpectator.add(player);
|
||||||
|
|
||||||
|
//Later to prevent race condition with Fight.setSpecatator() during respawn
|
||||||
|
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> {
|
||||||
|
if(!player.isOnline())
|
||||||
|
return;
|
||||||
|
Fight.pseudoSpectator(player, false);
|
||||||
|
}, 2);
|
||||||
}else if(!inRegion && realSpectator.contains(player)) {
|
}else if(!inRegion && realSpectator.contains(player)) {
|
||||||
Fight.pseudoSpectator(player, true);
|
Fight.pseudoSpectator(player, true);
|
||||||
realSpectator.remove(player);
|
realSpectator.remove(player);
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren