CommonObjectiveHistoryData class

Пакет: com.hypixel.hytale.builtin.adventure.objectives.historydata

Файл: com/hypixel/hytale/builtin/adventure/objectives/historydata/CommonObjectiveHistoryData.java

Методы (5)

МодификаторыВозвратСигнатура
protected void completedvoid completed()
public String getCategoryString getCategory()
public String getIdString getId()
public Instant getLastCompletionTimestampInstant getLastCompletionTimestamp()
public int getTimesCompletedint getTimesCompleted()

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.adventure.objectives.historydata;

class="kw">import com.hypixel.hytale.codec.Codec;
class="kw">import com.hypixel.hytale.codec.KeyedCodec;
class="kw">import com.hypixel.hytale.codec.builder.BuilderCodec;
class="kw">import com.hypixel.hytale.codec.lookup.CodecMapCodec;
class="kw">import java.time.Instant;
class="kw">import javax.annotation.Nonnull;

class="kw">public class="kw">abstract class CommonObjectiveHistoryData {
   @Nonnull
   class="kw">public class="kw">static class="kw">final CodecMapCodec<CommonObjectiveHistoryData> CODEC = new CodecMapCodec<>("Type");
   @Nonnull
   class="kw">public class="kw">static class="kw">final BuilderCodec<CommonObjectiveHistoryData> BASE_CODEC = BuilderCodec.abstractBuilder(CommonObjectiveHistoryData.class)
      .append(new KeyedCodec<>("Id", Codec.STRING), (var0, var1) -> var0.id = var1, var0 -> var0.id)
      .add()
      .append(new KeyedCodec<>("TimesCompleted", Codec.INTEGER), (var0, var1) -> var0.timesCompleted = var1, var0 -> var0.timesCompleted)
      .add()
      .append(
         new KeyedCodec<>("LastCompletionTimestamp", Codec.LONG),
         (var0, var1) -> var0.lastCompletionTimestamp = Instant.ofEpochMilli(var1),
         var0 -> var0.lastCompletionTimestamp == null ? null : var0.lastCompletionTimestamp.toEpochMilli()
      )
      .add()
      .append(new KeyedCodec<>("Category", Codec.STRING), (var0, var1) -> var0.category = var1, var0 -> var0.category)
      .add()
      .build();
   class="kw">protected String id;
   class="kw">protected int timesCompleted;
   class="kw">protected Instant lastCompletionTimestamp;
   class="kw">protected String category;

   class="kw">public CommonObjectiveHistoryData(String var1, String var2) {
      this.id = var1;
      this.timesCompleted = 1;
      this.lastCompletionTimestamp = Instant.now();
      this.category = var2;
   }

   class="kw">protected CommonObjectiveHistoryData() {
   }

   class="kw">public String getId() {
      class="kw">return this.id;
   }

   class="kw">public int getTimesCompleted() {
      class="kw">return this.timesCompleted;
   }

   class="kw">public Instant getLastCompletionTimestamp() {
      class="kw">return this.lastCompletionTimestamp;
   }

   class="kw">public String getCategory() {
      class="kw">return this.category;
   }

   class="kw">protected void completed() {
      this.timesCompleted++;
      this.lastCompletionTimestamp = Instant.now();
   }

   @Nonnull
   @Override
   class="kw">public String toString() {
      class="kw">return "CommonObjectiveHistoryData{id='"
         + this.id
         + "', timesCompleted="
         + this.timesCompleted
         + ", lastCompletionTimestamp="
         + this.lastCompletionTimestamp
         + ", category='"
         + this.category
         + "'}";
   }
}