Delombok 6/? - Delomboked items, GUIs, recipes, and tuples

This commit is contained in:
Auxilor
2021-11-10 18:56:12 +00:00
parent b244be6dd6
commit dbe514f97c
11 changed files with 182 additions and 35 deletions

View File

@@ -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<List<Slot>> 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<List<Slot>> getMask() {
return this.mask;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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<ItemStack> 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<ItemStack> getTest() {
return this.test;
}
}

View File

@@ -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;
}
}

View File

@@ -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<EcoPlugin> imple
/**
* Recipe parts.
*/
@Getter
private final List<TestableItem> 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<EcoPlugin> imple
return new Builder(plugin, key);
}
/**
* Get the parts.
*
* @return The parts.
*/
public List<TestableItem> 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.
*/

View File

@@ -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<A, B> {
/**
* 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<A, B> {
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;
}
}

View File

@@ -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<A, B, C> extends Pair<A, B> {
/**
* The third item in the tuple.
*/
@Getter
@Setter
@Nullable
private C third;
@@ -45,4 +41,22 @@ public class Triplet<A, B, C> extends Pair<A, B> {
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;
}
}

View File

@@ -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;
}
}