Skip to content

Commit 6d26db4

Browse files
Add missing javadoc
1 parent 175aaa7 commit 6d26db4

6 files changed

Lines changed: 50 additions & 3 deletions

File tree

invui/src/main/java/xyz/xenondevs/invui/gui/Structure.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,15 @@ public static void addGlobalIngredientElementSupplier(char key, Supplier<? exten
137137
addGlobalIngredient(key, SlotElementSupplier.fromSupplier(elementSupplier));
138138
}
139139

140+
/**
141+
* Adds a global {@link SlotElementSupplier} ingredient under the given key.
142+
*
143+
* @param key The key of the ingredient
144+
* @param elementSupplier The {@link SlotElementSupplier} ingredient
145+
*/
140146
public static void addGlobalIngredient(char key, SlotElementSupplier elementSupplier) {
141147
if (globalIngredientsFrozen)
142-
throw new IllegalStateException("Global ingredients are frozen");
148+
throw new IllegalStateException("Global ingredients are frozen");
143149
globalIngredientMap.put(key, new Ingredient.Element(elementSupplier));
144150
}
145151

invui/src/main/java/xyz/xenondevs/invui/inventory/Inventory.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
import xyz.xenondevs.invui.gui.Gui;
1414
import xyz.xenondevs.invui.internal.util.ArrayUtils;
1515
import xyz.xenondevs.invui.internal.util.CollectionUtils;
16+
import xyz.xenondevs.invui.util.ObserverAtSlot;
1617
import xyz.xenondevs.invui.inventory.event.InventoryClickEvent;
1718
import xyz.xenondevs.invui.inventory.event.ItemPostUpdateEvent;
1819
import xyz.xenondevs.invui.inventory.event.ItemPreUpdateEvent;
1920
import xyz.xenondevs.invui.inventory.event.UpdateReason;
2021
import xyz.xenondevs.invui.util.ItemUtils;
21-
import xyz.xenondevs.invui.util.ObserverAtSlot;
2222
import xyz.xenondevs.invui.window.Window;
2323

2424
import java.util.*;
@@ -1419,6 +1419,8 @@ private int takeFrom(@Nullable UpdateReason updateReason, int slot, int maxTake)
14191419
}
14201420

14211421
/**
1422+
* Returns this inventory as a Bukkit inventory.
1423+
*
14221424
* @return This inventory as a Bukkit inventory.
14231425
*/
14241426
@ApiStatus.Experimental

invui/src/main/java/xyz/xenondevs/invui/inventory/ReferencingInventory.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.util.function.Function;
2020

2121
// TODO: equals+hashCode for normal referencing inventories
22+
2223
/**
2324
* A {@link xyz.xenondevs.invui.inventory.Inventory} which is backed by a bukkit {@link Inventory}.
2425
* <p>
@@ -190,6 +191,11 @@ public int getUpdatePeriod(int what) {
190191
*/
191192
public static final class PlayerStorageContents extends ReferencingInventory {
192193

194+
/**
195+
* Constructs a new {@link PlayerStorageContents}.
196+
*
197+
* @param inventory The {@link PlayerInventory} to reference.
198+
*/
193199
public PlayerStorageContents(PlayerInventory inventory) {
194200
super(inventory, Inventory::getStorageContents, Inventory::getItem, Inventory::setItem);
195201
}
@@ -247,7 +253,7 @@ public int hashCode() {
247253
@Override
248254
public boolean equals(Object obj) {
249255
return obj instanceof ReferencingInventory.PlayerStorageContents other &&
250-
getReferencedInventory().equals(other.getReferencedInventory());
256+
getReferencedInventory().equals(other.getReferencedInventory());
251257
}
252258
}
253259

invui/src/main/java/xyz/xenondevs/invui/inventory/event/InventoryClickEvent.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public class InventoryClickEvent extends ClickEvent {
2121
* @param inventory The {@link Inventory} that was clicked.
2222
* @param slot The slot that was clicked.
2323
* @param click The {@link Click} that was performed.
24+
* @param action The {@link InventoryAction} of this event, representing the normal outcome of the click.
2425
*/
2526
public InventoryClickEvent(Inventory inventory, int slot, Click click, InventoryAction action) {
2627
super(click);

invui/src/main/java/xyz/xenondevs/invui/item/AbstractItem.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
*/
1212
public abstract class AbstractItem implements Item {
1313

14+
/**
15+
* The observers of this item.
16+
*/
1417
protected final Set<ObserverAtSlot> observers = ConcurrentHashMap.newKeySet();
1518

1619
@Override

invui/src/main/java/xyz/xenondevs/invui/window/MerchantWindow.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,26 @@ static Builder builder() {
9191
@UnmodifiableView
9292
List<Trade> getTrades();
9393

94+
/**
95+
* Adds a handler that is called when the selected trade is changed.
96+
* Receives the old and new selected trade indices.
97+
*
98+
* @param handler The handler
99+
*/
94100
void addTradeSelectHandler(BiConsumer<? super Integer, ? super Integer> handler);
95101

102+
/**
103+
* Removes a handler that is called when the selected trade is changed.
104+
*
105+
* @param handler The handler
106+
*/
96107
void removeTradeSelectHandler(BiConsumer<? super Integer, ? super Integer> handler);
97108

109+
/**
110+
* Sets the handlers that are called when the selected trade is changed.
111+
*
112+
* @param handlers The handlers
113+
*/
98114
void setTradeSelectHandlers(List<? extends BiConsumer<Integer, Integer>> handlers);
99115

100116
@UnmodifiableView
@@ -381,8 +397,21 @@ default Builder setTrades(List<? extends Trade> trades) {
381397
*/
382398
Builder setTrades(MutableProperty<List<? extends Trade>> trades);
383399

400+
/**
401+
* Adds a handler that is called when the selected trade is changed.
402+
* Receives the old and new selected trade indices.
403+
*
404+
* @param handler The handler
405+
* @return This {@link Builder}
406+
*/
384407
Builder addTradeSelectHandler(BiConsumer<? super Integer, ? super Integer> handler);
385408

409+
/**
410+
* Sets the handlers that are called when the selected trade is changed.
411+
*
412+
* @param handlers The handlers
413+
* @return This {@link Builder}
414+
*/
386415
Builder setTradeSelectHandlers(List<? extends BiConsumer<Integer, Integer>> handlers);
387416

388417
}

0 commit comments

Comments
 (0)