From c0302c1911ef3b629bc72d5185f1293cf38aa343 Mon Sep 17 00:00:00 2001 From: Jishuna Date: Sat, 14 Dec 2024 11:39:20 +1100 Subject: [PATCH] #1083: Add API methods to Vault --- src/main/java/org/bukkit/block/Vault.java | 91 ++++++++++++++++++++++- 1 file changed, 90 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/bukkit/block/Vault.java b/src/main/java/org/bukkit/block/Vault.java index f0c5d27f..ad6b8b66 100644 --- a/src/main/java/org/bukkit/block/Vault.java +++ b/src/main/java/org/bukkit/block/Vault.java @@ -1,10 +1,99 @@ package org.bukkit.block; +import org.bukkit.inventory.ItemStack; +import org.bukkit.loot.LootTable; import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** - * Represents a captured state of a trial spawner. + * Represents a captured state of a vault. */ @ApiStatus.Experimental public interface Vault extends TileState { + + /** + * Gets the distance(squared) at which a player must enter for this vault to + * activate. + * + * @return the distance(squared) at which a player must enter for this vault + * to activate. + */ + double getActivationRange(); + + /** + * Sets the distance(squared) at which a player must enter for this vault to + * activate. + * + * @param range the distance(squared) at which a player must enter for this + * vault to activate. + */ + void setActivationRange(double range); + + /** + * Gets the distance(squared) at which a player must exit for the vault to + * deactivate. + * + * @return the distance(squared) at which a player must exit for the vault + * to deactivate. + */ + double getDeactivationRange(); + + /** + * Sets the distance(squared) at which a player must exit for this vault to + * deactivate. + * + * @param range the distance(squared) at which a player must exit for this + * vault to deactivate. + */ + void setDeactivationRange(double range); + + /** + * Gets the {@link LootTable} this vault will pick rewards from. + * + * @return the loot table + */ + @NotNull + LootTable getLootTable(); + + /** + * Sets the {@link LootTable} this vault will pick rewards from. + * + * @param table the loot table + */ + void setLootTable(@NotNull LootTable table); + + /** + * Gets the {@link LootTable} this vault will display items from.
+ * If this value is null the regular loot table will be used to display + * items. + * + * @return the loot table to display items from + */ + @Nullable + LootTable getDisplayLootTable(); + + /** + * Sets the {@link LootTable} this vault will display items from.
+ * If this value is set to null the regular loot table will be used to + * display items. + * + * @param table the loot table to display items from + */ + void setDisplayLootTable(@Nullable LootTable table); + + /** + * Gets the {@link ItemStack} players must use to unlock this vault. + * + * @return the key item + */ + @NotNull + ItemStack getKeyItem(); + + /** + * Sets the {@link ItemStack} players must use to unlock this vault. + * + * @param keyItem the key item + */ + void setKeyItem(@NotNull ItemStack keyItem); }