public void updateSpectatorOnInventory(Player spec) {
    Player player = getPlayer().getPlayer();
    if (player == null) return;

    PlayerInventory inv = player.getInventory();
    int goldIngots = 0;
    int goldenApples = 0;
    int notchApples = 0;
    for (ItemStack is : inv.getContents()) {
      if (is != null) {
        if (is.getType() == Material.GOLD_INGOT) goldIngots += is.getAmount();
        if (is.getType() == Material.GOLD_BLOCK) goldIngots += is.getAmount() * 9;
        if (is.getType() == Material.GOLD_NUGGET) goldIngots += is.getAmount() / 9;

        if (is.getType() == Material.GOLDEN_APPLE) {
          if (is.getDurability() == 0) goldenApples += is.getAmount();
          if (is.getDurability() == 1) notchApples += is.getAmount();
        }
      }
    }

    PluginChannelUtils.messageSpectator(
        spec, "player", getName(), "itemcount", "266", Integer.toString(goldIngots));
    PluginChannelUtils.messageSpectator(
        spec, "player", getName(), "itemcount", "322,0", Integer.toString(goldenApples));
    PluginChannelUtils.messageSpectator(
        spec, "player", getName(), "itemcount", "322,1", Integer.toString(notchApples));
  }
  public void updateDimension() {
    Player player = getPlayer().getPlayer();
    if (player == null) return;

    Environment env = player.getWorld().getEnvironment();
    String envString = "overworld";
    if (env == Environment.NETHER) envString = "nether";
    else if (env == Environment.THE_END) envString = "end";

    PluginChannelUtils.messageSpectators("player", getName(), "dimension", envString);
  }
  public void updateHealth() {
    Player player = getPlayer().getPlayer();
    if (player == null) return;

    int newHealth = Math.max(0, player.getHealth());

    if (newHealth != currentHealth) {
      PluginChannelUtils.messageSpectators("player", getName(), "hp", Integer.toString(newHealth));
      this.player
          .getMatch()
          .getServer()
          .getPluginManager()
          .callEvent(
              new UhcHealthChangeEvent(
                  this.player.getMatch(), this.player.getLocation(), player, newHealth));
      currentHealth = newHealth;
    }
  }
  public void updateArmor() {
    Player player = getPlayer().getPlayer();
    if (player == null) return;

    int newArmor = ArmorPoints.fromPlayerInventory(player.getInventory());

    if (newArmor != currentArmor) {
      PluginChannelUtils.messageSpectators(
          "player", getName(), "armor", Integer.toString(newArmor));
      this.player
          .getMatch()
          .getServer()
          .getPluginManager()
          .callEvent(
              new UhcArmorChangeEvent(
                  this.player.getMatch(), this.player.getLocation(), player, newArmor));
      currentArmor = newArmor;
    }
  }
 public void setIsOnline(boolean online) {
   PluginChannelUtils.messageSpectators("player", getName(), online ? "login" : "logout");
 }
 public void incrementShotsHit() {
   ++shotsHit;
   PluginChannelUtils.messageSpectators("player", getName(), "accuracy", getAccuracy());
 }
 public void addKill() {
   ++kills;
   PluginChannelUtils.messageSpectators(
       "player", this.getName(), "kills", Integer.toString(getKills()));
 }