コード例 #1
0
 @Override
 public void build(final ByteBuffer bb, final int id, final short version) {
   this.setGlobalId(id);
   if (version == 1) {
     this.m_id = bb.getInt();
     this.m_type = bb.get();
     this.m_userType = bb.get();
     this.m_autoTrigger = (bb.get() == 1);
     this.m_isChallenge = (bb.get() == 1);
     this.m_isChaos = (bb.get() == 1);
     this.m_duration = bb.getShort();
     this.m_minUsers = bb.getShort();
     this.m_maxUsers = bb.getShort();
     final long time = bb.getLong();
     if (time != 0L) {
       this.m_expirationDate = GameDate.fromLong(time);
     } else {
       this.m_expirationDate = null;
     }
     try {
       final byte[] bytes = new byte[bb.getInt()];
       bb.get(bytes);
       this.m_params = new String(bytes, "UTF-8").intern();
     } catch (UnsupportedEncodingException e) {
       ScenarioBinaryStorable.m_logger.error((Object) "Exception", (Throwable) e);
     }
     try {
       final int mappingLen = bb.getInt();
       this.m_varMapping = new String[mappingLen];
       for (int i = 0; i < mappingLen; ++i) {
         final byte[] bytes2 = new byte[bb.getInt()];
         bb.get(bytes2);
         this.m_varMapping[i] = new String(bytes2, "UTF-8").intern();
       }
     } catch (UnsupportedEncodingException e) {
       ScenarioBinaryStorable.m_logger.error((Object) "Exception", (Throwable) e);
     }
     try {
       final byte[] bytes = new byte[bb.getInt()];
       bb.get(bytes);
       this.m_joinCriterion = new String(bytes, "UTF-8").intern();
       final byte[] rewardEligibilityCriterion = new byte[bb.getInt()];
       bb.get(rewardEligibilityCriterion);
       this.m_rewardEligibilityCriterion =
           new String(rewardEligibilityCriterion, "UTF-8").intern();
     } catch (UnsupportedEncodingException e) {
       ScenarioBinaryStorable.m_logger.error((Object) "Exception", (Throwable) e);
     }
     for (int glen = bb.getInt(), i = 0; i < glen; ++i) {
       final byte[] gdata = new byte[bb.getInt()];
       bb.get(gdata);
       final ActionGroupStorable g = new ActionGroupStorable();
       g.unserialise(gdata);
       this.m_actionGroups.add(g);
     }
     for (int rlen = bb.getInt(), j = 0; j < rlen; ++j) {
       final byte[] rdata = new byte[bb.getInt()];
       bb.get(rdata);
       final RewardStorable r = new RewardStorable();
       r.unserialise(rdata);
       this.m_rewards.add(r);
     }
   } else {
     ScenarioBinaryStorable.m_logger.error(
         (Object)
             "Tentative de d\u00e9s\u00e9rialisation d'un objet avec une version non prise en charge");
   }
 }
コード例 #2
0
 public void setExpirationDate(final Date expirationDate) {
   this.m_expirationDate =
       ((expirationDate != null) ? GameDate.fromJavaDate(expirationDate) : null);
 }