From 908823c612c741e8ffd2005b20282b73fee2b2e0 Mon Sep 17 00:00:00 2001 From: EnZaXD <60033407+FlorianMichael@users.noreply.github.com> Date: Tue, 5 Mar 2024 23:23:57 +0100 Subject: [PATCH] Make ItemRewriter type getters nullable and optional (#3737) --- .../viaversion/api/rewriter/ItemRewriter.java | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/api/src/main/java/com/viaversion/viaversion/api/rewriter/ItemRewriter.java b/api/src/main/java/com/viaversion/viaversion/api/rewriter/ItemRewriter.java index 2dd5110a5..7fb84a34c 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/rewriter/ItemRewriter.java +++ b/api/src/main/java/com/viaversion/viaversion/api/rewriter/ItemRewriter.java @@ -45,11 +45,35 @@ public interface ItemRewriter extends Rewriter { */ @Nullable Item handleItemToServer(@Nullable Item item); - Type itemType(); + /** + * Returns the item type of the current protocol. + * @return item type + */ + @Nullable default Type itemType() { + return null; + } - Type itemArrayType(); + /** + * Returns the item array type of the current protocol. + * @return item array type + */ + @Nullable default Type itemArrayType() { + return null; + } - Type mappedItemType(); + /** + * Returns the mapped item type of the target protocol. + * @return mapped item type + */ + @Nullable default Type mappedItemType() { + return itemType(); + } - Type mappedItemArrayType(); + /** + * Returns the mapped item array type of the target protocol. + * @return mapped item array type + */ + @Nullable default Type mappedItemArrayType() { + return itemArrayType(); + } }