Class WorldEventStorage

java.lang.Object
com.hypixel.hytale.builtin.adventure.worldevents.WorldEventStorage
All Implemented Interfaces:
Resource<EntityStore>, Cloneable

@NotThreadSafe public class WorldEventStorage extends Object implements Resource<EntityStore>
  • Field Details

  • Constructor Details

    • WorldEventStorage

      public WorldEventStorage()
    • WorldEventStorage

      public WorldEventStorage(@Nonnull WorldEventStorage other)
  • Method Details

    • clear

      public void clear()
      Removes every stored event and completion record, then marks the storage for a save.

      Clears in place instead of replacing the resource. A replacement would drop an in-flight save of the old instance, and the two writes would then race for the same file.

    • consumeState

      @Nonnull public WorldEventStorage.State consumeState()
    • markLoad

      public void markLoad()
    • markSave

      public void markSave()
    • add

      public void add(@Nonnull WorldEvent event)
    • remove

      public void remove(@Nonnull WorldEvent event)
    • contains

      public boolean contains(@Nonnull WorldEvent event)
    • forEach

      public <T> void forEach(@Nullable T ctx, @Nonnull BiConsumer<WorldEvent, T> consumer)
    • addComplete

      public void addComplete(@Nonnull UUID uuid)
    • isComplete

      public boolean isComplete(@Nonnull UUID uuid)
    • completeCount

      public int completeCount()
      Returns:
      the number of completed events, without the copy that getComplete() makes
    • onCompleteSave

      public void onCompleteSave(@Nullable Object ignored, @Nullable Throwable error)
    • onCompleteLoad

      public void onCompleteLoad(@Nullable WorldEventStorage loaded, @Nullable Throwable error)
    • getComplete

      @Nonnull public UUID[] getComplete()
      Returns:
      a sorted snapshot of the completed event ids
    • clone

      @Nonnull public Resource<EntityStore> clone()
      Specified by:
      clone in interface Resource<EntityStore>
      Returns:
      a clone instance of the original resource instance.

    • getResourceType

      public static ResourceType<EntityStore, WorldEventStorage> getResourceType()