Merge pull request 'Add spectate team to hide nametags' (#384) from spectate into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #384 Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
Commit
ce94130343
@ -26,6 +26,7 @@ import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.commands.GUI;
|
||||
import de.steamwar.fightsystem.countdown.Countdown;
|
||||
import de.steamwar.fightsystem.listener.FightScoreboard;
|
||||
import de.steamwar.fightsystem.listener.Permanent;
|
||||
import de.steamwar.fightsystem.listener.PersonalKitCreator;
|
||||
import de.steamwar.fightsystem.record.GlobalRecorder;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
@ -121,11 +122,7 @@ public class FightTeam {
|
||||
new KitLoader();
|
||||
new SpectateHandler();
|
||||
|
||||
if(FightScoreboard.getBukkit().getTeam(name) == null)
|
||||
team = FightScoreboard.getBukkit().registerNewTeam(name);
|
||||
else
|
||||
team = FightScoreboard.getBukkit().getTeam(name);
|
||||
assert team != null;
|
||||
team = FightScoreboard.getBukkitTeam(name);
|
||||
WorldOfColorWrapper.impl.setTeamColor(team, color);
|
||||
BountifulWrapper.impl.setNametagVisibility(team);
|
||||
team.setNameTagVisibility(NameTagVisibility.HIDE_FOR_OTHER_TEAMS);
|
||||
@ -252,6 +249,7 @@ public class FightTeam {
|
||||
FightPlayer fightPlayer = new FightPlayer(player, this);
|
||||
players.put(player, fightPlayer);
|
||||
invited.remove(player);
|
||||
Permanent.getSpectatorTeam().removeEntry(player.getName());
|
||||
team.addEntry(player.getName());
|
||||
|
||||
Fight.setPlayerGamemode(player, GameMode.SURVIVAL);
|
||||
@ -277,6 +275,7 @@ public class FightTeam {
|
||||
List<ProtocolUtils.ChunkPos> chunksToReload = FightSystem.getTechHider().prepareChunkReload(player, true);
|
||||
players.remove(player);
|
||||
team.removeEntry(player.getName());
|
||||
Permanent.getSpectatorTeam().addEntry(player.getName());
|
||||
|
||||
FightUI.addSubtitle("UI_PLAYER_LEAVES", prefix, player.getName());
|
||||
|
||||
|
@ -30,14 +30,20 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.scoreboard.Scoreboard;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
|
||||
public class FightScoreboard implements Listener, ScoreboardCallback {
|
||||
|
||||
public static Scoreboard getBukkit() {
|
||||
return Objects.requireNonNull(Bukkit.getScoreboardManager()).getMainScoreboard();
|
||||
public static Team getBukkitTeam(String name) {
|
||||
Scoreboard scoreboard = Objects.requireNonNull(Bukkit.getScoreboardManager()).getMainScoreboard();
|
||||
Team team = scoreboard.getTeam(name);
|
||||
if(team != null)
|
||||
return team;
|
||||
|
||||
return scoreboard.registerNewTeam(name);
|
||||
}
|
||||
|
||||
private static FightScoreboard scoreboard;
|
||||
|
@ -46,9 +46,15 @@ import org.bukkit.event.inventory.InventoryPickupItemEvent;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.event.weather.WeatherChangeEvent;
|
||||
import org.bukkit.event.world.WorldLoadEvent;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
|
||||
public class Permanent implements Listener {
|
||||
|
||||
private static final Team spectatorTeam = FightScoreboard.getBukkitTeam("Spectator");
|
||||
public static Team getSpectatorTeam() {
|
||||
return spectatorTeam;
|
||||
}
|
||||
|
||||
public Permanent() {
|
||||
new StateDependentListener(ArenaMode.All, FightState.All, this);
|
||||
}
|
||||
@ -81,6 +87,7 @@ public class Permanent implements Listener {
|
||||
|
||||
if (!Config.ArenaLeaveable && !Fight.fighting(player)) {
|
||||
Fight.setPlayerGamemode(player, GameMode.SPECTATOR);
|
||||
spectatorTeam.addEntry(player.getName());
|
||||
player.teleport(Config.SpecSpawn);
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren