Esempio n. 1
0
  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);
  }
Esempio n. 2
0
  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;
    }
  }
Esempio n. 3
0
  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;
    }
  }
Esempio n. 4
0
 public void setIsOnline(boolean online) {
   PluginChannelUtils.messageSpectators("player", getName(), online ? "login" : "logout");
 }
Esempio n. 5
0
 public void incrementShotsHit() {
   ++shotsHit;
   PluginChannelUtils.messageSpectators("player", getName(), "accuracy", getAccuracy());
 }
Esempio n. 6
0
 public void addKill() {
   ++kills;
   PluginChannelUtils.messageSpectators(
       "player", this.getName(), "kills", Integer.toString(getKills()));
 }