/**
   * Monitor EntityDeath events.
   *
   * @param event The event to watch
   */
  @EventHandler(priority = EventPriority.MONITOR)
  public void onEntityDeath(EntityDeathEvent event) {
    LivingEntity entity = event.getEntity();

    if (Misc.isNPCEntity(entity)) {
      return;
    }

    BleedTimerTask.remove(entity);
    Archery.arrowRetrievalCheck(entity);
  }
Example #2
0
  /**
   * This method is called by PlayerQuitEvent to tear down the mcMMOPlayer.
   *
   * @param syncSave if true, data is saved synchronously
   */
  public void logout(boolean syncSave) {
    Player thisPlayer = getPlayer();
    resetAbilityMode();
    BleedTimerTask.bleedOut(thisPlayer);

    if (syncSave) {
      getProfile().save();
    } else {
      getProfile().scheduleAsyncSave();
    }

    UserManager.remove(thisPlayer);

    if (inParty()) {
      party.removeOnlineMember(thisPlayer);
    }
  }
Example #3
0
  /**
   * Apply the Gore ability.
   *
   * @param target The LivingEntity to apply Gore on
   * @param damage The initial damage
   */
  public double gore(LivingEntity target, double damage) {
    if (!SkillUtils.activationSuccessful(
        SecondaryAbility.GORE, getPlayer(), getSkillLevel(), activationChance)) {
      return 0;
    }

    BleedTimerTask.add(target, Taming.goreBleedTicks);

    if (target instanceof Player) {
      ((Player) target).sendMessage(LocaleLoader.getString("Combat.StruckByGore"));
    }

    getPlayer().sendMessage(LocaleLoader.getString("Combat.Gore"));

    damage = (damage * Taming.goreModifier) - damage;
    return damage;
  }