Package dev.itsharshxd.zentrix.api.loot
Interface GameLootService
public interface GameLootService
Independent main, Nether, End, and deathmatch pools with per-match frozen state. World,
inventory, and generation operations must run on the Bukkit main thread.
- Since:
- 1.6.0
-
Method Summary
Modifier and TypeMethodDescription@NotNull LootEntrycreateEntry(@NotNull org.bukkit.inventory.ItemStack item) @NotNull Optional<LootGenerationResult> generateOnOpen(@NotNull org.bukkit.entity.Player player, @NotNull org.bukkit.inventory.Inventory inventory) Lazily generates an eligible original container for an active participant.@NotNull LootPoolConfigurationgetActiveConfiguration(@NotNull GameLootPool pool) getAppearanceCounters(@NotNull ZentrixGame game, @NotNull GameLootPool pool) @NotNull LootPoolConfigurationgetDiskConfiguration(@NotNull GameLootPool pool) @NotNull Optional<LootPoolConfiguration> getFrozenConfiguration(@NotNull ZentrixGame game, @NotNull GameLootPool pool) @NotNull LootRecoveryStategetRecoveryState(@NotNull GameLootPool pool) default OptionalLonggetRefillCycle(@NotNull ZentrixGame game, @NotNull LootPool pool) The refill cycle a match's pool is in: 0 until the first refill, then one more per refill.@NotNull Optional<LootGenerationResult> handleDestruction(@NotNull org.bukkit.block.Block block, boolean generateDrops) Consumes a destroyed section and optionally generates its loot as world drops.@NotNull LootImportResultimportEntries(@NotNull GameLootPool pool, @NotNull List<LootEntry> entries) booleanisProcessed(@NotNull ZentrixGame game, @NotNull org.bukkit.block.Block block) voidmarkPlayerPlaced(@NotNull org.bukkit.block.Block block) voidprepareGame(@NotNull ZentrixGame game) Freezes all four active configurations for a match if it has no snapshot yet.@NotNull LootGenerationResultpreview(@NotNull GameLootPool pool, @NotNull LootPoolConfiguration configuration) default voidrefill(@NotNull ZentrixGame game, boolean replace) Starts a new refill cycle for every pool of a running match, exactly like a phase'srefillaction with scopeall.@NotNull LootReloadResultreload(@NotNull GameLootPool pool) booleanvoidreplaceEntryItem(@NotNull LootEntry entry, @NotNull org.bukkit.inventory.ItemStack item) @NotNull Optional<GameLootResolution> resolve(@NotNull org.bukkit.World world) @NotNull Optional<LootContainerSnapshot> resolveContainer(@NotNull org.bukkit.block.Block block) @NotNull Optional<LootContainerSnapshot> resolveContainer(@NotNull org.bukkit.inventory.Inventory inventory) @NotNull LootReloadResultrestoreRecoverySnapshot(@NotNull GameLootPool pool) @NotNull LootSaveResultsave(@NotNull GameLootPool pool, @NotNull LootPoolConfiguration configuration) @NotNull LootValidationResultvalidate(@NotNull GameLootPool pool, @NotNull LootPoolConfiguration configuration)
-
Method Details
-
getActiveConfiguration
-
getDiskConfiguration
-
validate
@NotNull @NotNull LootValidationResult validate(@NotNull @NotNull GameLootPool pool, @NotNull @NotNull LootPoolConfiguration configuration) -
createEntry
-
replaceEntryItem
void replaceEntryItem(@NotNull @NotNull LootEntry entry, @NotNull @NotNull org.bukkit.inventory.ItemStack item) -
save
@NotNull @NotNull LootSaveResult save(@NotNull @NotNull GameLootPool pool, @NotNull @NotNull LootPoolConfiguration configuration) -
importEntries
@NotNull @NotNull LootImportResult importEntries(@NotNull @NotNull GameLootPool pool, @NotNull @NotNull List<LootEntry> entries) -
reload
-
reloadAll
boolean reloadAll() -
preview
@NotNull @NotNull LootGenerationResult preview(@NotNull @NotNull GameLootPool pool, @NotNull @NotNull LootPoolConfiguration configuration) -
getRecoveryState
-
restoreRecoverySnapshot
-
prepareGame
Freezes all four active configurations for a match if it has no snapshot yet. -
getFrozenConfiguration
@NotNull @NotNull Optional<LootPoolConfiguration> getFrozenConfiguration(@NotNull @NotNull ZentrixGame game, @NotNull @NotNull GameLootPool pool) -
getAppearanceCounters
@NotNull @NotNull Map<String,Integer> getAppearanceCounters(@NotNull @NotNull ZentrixGame game, @NotNull @NotNull GameLootPool pool) -
resolve
-
resolveContainer
@NotNull @NotNull Optional<LootContainerSnapshot> resolveContainer(@NotNull @NotNull org.bukkit.block.Block block) -
resolveContainer
@NotNull @NotNull Optional<LootContainerSnapshot> resolveContainer(@NotNull @NotNull org.bukkit.inventory.Inventory inventory) -
markPlayerPlaced
void markPlayerPlaced(@NotNull @NotNull org.bukkit.block.Block block) -
isProcessed
boolean isProcessed(@NotNull @NotNull ZentrixGame game, @NotNull @NotNull org.bukkit.block.Block block) -
generateOnOpen
@NotNull @NotNull Optional<LootGenerationResult> generateOnOpen(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull org.bukkit.inventory.Inventory inventory) Lazily generates an eligible original container for an active participant. -
handleDestruction
@NotNull @NotNull Optional<LootGenerationResult> handleDestruction(@NotNull @NotNull org.bukkit.block.Block block, boolean generateDrops) Consumes a destroyed section and optionally generates its loot as world drops. -
refill
Starts a new refill cycle for every pool of a running match, exactly like a phase'srefillaction with scopeall.Refills are lazy: each container is filled again the next time a participant opens it. A replacing refill clears a container's loot slots first; otherwise new loot tops it up. Fires
LootRefillEvent. Main thread only; a match without prepared loot is left alone.- Parameters:
replace- whether containers are cleared before being filled again- Since:
- 1.8.0
-
getRefillCycle
@NotNull default OptionalLong getRefillCycle(@NotNull @NotNull ZentrixGame game, @NotNull @NotNull LootPool pool) The refill cycle a match's pool is in: 0 until the first refill, then one more per refill.- Returns:
- the cycle; empty when the match has no state for that pool
- Since:
- 1.8.0
-