@EventHandler
 public void onTaming(EntityTameEvent event) {
   if (event.getOwner() instanceof Player) {
     String playerID = PlayerConverter.getID((Player) event.getOwner());
     if (!dataMap.containsKey(playerID)) {
       return;
     }
     LivingEntity entity = event.getEntity();
     TameData playerData = (TameData) dataMap.get(playerID);
     switch (type) {
       case WOLF:
         if (entity.getType().equals(EntityType.WOLF) && checkConditions(playerID)) {
           playerData.subtract();
         }
         break;
       case OCELOT:
         if (entity.getType().equals(EntityType.OCELOT) && checkConditions(playerID)) {
           playerData.subtract();
         }
         break;
       case HORSE:
         if (entity.getType().equals(EntityType.HORSE) && checkConditions(playerID)) {
           playerData.subtract();
         }
         break;
       default:
         break;
     }
     if (playerData.isZero()) {
       completeObjective(playerID);
     }
   }
 }
 @EventHandler(priority = EventPriority.MONITOR)
 public void onEntityTame(EntityTameEvent event) {
   if (event.isCancelled() == false
       && event.getOwner() instanceof Player
       && !worlds.contains(event.getEntity().getWorld().getName())) {
     playerStatManager
         .getPlayerBlob(((Player) event.getOwner()).getName())
         .getStat("stats", "tame" + event.getEntity().getType().toString().replace("_", ""))
         .incrementStat(1);
   }
 }
Example #3
0
  /**
   * Monitor EntityTame events.
   *
   * @param event The event to watch
   */
  @EventHandler(priority = EventPriority.MONITOR)
  public void onEntityTame(EntityTameEvent event) {
    Player player = (Player) event.getOwner();

    if (mcPermissions.getInstance().taming(player)
        && !event.getEntity().hasMetadata("mcmmoSummoned")) {
      PlayerProfile PP = Users.getProfile(player);
      EntityType type = event.getEntityType();
      int xp = 0;

      switch (type) {
        case WOLF:
          xp = LoadProperties.mtameWolf;
          break;

        case OCELOT:
          xp = LoadProperties.mtameOcelot;
          break;

        default:
          break;
      }

      PP.addXP(SkillType.TAMING, xp);
      Skills.XpCheckSkill(SkillType.TAMING, player);
    }
  }
  /**
   * Monitor EntityTame events.
   *
   * @param event The event to watch
   */
  @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
  public void onEntityTame(EntityTameEvent event) {
    Player player = (Player) event.getOwner();
    LivingEntity entity = event.getEntity();

    if (Misc.isNPCEntity(player)
        || Misc.isNPCEntity(entity)
        || entity.hasMetadata(mcMMO.entityMetadataKey)) {
      return;
    }

    UserManager.getPlayer(player).getTamingManager().awardTamingXP(entity);
  }