コード例 #1
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);
    }
  }