diff --git a/src/de/steamwar/spectatesystem/elements/RPlayer.java b/src/de/steamwar/spectatesystem/elements/RPlayer.java index 6f63e9e..d284fd9 100644 --- a/src/de/steamwar/spectatesystem/elements/RPlayer.java +++ b/src/de/steamwar/spectatesystem/elements/RPlayer.java @@ -26,6 +26,8 @@ import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_15_R1.CraftServer; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer; import org.bukkit.entity.Player; +import org.bukkit.scoreboard.NameTagVisibility; +import org.bukkit.scoreboard.Team; import javax.net.ssl.HttpsURLConnection; import java.io.BufferedReader; @@ -39,9 +41,17 @@ import java.util.logging.Level; public class RPlayer extends REntity { + private static Team team = Bukkit.getScoreboardManager().getMainScoreboard().registerNewTeam("Replay"); + + static { + team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.NEVER); + team.setNameTagVisibility(NameTagVisibility.NEVER); + } + public RPlayer(UUID uuid, String name, int internalId){ super(internalId, createPlayer(uuid, name)); //TODO Damage + team.addEntry(entity.getName()); } @Override @@ -61,6 +71,7 @@ public class RPlayer extends REntity { PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, (EntityPlayer) entity); for(Player player : Bukkit.getOnlinePlayers()) ((CraftPlayer)player).getHandle().playerConnection.sendPacket(packet); + team.removeEntry(entity.getName()); super.remove(); }