Added some javadoc comments

This commit is contained in:
NichtStudioCode 2023-02-26 16:44:07 +01:00
parent e8a6176d75
commit 07d93c2765
9 changed files with 385 additions and 30 deletions

@ -33,7 +33,7 @@ public interface PagedGui<C> extends Gui {
* @return The created {@link PagedGui}.
*/
static @NotNull PagedGui<@NotNull Item> items(@NotNull Consumer<@NotNull Builder<@NotNull Item>> consumer) {
Builder<@NotNull Item> builder = items();
Builder<Item> builder = items();
consumer.accept(builder);
return builder.build();
}
@ -78,7 +78,7 @@ public interface PagedGui<C> extends Gui {
* @return The created {@link PagedGui}.
*/
static @NotNull PagedGui<@NotNull Gui> guis(@NotNull Consumer<@NotNull Builder<@NotNull Gui>> consumer) {
Builder<@NotNull Gui> builder = guis();
Builder<Gui> builder = guis();
consumer.accept(builder);
return builder.build();
}

@ -30,7 +30,7 @@ public interface ScrollGui<C> extends Gui {
* @return The created {@link ScrollGui}.
*/
static @NotNull ScrollGui<@NotNull Item> items(@NotNull Consumer<@NotNull Builder<@NotNull Item>> consumer) {
Builder<@NotNull Item> builder = items();
Builder<Item> builder = items();
consumer.accept(builder);
return builder.build();
}
@ -76,7 +76,7 @@ public interface ScrollGui<C> extends Gui {
* @return The created {@link ScrollGui}.
*/
static @NotNull ScrollGui<@NotNull Gui> guis(@NotNull Consumer<@NotNull Builder<@NotNull Gui>> consumer) {
Builder<@NotNull Gui> builder = guis();
Builder<Gui> builder = guis();
consumer.accept(builder);
return builder.build();
}
@ -122,7 +122,7 @@ public interface ScrollGui<C> extends Gui {
* @return The created {@link ScrollGui}.
*/
static @NotNull ScrollGui<@NotNull VirtualInventory> inventories(@NotNull Consumer<@NotNull Builder<@NotNull VirtualInventory>> consumer) {
Builder<@NotNull VirtualInventory> builder = inventories();
Builder<VirtualInventory> builder = inventories();
consumer.accept(builder);
return builder.build();
}

@ -1,5 +1,7 @@
package xyz.xenondevs.invui.gui.structure;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import xyz.xenondevs.invui.gui.SlotElement;
import java.util.function.Supplier;
@ -10,36 +12,73 @@ class Ingredient {
private final Marker marker;
private final Supplier<? extends SlotElement> elementSupplier;
public Ingredient(SlotElement slotElement) {
/**
* Creates a new {@link Ingredient} of the specified {@link SlotElement}.
*
* @param slotElement The {@link SlotElement}.
*/
public Ingredient(@NotNull SlotElement slotElement) {
this.slotElement = slotElement;
this.elementSupplier = null;
this.marker = null;
}
public Ingredient(Supplier<? extends SlotElement> elementSupplier) {
/**
* Creates a new {@link Ingredient} of the specified {@link SlotElement} {@link Supplier}.
* The {@link Supplier} will be invoked for each slot that the {@link Ingredient} is placed on.
*
* @param elementSupplier The {@link Supplier}.
*/
public Ingredient(@NotNull Supplier<? extends SlotElement> elementSupplier) {
this.elementSupplier = elementSupplier;
this.slotElement = null;
this.marker = null;
}
public Ingredient(Marker marker) {
/**
* Creates a new {@link Ingredient} of the specified {@link Marker}.
*
* @param marker The {@link Marker}.
*/
public Ingredient(@NotNull Marker marker) {
this.marker = marker;
this.slotElement = null;
this.elementSupplier = null;
}
public SlotElement getSlotElement() {
/**
* Gets the {@link SlotElement} of this {@link Ingredient}.
*
* @return The {@link SlotElement} or null if this {@link Ingredient} is a {@link Marker}.
*/
public @Nullable SlotElement getSlotElement() {
return slotElement == null ? elementSupplier.get() : slotElement;
}
public Marker getMarker() {
/**
* Gets the {@link Marker} of this {@link Ingredient}.
*
* @return The {@link Marker} or null if this {@link Ingredient} is a {@link SlotElement} or a {@link Supplier}
* for {@link SlotElement SlotElements}.
*/
public @Nullable Marker getMarker() {
return marker;
}
/**
* Checks if this {@link Ingredient} is a {@link SlotElement} or a {@link Supplier} for {@link SlotElement SlotElements}.
*
* @return Whether this {@link Ingredient} is a {@link SlotElement}.
*/
public boolean isSlotElement() {
return slotElement != null || elementSupplier != null;
}
/**
* Checks if this {@link Ingredient} is a {@link Marker}.
*
* @return Whether this {@link Ingredient} is a {@link Marker}.
*/
public boolean isMarker() {
return marker != null;
}

@ -13,6 +13,14 @@ public class IngredientList extends ArrayList<Ingredient> {
private final int width;
private final int height;
/**
* Creates a new {@link IngredientList}.
*
* @param width The width of the structure.
* @param height The height of the structure.
* @param structure The structure string.
* @param ingredientMap The {@link HashMap} containing the {@link Ingredient Ingredients}.
*/
public IngredientList(int width, int height, String structure, HashMap<Character, Ingredient> ingredientMap) {
this.width = width;
this.height = height;
@ -24,6 +32,11 @@ public class IngredientList extends ArrayList<Ingredient> {
}
}
/**
* Inserts the {@link Ingredient Ingredients} into the specified {@link Gui}.
*
* @param gui The {@link Gui}.
*/
public void insertIntoGui(Gui gui) {
if (size() != gui.getSize())
throw new IllegalArgumentException("Structure size does not match Gui size");
@ -47,7 +60,7 @@ public class IngredientList extends ArrayList<Ingredient> {
}
public List<Integer> findIndicesOfVerticalMarker(Marker marker) {
private List<Integer> findIndicesOfVerticalMarker(Marker marker) {
List<Integer> indices = new ArrayList<>();
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
@ -61,6 +74,12 @@ public class IngredientList extends ArrayList<Ingredient> {
return indices;
}
/**
* Finds all indices of the specified {@link Marker}.
*
* @param marker The {@link Marker}.
* @return The indices.
*/
public int[] findIndicesOfMarker(Marker marker) {
List<Integer> indices;
if (marker.isHorizontal()) {
@ -72,6 +91,11 @@ public class IngredientList extends ArrayList<Ingredient> {
return indices.stream().mapToInt(Integer::intValue).toArray();
}
/**
* Finds all indices of the {@link Markers#CONTENT_LIST_SLOT_HORIZONTAL} and {@link Markers#CONTENT_LIST_SLOT_VERTICAL} {@link Marker Markers}.
*
* @return The indices.
*/
public int[] findContentListSlots() {
return Stream.concat(
findIndicesOfHorizontalMarker(Markers.CONTENT_LIST_SLOT_HORIZONTAL).stream(),

@ -1,5 +1,10 @@
package xyz.xenondevs.invui.gui.structure;
/**
* Used to mark slots in a {@link Structure} as special slots.
*
* @see Markers
*/
public class Marker {
private final boolean horizontal;

@ -1,5 +1,6 @@
package xyz.xenondevs.invui.gui.structure;
import org.jetbrains.annotations.NotNull;
import xyz.xenondevs.invui.gui.AbstractPagedGui;
import xyz.xenondevs.invui.gui.AbstractScrollGui;
import xyz.xenondevs.invui.gui.AbstractTabGui;
@ -13,12 +14,12 @@ public class Markers {
* The marker for horizontal content list slots in {@link AbstractPagedGui PagedGuis},
* {@link AbstractScrollGui ScrollGuis} and {@link AbstractTabGui TabGuis}
*/
public static final Marker CONTENT_LIST_SLOT_HORIZONTAL = new Marker(true);
public static final @NotNull Marker CONTENT_LIST_SLOT_HORIZONTAL = new Marker(true);
/**
* The marker for vertical content list slots in {@link AbstractPagedGui PagedGuis},
* {@link AbstractScrollGui ScrollGuis} and {@link AbstractTabGui TabGuis}
*/
public static final Marker CONTENT_LIST_SLOT_VERTICAL = new Marker(false);
public static final @NotNull Marker CONTENT_LIST_SLOT_VERTICAL = new Marker(false);
}

@ -2,6 +2,7 @@ package xyz.xenondevs.invui.gui.structure;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.ShapedRecipe;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import xyz.xenondevs.invui.gui.Gui;
@ -32,11 +33,24 @@ public class Structure implements Cloneable {
private HashMap<Character, Ingredient> ingredientMap = new HashMap<>();
private IngredientList ingredientList;
public Structure(String... structureData) {
/**
* Sets the {@link Structure} of the {@link Gui} using the given structure data Strings.
* Each String is interpreted as a row of the {@link Gui}. All Strings must have the same length.
*
* @param structureData The structure data
*/
public Structure(@NotNull String @NotNull ... structureData) {
this(sanitize(structureData[0]).length(), structureData.length, String.join("", structureData));
}
public Structure(int width, int height, String structureData) {
/**
* Sets the {@link Structure} of the {@link Gui} using the given structure data, width and height.
*
* @param width The width of the {@link Gui}
* @param height The height of the {@link Gui}
* @param structureData The structure data
*/
public Structure(int width, int height, @NotNull String structureData) {
this.width = width;
this.height = height;
this.structureData = sanitize(structureData);
@ -49,84 +63,219 @@ public class Structure implements Cloneable {
return s.replace(" ", "").replace("\n", "");
}
/**
* Adds a global {@link ItemStack} ingredient under the given key.
* Global ingredients will be used for all {@link Structure Structures} which do not have an ingredient defined for
* that key.
*
* @param key The key of the ingredient
* @param itemStack The {@link ItemStack} ingredient
*/
public static void addGlobalIngredient(char key, @NotNull ItemStack itemStack) {
addGlobalIngredient(key, new ItemWrapper(itemStack));
}
/**
* Adds a global {@link ItemProvider} ingredient under the given key.
* Global ingredients will be used for all {@link Structure Structures} which do not have an ingredient defined for
* that key.
*
* @param key The key of the ingredient
* @param itemProvider The {@link ItemProvider} ingredient
*/
public static void addGlobalIngredient(char key, @NotNull ItemProvider itemProvider) {
addGlobalIngredient(key, new SimpleItem(itemProvider));
}
/**
* Adds a global {@link Item} ingredient under the given key.
* Global ingredients will be used for all {@link Structure Structures} which do not have an ingredient defined for
* that key.
*
* @param key The key of the ingredient
* @param item The {@link Item} ingredient
*/
public static void addGlobalIngredient(char key, @NotNull Item item) {
addGlobalIngredient(key, new ItemSlotElement(item));
}
/**
* Adds a global {@link Item} {@link Supplier} ingredient under the given key.
* Global ingredients will be used for all {@link Structure Structures} which do not have an ingredient defined for
* that key.
*
* @param key The key of the ingredient
* @param itemSupplier The {@link Item} {@link Supplier} ingredient
*/
public static void addGlobalIngredient(char key, @NotNull Supplier<? extends Item> itemSupplier) {
addGlobalIngredientElementSupplier(key, () -> new ItemSlotElement(itemSupplier.get()));
}
/**
* Adds a global {@link SlotElement} ingredient under the given key.
* Global ingredients will be used for all {@link Structure Structures} which do not have an ingredient defined for
* that key.
*
* @param key The key of the ingredient
* @param element The {@link SlotElement} ingredient
*/
public static void addGlobalIngredient(char key, @NotNull SlotElement element) {
globalIngredientMap.put(key, new Ingredient(element));
}
/**
* Adds a global {@link Marker} ingredient under the given key.
* Global ingredients will be used for all {@link Structure Structures} which do not have an ingredient defined for
* that key.
*
* @param key The key of the ingredient
* @param marker The {@link Marker} ingredient
*/
public static void addGlobalIngredient(char key, @NotNull Marker marker) {
globalIngredientMap.put(key, new Ingredient(marker));
}
/**
* Adds a global {@link SlotElement} {@link Supplier} ingredient under the given key.
* Global ingredients will be used for all {@link Structure Structures} which do not have an ingredient defined for
* that key.
*
* @param key The key of the ingredient
* @param elementSupplier The {@link SlotElement} {@link Supplier} ingredient
*/
public static void addGlobalIngredientElementSupplier(char key, @NotNull Supplier<? extends SlotElement> elementSupplier) {
globalIngredientMap.put(key, new Ingredient(elementSupplier));
}
public Structure addIngredient(char key, @NotNull ItemStack itemStack) {
/**
* Adds an {@link ItemStack} ingredient under the given key.
*
* @param key The key of the ingredient
* @param itemStack The {@link ItemStack} ingredient
* @return This {@link Structure}
*/
@Contract("_, _ -> this")
public @NotNull Structure addIngredient(char key, @NotNull ItemStack itemStack) {
if (ingredientList != null) throw new IllegalStateException("Structure is locked");
return addIngredient(key, new ItemWrapper(itemStack));
}
public Structure addIngredient(char key, @NotNull ItemProvider itemProvider) {
/**
* Adds an {@link ItemProvider} ingredient under the given key.
*
* @param key The key of the ingredient
* @param itemProvider The {@link ItemProvider} ingredient
* @return This {@link Structure}
*/
@Contract("_, _ -> this")
public @NotNull Structure addIngredient(char key, @NotNull ItemProvider itemProvider) {
if (ingredientList != null) throw new IllegalStateException("Structure is locked");
return addIngredient(key, new SimpleItem(itemProvider));
}
public Structure addIngredient(char key, @NotNull Item item) {
/**
* Adds an {@link Item} ingredient under the given key.
*
* @param key The key of the ingredient
* @param item The {@link Item} ingredient
* @return This {@link Structure}
*/
@Contract("_, _ -> this")
public @NotNull Structure addIngredient(char key, @NotNull Item item) {
if (ingredientList != null) throw new IllegalStateException("Structure is locked");
return addIngredient(key, new ItemSlotElement(item));
}
public Structure addIngredient(char key, @NotNull VirtualInventory inventory) {
/**
* Adds a {@link VirtualInventory} ingredient under the given key.
*
* @param key The key of the ingredient
* @param inventory The {@link VirtualInventory} ingredient
* @return This {@link Structure}
*/
@Contract("_, _ -> this")
public @NotNull Structure addIngredient(char key, @NotNull VirtualInventory inventory) {
if (ingredientList != null) throw new IllegalStateException("Structure is locked");
return addIngredientElementSupplier(key, new VISlotElementSupplier(inventory));
}
public Structure addIngredient(char key, @NotNull VirtualInventory inventory, @Nullable ItemProvider background) {
/**
* Adds a {@link VirtualInventory} ingredient under the given key.
*
* @param key The key of the ingredient
* @param inventory The {@link VirtualInventory} ingredient
* @param background The background {@link ItemProvider} for the {@link VirtualInventory}
* @return This {@link Structure}
*/
@Contract("_, _, _ -> this")
public @NotNull Structure addIngredient(char key, @NotNull VirtualInventory inventory, @Nullable ItemProvider background) {
if (ingredientList != null) throw new IllegalStateException("Structure is locked");
return addIngredientElementSupplier(key, new VISlotElementSupplier(inventory, background));
}
public Structure addIngredient(char key, @NotNull SlotElement element) {
/**
* Adds a {@link VirtualInventory} ingredient under the given key.
*
* @param key The key of the ingredient
* @param element The {@link SlotElement} ingredient
* @return This {@link Structure}
*/
@Contract("_, _ -> this")
public @NotNull Structure addIngredient(char key, @NotNull SlotElement element) {
if (ingredientList != null) throw new IllegalStateException("Structure is locked");
ingredientMap.put(key, new Ingredient(element));
return this;
}
public Structure addIngredient(char key, @NotNull Marker marker) {
/**
* Adds a {@link Marker} ingredient under the given key.
*
* @param key The key of the ingredient
* @param marker The {@link Marker} ingredient
* @return This {@link Structure}
*/
@Contract("_, _ -> this")
public @NotNull Structure addIngredient(char key, @NotNull Marker marker) {
if (ingredientList != null) throw new IllegalStateException("Structure is locked");
ingredientMap.put(key, new Ingredient(marker));
return this;
}
public Structure addIngredient(char key, @NotNull Supplier<? extends Item> itemSupplier) {
/**
* Adds an {@link ItemStack} {@link Supplier} ingredient under the given key.
*
* @param key The key of the ingredient
* @param itemSupplier The {@link ItemStack} {@link Supplier} ingredient
* @return This {@link Structure}
*/
@Contract("_, _ -> this")
public @NotNull Structure addIngredient(char key, @NotNull Supplier<? extends Item> itemSupplier) {
if (ingredientList != null) throw new IllegalStateException("Structure is locked");
ingredientMap.put(key, new Ingredient(() -> new ItemSlotElement(itemSupplier.get())));
return this;
}
public Structure addIngredientElementSupplier(char key, @NotNull Supplier<? extends SlotElement> elementSupplier) {
/**
* Adds a {@link SlotElement} {@link Supplier} ingredient under the given key.
*
* @param key The key of the ingredient
* @param elementSupplier The {@link SlotElement} {@link Supplier} ingredient
* @return This {@link Structure}
*/
@Contract("_, _ -> this")
public @NotNull Structure addIngredientElementSupplier(char key, @NotNull Supplier<? extends SlotElement> elementSupplier) {
if (ingredientList != null) throw new IllegalStateException("Structure is locked");
ingredientMap.put(key, new Ingredient(elementSupplier));
return this;
}
public IngredientList getIngredientList() {
/**
* Gets the {@link IngredientList} for this {@link Structure}.
* Calling this method will lock the {@link Structure} and prevent further changes.
*
* @return The {@link IngredientList}
*/
public @NotNull IngredientList getIngredientList() {
if (ingredientList != null) return ingredientList;
HashMap<Character, Ingredient> ingredients = new HashMap<>(globalIngredientMap);
@ -134,16 +283,32 @@ public class Structure implements Cloneable {
return ingredientList = new IngredientList(width, height, structureData, ingredients);
}
/**
* Gets the width of this {@link Structure}.
*
* @return The width
*/
public int getWidth() {
return width;
}
/**
* Gets the height of this {@link Structure}.
*
* @return The height
*/
public int getHeight() {
return height;
}
/**
* Clones this {@link Structure}.
*
* @return The cloned {@link Structure}
*/
@Contract(value = "-> new", pure = true)
@Override
public Structure clone() {
public @NotNull Structure clone() {
try {
Structure clone = (Structure) super.clone();
clone.ingredientMap = new HashMap<>(ingredientMap);

@ -4,44 +4,102 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import xyz.xenondevs.invui.gui.Gui;
import java.util.List;
import java.util.function.Consumer;
/**
* A {@link Window} that uses an anvil inventory.
*/
public interface AnvilWindow extends Window {
/**
* Creates a new {@link Builder.Single Window Builder} for a single {@link AnvilWindow}.
* @return The new {@link Builder.Single Window Builder}.
*/
static @NotNull Builder.Single single() {
return new AnvilSingleWindowImpl.BuilderImpl();
}
/**
* Creates a new single {@link AnvilWindow} after configuring a {@link Builder.Single Window Builder} using the given {@link Consumer}.
* @param consumer The {@link Consumer} to configure the {@link Builder.Single Window Builder}.
* @return The created {@link AnvilWindow}.
*/
static @NotNull AnvilWindow single(@NotNull Consumer<Builder.@NotNull Single> consumer) {
Builder.Single builder = single();
consumer.accept(builder);
return builder.build();
}
/**
* Creates a new {@link Builder.Split Window Builder} for a split {@link AnvilWindow}.
* @return The new {@link Builder.Split Window Builder}.
*/
static @NotNull Builder.Split split() {
return new AnvilSplitWindowImpl.BuilderImpl();
}
/**
* Creates a new split {@link AnvilWindow} after configuring a {@link Builder.Split Window Builder} using the given {@link Consumer}.
* @param consumer The {@link Consumer} to configure the {@link Builder.Split Window Builder}.
* @return The created {@link AnvilWindow}.
*/
static @NotNull AnvilWindow split(Consumer<Builder.@NotNull Split> consumer) {
Builder.Split builder = split();
consumer.accept(builder);
return builder.build();
}
/**
* Gets the current rename text.
* @return The current rename text.
*/
@Nullable String getRenameText();
/**
* An {@link AnvilWindow} builder.
* @param <S> The builder type.
*
* @see Window.Builder.Normal
* @see CartographyWindow.Builder
*/
interface Builder<S extends Builder<S>> extends Window.Builder<AnvilWindow, Player, S> {
/**
* Sets the rename handlers of the {@link AnvilWindow}.
* @param renameHandlers The new rename handlers.
* @return The current builder.
*/
@Contract("_ -> this")
@NotNull S setRenameHandlers(@NotNull List<@NotNull Consumer<String>> renameHandlers);
/**
* Adds a rename handler to the {@link AnvilWindow}.
* @param renameHandler The rename handler to add.
* @return The current builder.
*/
@Contract("_ -> this")
@NotNull S addRenameHandler(@NotNull Consumer<String> renameHandler);
/**
* A single {@link AnvilWindow} builder. Combines both {@link AnvilWindow.Builder} and {@link Window.Builder.Single}
* for an {@link AnvilWindow} with only one {@link Gui} that does not access the {@link Player Player's} inventory.
*
* @see Window.Builder.Normal.Single
* @see CartographyWindow.Builder.Single
*/
interface Single extends Builder<Single>, Window.Builder.Single<AnvilWindow, Player, Single> {}
/**
* A split {@link AnvilWindow} builder. Combines both {@link AnvilWindow.Builder} and {@link Window.Builder.Double}
* for an {@link AnvilWindow} with two {@link Gui Guis}, where the lower {@link Gui} is used to fill the
* {@link Player Player's} inventory.
*
* @see Window.Builder.Normal.Split
* @see CartographyWindow.Builder.Split
*/
interface Split extends Builder<Split>, Window.Builder.Double<AnvilWindow, Player, Split> {}
}

@ -5,47 +5,110 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import xyz.xenondevs.inventoryaccess.map.MapIcon;
import xyz.xenondevs.inventoryaccess.map.MapPatch;
import xyz.xenondevs.invui.gui.Gui;
import java.util.List;
import java.util.function.Consumer;
/**
* A {@link Window} that uses a cartography table inventory.
*/
public interface CartographyWindow extends Window {
/**
* Creates a new {@link Builder.Single Window Builder} for a single {@link CartographyWindow}.
*
* @return The new {@link Builder.Single Window Builder}.
*/
static @NotNull Builder.Single single() {
return new CartographySingleWindowImpl.BuilderImpl();
}
/**
* Creates a new single {@link CartographyWindow} after configuring a {@link Builder.Single Window Builder} using the given {@link Consumer}.
*
* @param consumer The {@link Consumer} to configure the {@link Builder.Single Window Builder}.
* @return The created {@link CartographyWindow}.
*/
static @NotNull CartographyWindow single(@NotNull Consumer<Builder.@NotNull Single> consumer) {
Builder.Single builder = single();
consumer.accept(builder);
return builder.build();
}
/**
* Creates a new {@link Builder.Split Window Builder} for a split {@link CartographyWindow}.
*
* @return The new {@link Builder.Split Window Builder}.
*/
static @NotNull Builder.Split split() {
return new CartographySplitWindowImpl.BuilderImpl();
}
/**
* Creates a new split {@link CartographyWindow} after configuring a {@link Builder.Split Window Builder} using the given {@link Consumer}.
*
* @param consumer The {@link Consumer} to configure the {@link Builder.Split Window Builder}.
* @return The created {@link CartographyWindow}.
*/
static @NotNull CartographyWindow split(@NotNull Consumer<Builder.@NotNull Split> consumer) {
Builder.Split builder = split();
consumer.accept(builder);
return builder.build();
}
/**
* Updates the map in the cartography table.
*
* @param patch The {@link MapPatch} to apply to the map.
* @param icons The {@link MapIcon MapIcons} to display on the map.
*/
void updateMap(@Nullable MapPatch patch, @Nullable List<MapIcon> icons);
/**
* Updates the map in the cartography table.
*
* @param patch The {@link MapPatch} to apply to the map.
*/
default void updateMap(@Nullable MapPatch patch) {
updateMap(patch, null);
}
/**
* Updates the map in the cartography table.
*
* @param icons The {@link MapIcon MapIcons} to display on the map.
*/
default void updateMap(@Nullable List<MapIcon> icons) {
updateMap(null, icons);
}
/**
* Resets the map in the cartography table.
*/
void resetMap();
/**
* A {@link CartographyWindow} builder.
*
* @param <S> The builder type.
* @see Window.Builder.Normal
* @see Window.Builder
*/
interface Builder<S extends Builder<S>> extends Window.Builder<CartographyWindow, Player, S> {
/**
* A single {@link CartographyWindow} builder. Combines both {@link CartographyWindow.Builder} an
* {@link Window.Builder.Single} for a {@link CartographyWindow} with only one {@link Gui} that does not
* access the {@link Player Player's} inventory.
*/
interface Single extends Builder<Single>, Window.Builder.Single<CartographyWindow, Player, Single> {}
/**
* A split {@link CartographyWindow} builder. Combines both {@link CartographyWindow.Builder} an
* {@link Window.Builder.Double} for a {@link CartographyWindow} with two {@link Gui Guis}, where the lower
* {@link Gui} is used to fill the {@link Player Player's} inventory.
*/
interface Split extends Builder<Split>, Window.Builder.Double<CartographyWindow, Player, Split> {}
}