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