diff options
author | md_5 <git@md-5.net> | 2018-08-17 20:40:48 +1000 |
---|---|---|
committer | md_5 <git@md-5.net> | 2018-08-17 20:40:48 +1000 |
commit | f7662d5c9249b90936349d3da43bb0bab089e59e (patch) | |
tree | 8c017e905c2b46ad43e509ae6a32a846be076081 | |
parent | 5d659aa0e44dfb8ec758f910f0a4d0d1dcddd614 (diff) | |
download | bukkit-f7662d5c9249b90936349d3da43bb0bab089e59e.tar bukkit-f7662d5c9249b90936349d3da43bb0bab089e59e.tar.gz bukkit-f7662d5c9249b90936349d3da43bb0bab089e59e.tar.lz bukkit-f7662d5c9249b90936349d3da43bb0bab089e59e.tar.xz bukkit-f7662d5c9249b90936349d3da43bb0bab089e59e.zip |
SPIGOT-4283: Allow setting recipe groups
-rw-r--r-- | src/main/java/org/bukkit/inventory/FurnaceRecipe.java | 23 | ||||
-rw-r--r-- | src/main/java/org/bukkit/inventory/ShapedRecipe.java | 23 | ||||
-rw-r--r-- | src/main/java/org/bukkit/inventory/ShapelessRecipe.java | 24 |
3 files changed, 70 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/inventory/FurnaceRecipe.java b/src/main/java/org/bukkit/inventory/FurnaceRecipe.java index 93696606..75ad4be8 100644 --- a/src/main/java/org/bukkit/inventory/FurnaceRecipe.java +++ b/src/main/java/org/bukkit/inventory/FurnaceRecipe.java @@ -15,6 +15,7 @@ public class FurnaceRecipe implements Recipe, Keyed { private ItemStack ingredient; private float experience; private int cookingTime; + private String group = ""; @Deprecated public FurnaceRecipe(ItemStack result, Material source) { @@ -152,4 +153,26 @@ public class FurnaceRecipe implements Recipe, Keyed { public NamespacedKey getKey() { return key; } + + /** + * Get the group of this recipe. Recipes with the same group may be grouped + * together when displayed in the client. + * + * @return recipe group. An empty string denotes no group. May not be null. + */ + public String getGroup() { + return group; + } + + /** + * Set the group of this recipe. Recipes with the same group may be grouped + * together when displayed in the client. + * + * @param group recipe group. An empty string denotes no group. May not be + * null. + */ + public void setGroup(String group) { + Preconditions.checkArgument(group != null, "group"); + this.group = group; + } } diff --git a/src/main/java/org/bukkit/inventory/ShapedRecipe.java b/src/main/java/org/bukkit/inventory/ShapedRecipe.java index d9af7155..398ac245 100644 --- a/src/main/java/org/bukkit/inventory/ShapedRecipe.java +++ b/src/main/java/org/bukkit/inventory/ShapedRecipe.java @@ -19,6 +19,7 @@ public class ShapedRecipe implements Recipe, Keyed { private final ItemStack output; private String[] rows; private Map<Character, ItemStack> ingredients = new HashMap<Character, ItemStack>(); + private String group = ""; @Deprecated public ShapedRecipe(ItemStack result) { @@ -168,4 +169,26 @@ public class ShapedRecipe implements Recipe, Keyed { public NamespacedKey getKey() { return key; } + + /** + * Get the group of this recipe. Recipes with the same group may be grouped + * together when displayed in the client. + * + * @return recipe group. An empty string denotes no group. May not be null. + */ + public String getGroup() { + return group; + } + + /** + * Set the group of this recipe. Recipes with the same group may be grouped + * together when displayed in the client. + * + * @param group recipe group. An empty string denotes no group. May not be + * null. + */ + public void setGroup(String group) { + Preconditions.checkArgument(group != null, "group"); + this.group = group; + } } diff --git a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java index ca5c09b8..0c340c84 100644 --- a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java +++ b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java @@ -1,5 +1,6 @@ package org.bukkit.inventory; +import com.google.common.base.Preconditions; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -19,6 +20,7 @@ public class ShapelessRecipe implements Recipe, Keyed { private final NamespacedKey key; private final ItemStack output; private final List<ItemStack> ingredients = new ArrayList<ItemStack>(); + private String group = ""; @Deprecated public ShapelessRecipe(ItemStack result) { @@ -239,4 +241,26 @@ public class ShapelessRecipe implements Recipe, Keyed { public NamespacedKey getKey() { return key; } + + /** + * Get the group of this recipe. Recipes with the same group may be grouped + * together when displayed in the client. + * + * @return recipe group. An empty string denotes no group. May not be null. + */ + public String getGroup() { + return group; + } + + /** + * Set the group of this recipe. Recipes with the same group may be grouped + * together when displayed in the client. + * + * @param group recipe group. An empty string denotes no group. May not be + * null. + */ + public void setGroup(String group) { + Preconditions.checkArgument(group != null, "group"); + this.group = group; + } } |