Skip to content

Commit 4d49bcf

Browse files
committed
Add api version to javadocs and fix minor formating
1 parent a9ae11e commit 4d49bcf

4 files changed

Lines changed: 100 additions & 5 deletions

File tree

src/main/java/org/mvplugins/multiverse/inventories/profile/InventoryDataProvider.java

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import org.bukkit.OfflinePlayer;
55
import org.bukkit.entity.Player;
66
import org.bukkit.inventory.ItemStack;
7+
import org.jetbrains.annotations.ApiStatus;
78
import org.jvnet.hk2.annotations.Service;
89
import org.mvplugins.multiverse.external.jakarta.inject.Inject;
910
import org.mvplugins.multiverse.external.jetbrains.annotations.NotNull;
@@ -25,7 +26,10 @@
2526
/**
2627
* Provides methods for asynchronously loading player inventory data.
2728
* This class encapsulates the business logic for fetching inventory, armor, and off-hand contents.
29+
*
30+
* @since 5.2
2831
*/
32+
@ApiStatus.AvailableSince("5.2")
2933
@Service
3034
public final class InventoryDataProvider {
3135

@@ -43,14 +47,28 @@ public InventoryDataProvider(
4347

4448
/**
4549
* Represents the loaded inventory data.
50+
*
51+
* @since 5.2
4652
*/
53+
@ApiStatus.AvailableSince("5.2")
4754
public static class PlayerInventoryData {
4855
public final ItemStack[] contents;
4956
public final ItemStack[] armor;
5057
public final ItemStack offHand;
5158
public final String statusMessage; // To indicate if it's live or stored data
5259
public final ProfileType profileTypeUsed; // To pass back which profile type was used for stored data
5360

61+
/**
62+
*
63+
* @param contents
64+
* @param armor
65+
* @param offHand
66+
* @param statusMessage
67+
* @param profileTypeUsed
68+
*
69+
* @since 5.2
70+
*/
71+
@ApiStatus.AvailableSince("5.2")
5472
public PlayerInventoryData(ItemStack[] contents, ItemStack[] armor, ItemStack offHand, String statusMessage, ProfileType profileTypeUsed) {
5573
this.contents = contents;
5674
this.armor = armor;
@@ -68,7 +86,10 @@ public PlayerInventoryData(ItemStack[] contents, ItemStack[] armor, ItemStack of
6886
* @param targetPlayer The OfflinePlayer whose inventory data to load.
6987
* @param worldName The name of the world to load the inventory from (either live or stored).
7088
* @return A CompletableFuture that will complete with PlayerInventoryData or an exception.
89+
*
90+
* @since 5.2
7191
*/
92+
@ApiStatus.AvailableSince("5.2")
7293
public CompletableFuture<PlayerInventoryData> loadPlayerInventoryData(
7394
@NotNull OfflinePlayer targetPlayer,
7495
@NotNull String worldName
@@ -135,7 +156,6 @@ public CompletableFuture<PlayerInventoryData> loadPlayerInventoryData(
135156
});
136157
}
137158

138-
139159
/**
140160
* Asynchronously saves a player's inventory data to their Multiverse-Inventories profile.
141161
* If the player is online and in the target world, their live inventory is also updated.
@@ -147,7 +167,10 @@ public CompletableFuture<PlayerInventoryData> loadPlayerInventoryData(
147167
* @param newArmor The new armor contents (helmet, chestplate, leggings, boots).
148168
* @param newOffHand The new off-hand item.
149169
* @return A CompletableFuture that completes when saving is done, or an exception occurs.
170+
*
171+
* @since 5.2
150172
*/
173+
@ApiStatus.AvailableSince("5.2")
151174
public CompletableFuture<Void> savePlayerInventoryData(
152175
@NotNull OfflinePlayer targetPlayer,
153176
@NotNull String worldName,
@@ -198,4 +221,4 @@ public CompletableFuture<Void> savePlayerInventoryData(
198221
return null;
199222
});
200223
}
201-
}
224+
}

src/main/java/org/mvplugins/multiverse/inventories/view/InventoryGUIHelper.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import org.bukkit.inventory.ItemStack;
88
import org.bukkit.inventory.meta.ItemMeta;
99
import org.bukkit.persistence.PersistentDataType;
10+
import org.jetbrains.annotations.ApiStatus;
1011
import org.jetbrains.annotations.NotNull;
1112
import org.jvnet.hk2.annotations.Service;
1213
import org.mvplugins.multiverse.external.jakarta.inject.Inject;
@@ -17,7 +18,10 @@
1718
/**
1819
* A helper class for creating and validating items within the custom inventory GUIs.
1920
* This centralizes logic for filler items and slot-specific item validation.
21+
*
22+
* @since 5.2
2023
*/
24+
@ApiStatus.AvailableSince("5.2")
2125
@Service
2226
public final class InventoryGUIHelper {
2327

@@ -27,13 +31,18 @@ public final class InventoryGUIHelper {
2731
public InventoryGUIHelper(@NotNull MultiverseInventories inventories) {
2832
this.IS_FILLER_KEY = new NamespacedKey(inventories, "is_mvinv_filler");
2933
}
34+
3035
/**
3136
* Creates a generic filler item for GUI slots.
37+
*
3238
* @param material The material of the filler item.
3339
* @param name The display name of the item.
3440
* @param lore The lore text for the item.
3541
* @return The created ItemStack.
42+
*
43+
* @since 5.2
3644
*/
45+
@ApiStatus.AvailableSince("5.2")
3746
public ItemStack createFillerItem(Material material, String name, String lore) {
3847
ItemStack item = new ItemStack(material);
3948
ItemMeta meta = item.getItemMeta();
@@ -48,9 +57,13 @@ public ItemStack createFillerItem(Material material, String name, String lore) {
4857

4958
/**
5059
* Checks if a given ItemStack is a filler item created by this helper.
60+
*
5161
* @param item The ItemStack to check.
5262
* @return True if the item is a filler, false otherwise.
63+
*
64+
* @since 5.2
5365
*/
66+
@ApiStatus.AvailableSince("5.2")
5467
public boolean isFillerItem(@NotNull ItemStack item) {
5568
if (!item.hasItemMeta()) {
5669
return false;
@@ -62,10 +75,14 @@ public boolean isFillerItem(@NotNull ItemStack item) {
6275
/**
6376
* Determines if an ItemStack is valid for a given special inventory slot in the custom GUI.
6477
* This method is used for both armor and off-hand slot validation.
78+
*
6579
* @param item The ItemStack to check.
6680
* @param slot The raw slot number (36-40 for armor/off-hand).
6781
* @return True if the item is valid for the slot, false otherwise.
82+
*
83+
* @since 5.2
6884
*/
85+
@ApiStatus.AvailableSince("5.2")
6986
public boolean isValidItemForSlot(@NotNull ItemStack item, int slot) {
7087
if (item.getType() == Material.AIR) {
7188
return true; // Air is always valid (it means the slot is empty)
@@ -101,9 +118,13 @@ public boolean isValidItemForSlot(@NotNull ItemStack item, int slot) {
101118

102119
/**
103120
* Creates the appropriate filler item for a given special slot in the custom GUI.
121+
*
104122
* @param slot The raw slot number (36-40).
105123
* @return The specific filler ItemStack for that slot.
124+
*
125+
* @since 5.2
106126
*/
127+
@ApiStatus.AvailableSince("5.2")
107128
public ItemStack createFillerItemForSlot(int slot) {
108129
switch (slot) {
109130
case 36: return createFillerItem(Material.GRAY_STAINED_GLASS_PANE, "Helmet Slot", "Place Helmet Here");

src/main/java/org/mvplugins/multiverse/inventories/view/ModifiableInventoryHolder.java

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import org.bukkit.OfflinePlayer;
44
import org.bukkit.inventory.Inventory;
55
import org.bukkit.inventory.InventoryHolder;
6+
import org.jetbrains.annotations.ApiStatus;
67
import org.jetbrains.annotations.NotNull;
78
import org.mvplugins.multiverse.inventories.MultiverseInventories;
89
import org.mvplugins.multiverse.inventories.profile.key.ProfileType;
@@ -11,13 +12,26 @@
1112
* A custom InventoryHolder that serves as a marker for modifiable inventories.
1213
* It stores the necessary context (player, world, profile type, plugin instance)
1314
* to save changes back to the player's profile when the inventory is closed.
15+
*
16+
* @since 5.2
1417
*/
18+
@ApiStatus.AvailableSince("5.2")
1519
public final class ModifiableInventoryHolder implements InventoryHolder {
1620
private final OfflinePlayer targetPlayer;
1721
private final String worldName;
1822
private final ProfileType profileType;
1923
private final MultiverseInventories inventories;
2024

25+
/**
26+
*
27+
* @param targetPlayer
28+
* @param worldName
29+
* @param profileType
30+
* @param inventories
31+
*
32+
* @since 5.2
33+
*/
34+
@ApiStatus.AvailableSince("5.2")
2135
public ModifiableInventoryHolder(@NotNull OfflinePlayer targetPlayer,
2236
@NotNull String worldName,
2337
@NotNull ProfileType profileType,
@@ -28,26 +42,57 @@ public ModifiableInventoryHolder(@NotNull OfflinePlayer targetPlayer,
2842
this.inventories = inventories;
2943
}
3044

45+
/**
46+
*
47+
* @return
48+
*
49+
* @since 5.2
50+
*/
51+
@ApiStatus.AvailableSince("5.2")
3152
public @NotNull OfflinePlayer getTargetPlayer() {
3253
return targetPlayer;
3354
}
3455

56+
/**
57+
*
58+
* @return
59+
*
60+
* @since 5.2
61+
*/
62+
@ApiStatus.AvailableSince("5.2")
3563
public @NotNull String getWorldName() {
3664
return worldName;
3765
}
3866

67+
/**
68+
*
69+
* @return
70+
*
71+
* @since 5.2
72+
*/
73+
@ApiStatus.AvailableSince("5.2")
3974
public @NotNull ProfileType getProfileType() {
4075
return profileType;
4176
}
4277

78+
/**
79+
*
80+
* @return
81+
*
82+
* @since 5.2
83+
*/
84+
@ApiStatus.AvailableSince("5.2")
4385
public @NotNull MultiverseInventories getInventories() {
4486
return inventories;
4587
}
4688

89+
/**
90+
* {@inheritDoc}
91+
*/
4792
@Override
4893
public @NotNull Inventory getInventory() {
4994
// This method is required by the interface but is not directly used for the marker purpose.
5095
// Throwing UnsupportedOperationException clearly indicates it's not meant to be called.
5196
throw new UnsupportedOperationException("ModifiableInventoryHolder does not provide an Inventory directly.");
5297
}
53-
}
98+
}

src/main/java/org/mvplugins/multiverse/inventories/view/ReadOnlyInventoryHolder.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,24 @@
22

33
import org.bukkit.inventory.Inventory;
44
import org.bukkit.inventory.InventoryHolder;
5+
import org.jetbrains.annotations.ApiStatus;
56
import org.jetbrains.annotations.NotNull;
67

78
/**
89
* A custom InventoryHolder that serves as a marker for read-only inventories.
910
* Inventories created with this holder will have their interactions cancelled by the InventoryViewListener.
11+
*
12+
* @since 5.2
1013
*/
14+
@ApiStatus.AvailableSince("5.2")
1115
public final class ReadOnlyInventoryHolder implements InventoryHolder {
12-
16+
/**
17+
* {@inheritDoc}
18+
*/
1319
@Override
1420
public @NotNull Inventory getInventory() {
1521
// This method is required by the interface but is not directly used for the marker purpose.
1622
// Throwing UnsupportedOperationException clearly indicates it's not meant to be called.
1723
throw new UnsupportedOperationException("ReadOnlyInventoryHolder does not provide an Inventory directly.");
1824
}
19-
}
25+
}

0 commit comments

Comments
 (0)