diff --git a/eco-api/src/main/java/com/willfp/eco/util/bukkit/scheduling/EcoBukkitRunnable.java b/eco-api/src/main/java/com/willfp/eco/internal/bukkit/events/EcoRunnableTask.java similarity index 56% rename from eco-api/src/main/java/com/willfp/eco/util/bukkit/scheduling/EcoBukkitRunnable.java rename to eco-api/src/main/java/com/willfp/eco/internal/bukkit/events/EcoRunnableTask.java index dccfb2ac..62001c6b 100644 --- a/eco-api/src/main/java/com/willfp/eco/util/bukkit/scheduling/EcoBukkitRunnable.java +++ b/eco-api/src/main/java/com/willfp/eco/internal/bukkit/events/EcoRunnableTask.java @@ -1,26 +1,28 @@ -package com.willfp.eco.util.bukkit.scheduling; +package com.willfp.eco.internal.bukkit.events; +import com.willfp.eco.util.bukkit.scheduling.RunnableFactory; +import com.willfp.eco.util.bukkit.scheduling.RunnableTask; import com.willfp.eco.util.plugin.EcoPlugin; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitTask; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; -public abstract class EcoBukkitRunnable extends BukkitRunnable { +public abstract class EcoRunnableTask extends BukkitRunnable implements RunnableTask { /** * The linked {@link EcoPlugin} to associate runnables with. */ private final EcoPlugin plugin; /** - * Creates a new {@link EcoBukkitRunnable}. + * Creates a new {@link EcoRunnableTask}. *

* Cannot be instantiated normally, use {@link RunnableFactory}. * * @param plugin The {@link EcoPlugin} to associate runnables with. */ @ApiStatus.Internal - EcoBukkitRunnable(@NotNull final EcoPlugin plugin) { + public EcoRunnableTask(@NotNull final EcoPlugin plugin) { this.plugin = plugin; } @@ -33,67 +35,37 @@ public abstract class EcoBukkitRunnable extends BukkitRunnable { return this.plugin; } - /** - * Run the task. - * - * @return The created {@link BukkitTask}. - */ + @Override @NotNull public final synchronized BukkitTask runTask() { return super.runTask(plugin); } - /** - * Run the task asynchronously. - * - * @return The created {@link BukkitTask} - */ + @Override @NotNull public final synchronized BukkitTask runTaskAsynchronously() { return super.runTaskAsynchronously(plugin); } - /** - * Run the task after a specified number of ticks. - * - * @param delay The number of ticks to wait. - * @return The created {@link BukkitTask} - */ + @Override @NotNull public final synchronized BukkitTask runTaskLater(final long delay) { return super.runTaskLater(plugin, delay); } - /** - * Run the task asynchronously after a specified number of ticks. - * - * @param delay The number of ticks to wait. - * @return The created {@link BukkitTask} - */ + @Override @NotNull public final synchronized BukkitTask runTaskLaterAsynchronously(final long delay) { return super.runTaskLaterAsynchronously(plugin, delay); } - /** - * Run the task repeatedly on a timer. - * - * @param delay The delay before the task is first ran (in ticks). - * @param period The ticks elapsed before the task is ran again. - * @return The created {@link BukkitTask} - */ + @Override @NotNull public final synchronized BukkitTask runTaskTimer(final long delay, final long period) { return super.runTaskTimer(plugin, delay, period); } - /** - * Run the task repeatedly on a timer asynchronously. - * - * @param delay The delay before the task is first ran (in ticks). - * @param period The ticks elapsed before the task is ran again. - * @return The created {@link BukkitTask} - */ + @Override @NotNull public final synchronized BukkitTask runTaskTimerAsynchronously(final long delay, final long period) { return super.runTaskTimerAsynchronously(plugin, delay, period); diff --git a/eco-api/src/main/java/com/willfp/eco/internal/config/ConfigWrapper.java b/eco-api/src/main/java/com/willfp/eco/internal/config/ConfigWrapper.java index a01919f5..1623f145 100644 --- a/eco-api/src/main/java/com/willfp/eco/internal/config/ConfigWrapper.java +++ b/eco-api/src/main/java/com/willfp/eco/internal/config/ConfigWrapper.java @@ -1,11 +1,10 @@ package com.willfp.eco.internal.config; -import com.willfp.eco.util.SerializationUtils; import com.willfp.eco.util.StringUtils; import com.willfp.eco.util.config.Config; -import com.willfp.eco.util.serialization.EcoSerializable; import lombok.AccessLevel; import lombok.Getter; +import org.apache.commons.lang.Validate; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.MemorySection; import org.jetbrains.annotations.NotNull; @@ -17,7 +16,7 @@ import java.util.List; import java.util.Map; import java.util.Objects; -@SuppressWarnings({"unchecked", "unused", "DeprecatedIsStillUsed"}) +@SuppressWarnings({"unchecked", "unused"}) public abstract class ConfigWrapper implements Config { /** * The linked {@link MemorySection} where values are physically stored. @@ -58,89 +57,29 @@ public abstract class ConfigWrapper implements C return new ArrayList<>(config.getKeys(deep)); } - @Override - public void set(@NotNull final String path, - @NotNull final EcoSerializable object) { - Config serializedConfig = object.serialize(); - for (String key : serializedConfig.getKeys(true)) { - Object raw = serializedConfig.getRaw(key); - config.set(path + "." + key, raw); - cache.put(path + "." + key, raw); - } - } - @Override @Nullable public Object getRaw(@NotNull final String path) { return config.get(path); } - @Override - @NotNull - public > T get(@NotNull final String path, - @NotNull final Class clazz) { - T object = getOrNull(path, clazz); - if (object == null) { - throw new NullPointerException("Object cannot be null!"); - } else { - return object; - } - } - - @Override - @Nullable - public > T getOrNull(@NotNull final String path, - @NotNull final Class clazz) { - if (cache.containsKey(path)) { - return (T) cache.get(path); - } else { - Config section = getSubsectionOrNull(path); - if (section == null) { - return null; - } - cache.put(path, SerializationUtils.deserialize(section, clazz)); - return getOrNull(path, clazz); - } - } - - @Override - @NotNull - @Deprecated - public ConfigurationSection getSection(@NotNull final String path) { - ConfigurationSection section = getSectionOrNull(path); - if (section == null) { - throw new NullPointerException("Section cannot be null!"); - } else { - return section; - } - } - - @Override - @Nullable - @Deprecated - public ConfigurationSection getSectionOrNull(@NotNull final String path) { - if (cache.containsKey(path)) { - return (ConfigurationSection) cache.get(path); - } else { - cache.put(path, config.getConfigurationSection(path)); - return getSectionOrNull(path); - } - } - @Override @NotNull public Config getSubsection(@NotNull final String path) { - return new ConfigSection(this.getSection(path)); + Config subsection = getSubsectionOrNull(path); + Validate.notNull(subsection); + return subsection; } @Override @Nullable public Config getSubsectionOrNull(@NotNull final String path) { - ConfigurationSection section = this.getSectionOrNull(path); - if (section == null) { - return null; + if (cache.containsKey(path)) { + return (Config) cache.get(path); + } else { + cache.put(path, new ConfigSection(Objects.requireNonNull(config.getConfigurationSection(path)))); + return getSubsectionOrNull(path); } - return new ConfigSection(section); } @Override diff --git a/eco-api/src/main/java/com/willfp/eco/util/SerializationUtils.java b/eco-api/src/main/java/com/willfp/eco/util/SerializationUtils.java deleted file mode 100644 index d5c5ed3a..00000000 --- a/eco-api/src/main/java/com/willfp/eco/util/SerializationUtils.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.willfp.eco.util; - -import com.willfp.eco.util.config.Config; -import com.willfp.eco.util.serialization.Deserializer; -import com.willfp.eco.util.serialization.EcoSerializable; -import com.willfp.eco.util.serialization.NoRegisteredDeserializerException; -import lombok.SneakyThrows; -import lombok.experimental.UtilityClass; -import org.jetbrains.annotations.NotNull; - -import java.util.HashMap; -import java.util.Map; - -@UtilityClass -public class SerializationUtils { - /** - * All registered deserializers. - */ - private static final Map> REGISTRY = new HashMap<>(); - - /** - * Register deserializer. - * - * @param clazz The serializable class. - * @param deserializer The deserializer. - * @param The object type. - */ - public > void registerDeserializer(@NotNull final Class clazz, - @NotNull final Deserializer deserializer) { - REGISTRY.put(clazz.getName(), deserializer); - } - - /** - * Deserialize object. - * - * @param config The config. - * @param clazz The class. - * @param The object type. - */ - @SneakyThrows - public > T deserialize(@NotNull final Config config, - @NotNull final Class clazz) { - if (!REGISTRY.containsKey(clazz.getName())) { - throw new NoRegisteredDeserializerException("No deserializer registered for " + clazz.getName()); - } - - return clazz.cast(REGISTRY.get(clazz.getName()).deserialize(config)); - } -} diff --git a/eco-api/src/main/java/com/willfp/eco/util/bukkit/scheduling/RunnableFactory.java b/eco-api/src/main/java/com/willfp/eco/util/bukkit/scheduling/RunnableFactory.java index 12d2381c..49a78dd3 100644 --- a/eco-api/src/main/java/com/willfp/eco/util/bukkit/scheduling/RunnableFactory.java +++ b/eco-api/src/main/java/com/willfp/eco/util/bukkit/scheduling/RunnableFactory.java @@ -1,5 +1,6 @@ package com.willfp.eco.util.bukkit.scheduling; +import com.willfp.eco.internal.bukkit.events.EcoRunnableTask; import com.willfp.eco.util.internal.PluginDependent; import com.willfp.eco.util.plugin.EcoPlugin; import org.jetbrains.annotations.NotNull; @@ -8,7 +9,7 @@ import java.util.function.Consumer; public class RunnableFactory extends PluginDependent { /** - * Factory class to produce {@link EcoBukkitRunnable}s associated with an {@link EcoPlugin}. + * Factory class to produce {@link RunnableTask}s associated with an {@link EcoPlugin}. * * @param plugin The plugin that this factory creates runnables for. */ @@ -17,13 +18,13 @@ public class RunnableFactory extends PluginDependent { } /** - * Create an {@link EcoBukkitRunnable}. + * Create a {@link RunnableTask}. * * @param consumer Lambda of the code to run, where the parameter represents the instance of the runnable. - * @return The created {@link EcoBukkitRunnable}. + * @return The created {@link RunnableTask}. */ - public EcoBukkitRunnable create(@NotNull final Consumer consumer) { - return new EcoBukkitRunnable(this.getPlugin()) { + public RunnableTask create(@NotNull final Consumer consumer) { + return new EcoRunnableTask(this.getPlugin()) { @Override public void run() { consumer.accept(this); diff --git a/eco-api/src/main/java/com/willfp/eco/util/bukkit/scheduling/RunnableTask.java b/eco-api/src/main/java/com/willfp/eco/util/bukkit/scheduling/RunnableTask.java new file mode 100644 index 00000000..d7a9fb09 --- /dev/null +++ b/eco-api/src/main/java/com/willfp/eco/util/bukkit/scheduling/RunnableTask.java @@ -0,0 +1,54 @@ +package com.willfp.eco.util.bukkit.scheduling; + +import org.bukkit.scheduler.BukkitTask; +import org.jetbrains.annotations.NotNull; + +public interface RunnableTask extends Runnable { + /** + * Run the task. + * + * @return The created {@link BukkitTask}. + */ + @NotNull BukkitTask runTask(); + + /** + * Run the task asynchronously. + * + * @return The created {@link BukkitTask} + */ + @NotNull BukkitTask runTaskAsynchronously(); + + /** + * Run the task after a specified number of ticks. + * + * @param delay The number of ticks to wait. + * @return The created {@link BukkitTask} + */ + @NotNull BukkitTask runTaskLater(long delay); + + /** + * Run the task asynchronously after a specified number of ticks. + * + * @param delay The number of ticks to wait. + * @return The created {@link BukkitTask} + */ + @NotNull BukkitTask runTaskLaterAsynchronously(long delay); + + /** + * Run the task repeatedly on a timer. + * + * @param delay The delay before the task is first ran (in ticks). + * @param period The ticks elapsed before the task is ran again. + * @return The created {@link BukkitTask} + */ + @NotNull BukkitTask runTaskTimer(long delay, long period); + + /** + * Run the task repeatedly on a timer asynchronously. + * + * @param delay The delay before the task is first ran (in ticks). + * @param period The ticks elapsed before the task is ran again. + * @return The created {@link BukkitTask} + */ + @NotNull BukkitTask runTaskTimerAsynchronously(long delay, long period); +} diff --git a/eco-api/src/main/java/com/willfp/eco/util/config/Config.java b/eco-api/src/main/java/com/willfp/eco/util/config/Config.java index ffd7faea..7cd91920 100644 --- a/eco-api/src/main/java/com/willfp/eco/util/config/Config.java +++ b/eco-api/src/main/java/com/willfp/eco/util/config/Config.java @@ -1,7 +1,5 @@ package com.willfp.eco.util.config; -import com.willfp.eco.util.serialization.EcoSerializable; -import org.bukkit.configuration.ConfigurationSection; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -30,15 +28,6 @@ public interface Config { @NotNull List getKeys(boolean deep); - /** - * Set an object in config. - * - * @param path The path. - * @param object The object. - */ - void set(@NotNull String path, - @NotNull EcoSerializable object); - /** * Get an object from config. * Default implementations call {@link org.bukkit.configuration.file.YamlConfiguration#get(String)}. @@ -49,48 +38,6 @@ public interface Config { @Nullable Object getRaw(@NotNull String path); - /** - * Get an object from config. - * - * @param path The path. - * @param clazz The class of the object. - * @param The type of the object. - * @return The object. - */ - @NotNull > T get(@NotNull String path, - @NotNull Class clazz); - - /** - * Get an object from config. - * - * @param path The path. - * @param clazz The class of the object. - * @param The type of the object. - * @return The object, or null if not found. - */ - @Nullable > T getOrNull(@NotNull String path, - @NotNull Class clazz); - - /** - * Get bukkit configuration section from config. - * - * @param path The key to check. - * @return The configuration section. Throws NPE if not found. - */ - @NotNull - @Deprecated - ConfigurationSection getSection(@NotNull String path); - - /** - * Get bukkit configuration section from config. - * - * @param path The key to check. - * @return The configuration section, or null if not found. - */ - @Nullable - @Deprecated - ConfigurationSection getSectionOrNull(@NotNull String path); - /** * Get subsection from config. * diff --git a/eco-api/src/main/java/com/willfp/eco/util/recipe/Recipes.java b/eco-api/src/main/java/com/willfp/eco/util/recipe/Recipes.java index bb05176e..a6f4cc5c 100644 --- a/eco-api/src/main/java/com/willfp/eco/util/recipe/Recipes.java +++ b/eco-api/src/main/java/com/willfp/eco/util/recipe/Recipes.java @@ -2,7 +2,7 @@ package com.willfp.eco.util.recipe; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; -import com.willfp.eco.util.recipe.recipes.EcoShapedRecipe; +import com.willfp.eco.util.recipe.recipes.ShapedCraftingRecipe; import lombok.experimental.UtilityClass; import org.bukkit.Bukkit; import org.bukkit.NamespacedKey; @@ -18,7 +18,7 @@ public class Recipes { /** * Registry of all recipes. */ - private static final BiMap RECIPES = HashBiMap.create(); + private static final BiMap RECIPES = HashBiMap.create(); /** @@ -26,7 +26,7 @@ public class Recipes { * * @param recipe The recipe. */ - public void register(@NotNull final EcoShapedRecipe recipe) { + public void register(@NotNull final ShapedCraftingRecipe recipe) { RECIPES.forcePut(recipe.getKey(), recipe); Bukkit.getServer().removeRecipe(recipe.getKey()); @@ -57,7 +57,7 @@ public class Recipes { * @return The match, or null if not found. */ @Nullable - public EcoShapedRecipe getMatch(@NotNull final ItemStack[] matrix) { + public ShapedCraftingRecipe getMatch(@NotNull final ItemStack[] matrix) { return RECIPES.values().stream().filter(recipe -> recipe.test(matrix)).findFirst().orElse(null); } @@ -68,8 +68,8 @@ public class Recipes { * @return The shaped recipe, or null if not found. */ @Nullable - public EcoShapedRecipe getShapedRecipe(@NotNull final NamespacedKey key) { - EcoShapedRecipe recipe = RECIPES.get(key); + public ShapedCraftingRecipe getShapedRecipe(@NotNull final NamespacedKey key) { + ShapedCraftingRecipe recipe = RECIPES.get(key); if (recipe != null) { return recipe; } diff --git a/eco-api/src/main/java/com/willfp/eco/util/recipe/recipes/CraftingRecipe.java b/eco-api/src/main/java/com/willfp/eco/util/recipe/recipes/CraftingRecipe.java new file mode 100644 index 00000000..394dee71 --- /dev/null +++ b/eco-api/src/main/java/com/willfp/eco/util/recipe/recipes/CraftingRecipe.java @@ -0,0 +1,66 @@ +package com.willfp.eco.util.recipe.recipes; + +import com.willfp.eco.util.recipe.parts.RecipePart; +import org.bukkit.Material; +import org.bukkit.NamespacedKey; +import org.bukkit.inventory.ItemStack; +import org.jetbrains.annotations.NotNull; + +public interface CraftingRecipe { + /** + * Get item material at a specific index. + * + * @param index The index to check. + * @return The material. + */ + Material getMaterialAtIndex(int index); + + /** + * Get "real" item at specific index. + * + * @param index The index to check. + * @return The item. + */ + ItemStack getDisplayedAtIndex(int index); + + /** + * Test matrix against recipe. + * + * @param matrix The matrix to check. + * @return If the recipe matches. + */ + boolean test(@NotNull ItemStack[] matrix); + + /** + * Register the recipe. + */ + void register(); + + /** + * The recipe parts. + * + * @return The parts. + */ + RecipePart[] getParts(); + + /** + * Get the recipe key. + * + * @return The key. + */ + NamespacedKey getKey(); + + /** + * Get the displayed recipe key. + * + * @return The key. + */ + NamespacedKey getDisplayedKey(); + + /** + * Get the recipe output. + * + * @return The output. + */ + ItemStack getOutput(); +} diff --git a/eco-api/src/main/java/com/willfp/eco/util/recipe/recipes/EcoShapedRecipe.java b/eco-api/src/main/java/com/willfp/eco/util/recipe/recipes/ShapedCraftingRecipe.java similarity index 83% rename from eco-api/src/main/java/com/willfp/eco/util/recipe/recipes/EcoShapedRecipe.java rename to eco-api/src/main/java/com/willfp/eco/util/recipe/recipes/ShapedCraftingRecipe.java index 94048362..131d8357 100644 --- a/eco-api/src/main/java/com/willfp/eco/util/recipe/recipes/EcoShapedRecipe.java +++ b/eco-api/src/main/java/com/willfp/eco/util/recipe/recipes/ShapedCraftingRecipe.java @@ -13,7 +13,7 @@ import org.jetbrains.annotations.NotNull; import java.util.Arrays; -public final class EcoShapedRecipe extends PluginDependent { +public final class ShapedCraftingRecipe extends PluginDependent implements CraftingRecipe { /** * Recipe parts. */ @@ -38,10 +38,10 @@ public final class EcoShapedRecipe extends PluginDependent { @Getter private final ItemStack output; - private EcoShapedRecipe(@NotNull final EcoPlugin plugin, - @NotNull final String key, - @NotNull final RecipePart[] parts, - @NotNull final ItemStack output) { + private ShapedCraftingRecipe(@NotNull final EcoPlugin plugin, + @NotNull final String key, + @NotNull final RecipePart[] parts, + @NotNull final ItemStack output) { super(plugin); this.parts = parts; @@ -50,32 +50,17 @@ public final class EcoShapedRecipe extends PluginDependent { this.output = output; } - /** - * Get item material at a specific index. - * - * @param index The index to check. - * @return The material. - */ + @Override public Material getMaterialAtIndex(final int index) { return parts[index].getDisplayed().getType(); } - /** - * Get "real" item at specific index. - * - * @param index The index to check. - * @return The item. - */ + @Override public ItemStack getDisplayedAtIndex(final int index) { return parts[index].getDisplayed(); } - /** - * Test matrix against recipe. - * - * @param matrix The matrix to check. - * @return If the recipe matches. - */ + @Override public boolean test(@NotNull final ItemStack[] matrix) { boolean matches = true; for (int i = 0; i < 9; i++) { @@ -87,9 +72,7 @@ public final class EcoShapedRecipe extends PluginDependent { return matches; } - /** - * Register the recipe. - */ + @Override public void register() { Recipes.register(this); } @@ -190,14 +173,14 @@ public final class EcoShapedRecipe extends PluginDependent { * * @return The built recipe. */ - public EcoShapedRecipe build() { + public ShapedCraftingRecipe build() { for (int i = 0; i < 9; i++) { if (recipeParts[i] == null) { recipeParts[i] = new EmptyRecipePart(); } } - return new EcoShapedRecipe(plugin, key.toLowerCase(), recipeParts, output); + return new ShapedCraftingRecipe(plugin, key.toLowerCase(), recipeParts, output); } } } diff --git a/eco-api/src/main/java/com/willfp/eco/util/serialization/Deserializer.java b/eco-api/src/main/java/com/willfp/eco/util/serialization/Deserializer.java deleted file mode 100644 index 9b9ac36b..00000000 --- a/eco-api/src/main/java/com/willfp/eco/util/serialization/Deserializer.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.willfp.eco.util.serialization; - -import com.willfp.eco.util.config.Config; -import org.jetbrains.annotations.NotNull; - -public abstract class Deserializer> { - /** - * Deserialize a config into an object. - * - * @param config The config. - * @return The object. - */ - public abstract T deserialize(@NotNull Config config); -} diff --git a/eco-api/src/main/java/com/willfp/eco/util/serialization/EcoSerializable.java b/eco-api/src/main/java/com/willfp/eco/util/serialization/EcoSerializable.java deleted file mode 100644 index 75dbd865..00000000 --- a/eco-api/src/main/java/com/willfp/eco/util/serialization/EcoSerializable.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.willfp.eco.util.serialization; - -import com.willfp.eco.util.config.Config; -import org.jetbrains.annotations.NotNull; - -public interface EcoSerializable { - /** - * Serialize an object into a config. - * - * @return The config. - */ - @NotNull - Config serialize(); -} diff --git a/eco-api/src/main/java/com/willfp/eco/util/serialization/NoRegisteredDeserializerException.java b/eco-api/src/main/java/com/willfp/eco/util/serialization/NoRegisteredDeserializerException.java deleted file mode 100644 index 7bd04e2b..00000000 --- a/eco-api/src/main/java/com/willfp/eco/util/serialization/NoRegisteredDeserializerException.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.willfp.eco.util.serialization; - -import org.jetbrains.annotations.NotNull; - -public class NoRegisteredDeserializerException extends Exception { - /** - * Create new NoRegisteredDeserializerException. - * - * @param message The message. - */ - public NoRegisteredDeserializerException(@NotNull final String message) { - super(message); - } -} diff --git a/eco-core/core-plugin/src/main/java/com/willfp/eco/spigot/recipes/RecipeListener.java b/eco-core/core-plugin/src/main/java/com/willfp/eco/spigot/recipes/RecipeListener.java index 60e84cc4..808ef4e4 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/eco/spigot/recipes/RecipeListener.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/eco/spigot/recipes/RecipeListener.java @@ -5,7 +5,7 @@ import com.willfp.eco.util.recipe.RecipeParts; import com.willfp.eco.util.recipe.Recipes; import com.willfp.eco.util.recipe.parts.RecipePart; import com.willfp.eco.util.recipe.parts.SimpleRecipePart; -import com.willfp.eco.util.recipe.recipes.EcoShapedRecipe; +import com.willfp.eco.util.recipe.recipes.ShapedCraftingRecipe; import org.bukkit.Material; import org.bukkit.event.Event; import org.bukkit.event.EventHandler; @@ -36,7 +36,7 @@ public class RecipeListener implements Listener { } ItemStack[] matrix = event.getInventory().getMatrix(); - EcoShapedRecipe matched = Recipes.getMatch(matrix); + ShapedCraftingRecipe matched = Recipes.getMatch(matrix); if (matched == null) { event.getInventory().setResult(new ItemStack(Material.AIR)); @@ -68,7 +68,7 @@ public class RecipeListener implements Listener { } ItemStack[] matrix = event.getInventory().getMatrix(); - EcoShapedRecipe matched = Recipes.getMatch(matrix); + ShapedCraftingRecipe matched = Recipes.getMatch(matrix); if (matched == null) { event.getInventory().setResult(new ItemStack(Material.AIR)); @@ -99,15 +99,15 @@ public class RecipeListener implements Listener { ShapedRecipe recipe = (ShapedRecipe) event.getRecipe(); - EcoShapedRecipe ecoShapedRecipe = Recipes.getShapedRecipe(recipe.getKey()); + ShapedCraftingRecipe shapedCraftingRecipe = Recipes.getShapedRecipe(recipe.getKey()); - if (ecoShapedRecipe == null) { + if (shapedCraftingRecipe == null) { return; } for (int i = 0; i < 9; i++) { ItemStack itemStack = event.getInventory().getMatrix()[i]; - RecipePart part = ecoShapedRecipe.getParts()[i]; + RecipePart part = shapedCraftingRecipe.getParts()[i]; if (part instanceof SimpleRecipePart) { if (RecipeParts.isRecipePart(itemStack)) { event.getInventory().setResult(new ItemStack(Material.AIR)); @@ -130,15 +130,15 @@ public class RecipeListener implements Listener { ShapedRecipe recipe = (ShapedRecipe) event.getRecipe(); - EcoShapedRecipe ecoShapedRecipe = Recipes.getShapedRecipe(recipe.getKey()); + ShapedCraftingRecipe shapedCraftingRecipe = Recipes.getShapedRecipe(recipe.getKey()); - if (ecoShapedRecipe == null) { + if (shapedCraftingRecipe == null) { return; } for (int i = 0; i < 9; i++) { ItemStack itemStack = event.getInventory().getMatrix()[i]; - RecipePart part = ecoShapedRecipe.getParts()[i]; + RecipePart part = shapedCraftingRecipe.getParts()[i]; if (part instanceof SimpleRecipePart) { if (RecipeParts.isRecipePart(itemStack)) { event.getInventory().setResult(new ItemStack(Material.AIR));