Example #1
0
 public static int fromPlayerInventory(PlayerInventory inv) {
   int armorPoints = 0;
   for (ItemStack item : inv.getArmorContents())
     if (item != null) {
       armorPoints += ArmorPoints.fromItemStack(item);
     }
   return armorPoints;
 }
Example #2
0
  public void updateHealthArmor() {
    Player player = this.getPlayer();
    if (player == null) return;

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

    getTeam().updateHealthArmor(this, currentHealth, currentArmor, newHealth, newArmor);

    currentHealth = newHealth;
    currentArmor = newArmor;
  }
Example #3
0
  // constructor for simply setting up the variables
  @SuppressWarnings("unchecked")
  public AutoRefPlayer(Player p, AutoRefTeam t) {
    // detailed statistics
    kills = new DefaultedMap(0);
    deaths = new DefaultedMap(0);
    damage = new DefaultedMap(0);

    // accuracy information
    shotsFired = shotsHit = 0;

    // save the player and team as references
    this.setPlayer(p);
    this.setTeam(t);

    // setup the carrying list
    this.carrying = Sets.newHashSet();

    // setup base health and armor level
    this.currentHealth = p.getHealth();
    this.currentArmor = ArmorPoints.fromPlayerInventory(p.getInventory());
  }