From dbe514f97cd152c644e4c4d88430757796d2db27 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Wed, 10 Nov 2021 18:56:12 +0000 Subject: [PATCH] Delombok 6/? - Delomboked items, GUIs, recipes, and tuples --- .../willfp/eco/core/gui/slot/FillerMask.java | 13 ++++-- .../willfp/eco/core/gui/slot/FillerSlot.java | 11 ++++- .../com/willfp/eco/core/items/CustomItem.java | 11 ++++- .../eco/core/items/provider/ItemProvider.java | 11 ++++- .../recipe/parts/MaterialTestableItem.java | 11 ++++- .../recipe/parts/ModifiedTestableItem.java | 21 ++++++++-- .../eco/core/recipe/parts/TestableStack.java | 21 ++++++++-- .../recipe/recipes/ShapedCraftingRecipe.java | 41 +++++++++++++++--- .../java/com/willfp/eco/core/tuples/Pair.java | 42 ++++++++++++++++--- .../com/willfp/eco/core/tuples/Triplet.java | 22 ++++++++-- .../java/com/willfp/eco/core/web/Paste.java | 13 ++++-- 11 files changed, 182 insertions(+), 35 deletions(-) diff --git a/eco-api/src/main/java/com/willfp/eco/core/gui/slot/FillerMask.java b/eco-api/src/main/java/com/willfp/eco/core/gui/slot/FillerMask.java index cf052b15..9c55c401 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/gui/slot/FillerMask.java +++ b/eco-api/src/main/java/com/willfp/eco/core/gui/slot/FillerMask.java @@ -2,7 +2,6 @@ package com.willfp.eco.core.gui.slot; import com.willfp.eco.core.items.builder.ItemStackBuilder; import com.willfp.eco.util.ListUtils; -import lombok.Getter; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; @@ -29,7 +28,6 @@ public class FillerMask { /** * Mask. */ - @Getter private final List> mask; /** @@ -47,7 +45,7 @@ public class FillerMask { * Create a new filler mask. * * @param materials The mask materials. - * @param pattern The pattern. + * @param pattern The pattern. */ public FillerMask(@NotNull final MaskMaterials materials, @NotNull final String... pattern) { @@ -82,4 +80,13 @@ public class FillerMask { } } } + + /** + * Get the mask. + * + * @return The mask. + */ + public List> getMask() { + return this.mask; + } } diff --git a/eco-api/src/main/java/com/willfp/eco/core/gui/slot/FillerSlot.java b/eco-api/src/main/java/com/willfp/eco/core/gui/slot/FillerSlot.java index d282c554..807e7a40 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/gui/slot/FillerSlot.java +++ b/eco-api/src/main/java/com/willfp/eco/core/gui/slot/FillerSlot.java @@ -1,6 +1,5 @@ package com.willfp.eco.core.gui.slot; -import lombok.Getter; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; @@ -14,7 +13,6 @@ public class FillerSlot implements Slot { /** * The ItemStack. */ - @Getter private final ItemStack itemStack; /** @@ -35,4 +33,13 @@ public class FillerSlot implements Slot { public boolean isCaptive() { return false; } + + /** + * Get the ItemStack. + * + * @return The ItemStack. + */ + public ItemStack getItemStack() { + return this.itemStack; + } } diff --git a/eco-api/src/main/java/com/willfp/eco/core/items/CustomItem.java b/eco-api/src/main/java/com/willfp/eco/core/items/CustomItem.java index 4c36fbe8..e70e23a0 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/items/CustomItem.java +++ b/eco-api/src/main/java/com/willfp/eco/core/items/CustomItem.java @@ -1,7 +1,6 @@ package com.willfp.eco.core.items; import com.willfp.eco.core.Eco; -import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -23,7 +22,6 @@ public class CustomItem implements TestableItem { /** * The key. */ - @Getter private final NamespacedKey key; /** @@ -77,4 +75,13 @@ public class CustomItem implements TestableItem { public void register() { Items.registerCustomItem(this.getKey(), this); } + + /** + * Get the key. + * + * @return The key. + */ + public NamespacedKey getKey() { + return this.key; + } } diff --git a/eco-api/src/main/java/com/willfp/eco/core/items/provider/ItemProvider.java b/eco-api/src/main/java/com/willfp/eco/core/items/provider/ItemProvider.java index 675f8f2e..34a2776b 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/items/provider/ItemProvider.java +++ b/eco-api/src/main/java/com/willfp/eco/core/items/provider/ItemProvider.java @@ -1,7 +1,6 @@ package com.willfp.eco.core.items.provider; import com.willfp.eco.core.items.TestableItem; -import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -17,7 +16,6 @@ public abstract class ItemProvider { /** * The namespace. */ - @Getter private final String namespace; /** @@ -37,4 +35,13 @@ public abstract class ItemProvider { */ @Nullable public abstract TestableItem provideForKey(@NotNull String key); + + /** + * Get the namespace. + * + * @return The namespace. + */ + public String getNamespace() { + return this.namespace; + } } diff --git a/eco-api/src/main/java/com/willfp/eco/core/recipe/parts/MaterialTestableItem.java b/eco-api/src/main/java/com/willfp/eco/core/recipe/parts/MaterialTestableItem.java index 718a0eea..a791f05e 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/recipe/parts/MaterialTestableItem.java +++ b/eco-api/src/main/java/com/willfp/eco/core/recipe/parts/MaterialTestableItem.java @@ -1,7 +1,6 @@ package com.willfp.eco.core.recipe.parts; import com.willfp.eco.core.items.TestableItem; -import lombok.Getter; import org.apache.commons.lang.Validate; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; @@ -15,7 +14,6 @@ public class MaterialTestableItem implements TestableItem { /** * The material. */ - @Getter private final Material material; /** @@ -44,4 +42,13 @@ public class MaterialTestableItem implements TestableItem { public ItemStack getItem() { return new ItemStack(material); } + + /** + * Get the material. + * + * @return The material. + */ + public Material getMaterial() { + return this.material; + } } diff --git a/eco-api/src/main/java/com/willfp/eco/core/recipe/parts/ModifiedTestableItem.java b/eco-api/src/main/java/com/willfp/eco/core/recipe/parts/ModifiedTestableItem.java index c4cbb48c..0baeb9d9 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/recipe/parts/ModifiedTestableItem.java +++ b/eco-api/src/main/java/com/willfp/eco/core/recipe/parts/ModifiedTestableItem.java @@ -1,7 +1,6 @@ package com.willfp.eco.core.recipe.parts; import com.willfp.eco.core.items.TestableItem; -import lombok.Getter; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -17,13 +16,11 @@ public class ModifiedTestableItem implements TestableItem { /** * The item. */ - @Getter private final TestableItem handle; /** * The amount. */ - @Getter private final Predicate test; /** @@ -61,4 +58,22 @@ public class ModifiedTestableItem implements TestableItem { public ItemStack getItem() { return example; } + + /** + * Get the handle. + * + * @return The handle. + */ + public TestableItem getHandle() { + return this.handle; + } + + /** + * Get the test. + * + * @return The test. + */ + public Predicate getTest() { + return this.test; + } } diff --git a/eco-api/src/main/java/com/willfp/eco/core/recipe/parts/TestableStack.java b/eco-api/src/main/java/com/willfp/eco/core/recipe/parts/TestableStack.java index ae3154a1..d0313c51 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/recipe/parts/TestableStack.java +++ b/eco-api/src/main/java/com/willfp/eco/core/recipe/parts/TestableStack.java @@ -1,7 +1,6 @@ package com.willfp.eco.core.recipe.parts; import com.willfp.eco.core.items.TestableItem; -import lombok.Getter; import org.apache.commons.lang.Validate; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; @@ -14,13 +13,11 @@ public class TestableStack implements TestableItem { /** * The item. */ - @Getter private final TestableItem handle; /** * The amount. */ - @Getter private final int amount; /** @@ -55,4 +52,22 @@ public class TestableStack implements TestableItem { temp.setAmount(amount); return temp; } + + /** + * Get the handle. + * + * @return The handle. + */ + public TestableItem getHandle() { + return this.handle; + } + + /** + * Get the amount in the stack. + * + * @return The amount. + */ + public int getAmount() { + return this.amount; + } } diff --git a/eco-api/src/main/java/com/willfp/eco/core/recipe/recipes/ShapedCraftingRecipe.java b/eco-api/src/main/java/com/willfp/eco/core/recipe/recipes/ShapedCraftingRecipe.java index f33e024d..952e9206 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/recipe/recipes/ShapedCraftingRecipe.java +++ b/eco-api/src/main/java/com/willfp/eco/core/recipe/recipes/ShapedCraftingRecipe.java @@ -7,7 +7,6 @@ import com.willfp.eco.core.items.TestableItem; import com.willfp.eco.core.recipe.Recipes; import com.willfp.eco.core.recipe.parts.EmptyTestableItem; import com.willfp.eco.core.recipe.parts.TestableStack; -import lombok.Getter; import org.bukkit.Bukkit; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -27,25 +26,21 @@ public final class ShapedCraftingRecipe extends PluginDependent imple /** * Recipe parts. */ - @Getter private final List parts; /** * The key of the recipe. */ - @Getter private final NamespacedKey key; /** * The key of the displayed recipe. */ - @Getter private final NamespacedKey displayedKey; /** * The recipe's output. */ - @Getter private final ItemStack output; private ShapedCraftingRecipe(@NotNull final EcoPlugin plugin, @@ -133,6 +128,42 @@ public final class ShapedCraftingRecipe extends PluginDependent imple return new Builder(plugin, key); } + /** + * Get the parts. + * + * @return The parts. + */ + public List getParts() { + return this.parts; + } + + /** + * Get the key. + * + * @return The key. + */ + public NamespacedKey getKey() { + return this.key; + } + + /** + * Get the displayed key. + * + * @return The displayed key. + */ + public NamespacedKey getDisplayedKey() { + return this.displayedKey; + } + + /** + * Get the output. + * + * @return The output. + */ + public ItemStack getOutput() { + return this.output; + } + /** * Builder for recipes. */ diff --git a/eco-api/src/main/java/com/willfp/eco/core/tuples/Pair.java b/eco-api/src/main/java/com/willfp/eco/core/tuples/Pair.java index d4ecd5f1..faae1a32 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/tuples/Pair.java +++ b/eco-api/src/main/java/com/willfp/eco/core/tuples/Pair.java @@ -1,7 +1,5 @@ package com.willfp.eco.core.tuples; -import lombok.Getter; -import lombok.Setter; import org.jetbrains.annotations.Nullable; /** @@ -14,16 +12,12 @@ public class Pair { /** * The first item in the tuple. */ - @Getter - @Setter @Nullable private A first; /** * The second item in the tuple. */ - @Getter - @Setter @Nullable private B second; @@ -60,4 +54,40 @@ public class Pair { public B component2() { return second; } + + /** + * Get the first member of the tuple. + * + * @return The first member. + */ + public @Nullable A getFirst() { + return this.first; + } + + /** + * Get the second member of the tuple. + * + * @return The second member. + */ + public @Nullable B getSecond() { + return this.second; + } + + /** + * Set the first member of the tuple. + * + * @param first The data to set. + */ + public void setFirst(@Nullable final A first) { + this.first = first; + } + + /** + * Set the second member of the tuple. + * + * @param second The data to set. + */ + public void setSecond(@Nullable final B second) { + this.second = second; + } } diff --git a/eco-api/src/main/java/com/willfp/eco/core/tuples/Triplet.java b/eco-api/src/main/java/com/willfp/eco/core/tuples/Triplet.java index 1254a88c..15230f7c 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/tuples/Triplet.java +++ b/eco-api/src/main/java/com/willfp/eco/core/tuples/Triplet.java @@ -1,7 +1,5 @@ package com.willfp.eco.core.tuples; -import lombok.Getter; -import lombok.Setter; import org.jetbrains.annotations.Nullable; /** @@ -15,8 +13,6 @@ public class Triplet extends Pair { /** * The third item in the tuple. */ - @Getter - @Setter @Nullable private C third; @@ -45,4 +41,22 @@ public class Triplet extends Pair { public C component3() { return third; } + + /** + * Get the third member of the tuple. + * + * @return The third. + */ + public @Nullable C getThird() { + return this.third; + } + + /** + * Set the third member of the tuple. + * + * @param third The data to set. + */ + public void setThird(@Nullable final C third) { + this.third = third; + } } diff --git a/eco-api/src/main/java/com/willfp/eco/core/web/Paste.java b/eco-api/src/main/java/com/willfp/eco/core/web/Paste.java index 692fc6cb..a9356484 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/web/Paste.java +++ b/eco-api/src/main/java/com/willfp/eco/core/web/Paste.java @@ -1,7 +1,6 @@ package com.willfp.eco.core.web; import com.willfp.eco.core.Eco; -import lombok.Getter; import org.jetbrains.annotations.NotNull; import javax.net.ssl.HttpsURLConnection; @@ -23,7 +22,6 @@ public class Paste { /** * The contents. */ - @Getter private final String contents; /** @@ -93,7 +91,7 @@ public class Paste { conn.setRequestMethod("GET"); try (var reader = new BufferedReader( new InputStreamReader(conn.getInputStream()))) { - for (String line; (line = reader.readLine()) != null;) { + for (String line; (line = reader.readLine()) != null; ) { result.append(line); } } @@ -104,4 +102,13 @@ public class Paste { return null; } + + /** + * Get the contents. + * + * @return The contents. + */ + public String getContents() { + return this.contents; + } }