private void handleAuctionStart(ACLMessage msg) {
   try {
     if (msg.getContentObject() != null && msg.getContentObject() instanceof Auction) {
       final Auction auction = (Auction) msg.getContentObject();
       knownAuctions.add(auction);
       myAgent.addBehaviour(
           new OneShotBehaviour() {
             @Override
             public void action() {
               participatingAuctions.add(auction);
               Random random = new Random();
               double maxFactor = ((double) (random.nextInt(60) + 30)) / 100;
               int maxPrice = (int) ((float) auction.getCurrentPrice() * maxFactor);
               int strategy = 0;
               int prefPrice = (int) ((float) 0.7 * maxPrice);
               BidSettings bs = new BidSettings(maxPrice, prefPrice, strategy);
               auctionSettings.put(auction.getArtifact().getId(), bs);
             }
           });
     } else {
       block();
     }
   } catch (UnreadableException ex) {
     block();
   }
 }
  private void handleAuctionWon(ACLMessage msg) {
    try {
      if (msg.getContentObject() != null && msg.getContentObject() instanceof Auction) {
        final Artifact art = ((Auction) msg.getContentObject()).getArtifact();
        boughtArtifacts.add(art);

        for (Auction auction : participatingAuctions) {
          Auction match = getAuction(auction);
          if (match != null && match.getArtifact().getId() == art.getId()) {
            participatingAuctions.remove(match);
            knownAuctions.remove(match);
            break;
          }
        }
      } else {
        block();
      }
    } catch (UnreadableException ex) {
      block();
    }
  }
  private void handleCFP(ACLMessage msg) {
    try {
      if (msg.getContentObject() != null && msg.getContentObject() instanceof Auction) {
        final Auction auction = (Auction) msg.getContentObject();

        if (participatingAuctions.contains(auction)) {
          myAgent.addBehaviour(
              getStrategy(msg, curator, auctionSettings.get(auction.getArtifact().getId())));
        }
      } else {
        block();
      }
    } catch (UnreadableException ex) {
      block();
    }
  }