-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7735f28
commit 99d3ea3
Showing
4 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/main/java/com/github/yufiria/craftorithm/recipe/BaseRecipe.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.github.yufiria.craftorithm.recipe; | ||
|
||
import org.bukkit.NamespacedKey; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public abstract class BaseRecipe<T> implements IRecipe<T> { | ||
|
||
protected Integer priority; | ||
protected NamespacedKey recipeKey; | ||
|
||
public BaseRecipe(NamespacedKey recipeKey) { | ||
this.recipeKey = recipeKey; | ||
} | ||
|
||
@Override | ||
@NotNull | ||
public NamespacedKey key() { | ||
return recipeKey; | ||
} | ||
|
||
@Override | ||
public @Nullable Integer priority() { | ||
return this.priority; | ||
} | ||
|
||
@Override | ||
public void setPriority(@Nullable Integer priority) { | ||
this.priority = priority; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/com/github/yufiria/craftorithm/recipe/IRecipe.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.github.yufiria.craftorithm.recipe; | ||
|
||
import org.bukkit.NamespacedKey; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.inventory.ItemStack; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public interface IRecipe<T> { | ||
|
||
@NotNull NamespacedKey key(); | ||
|
||
ItemStack result(Player player); | ||
|
||
boolean match(T matchObj); | ||
|
||
@Nullable Integer priority(); | ||
|
||
void setPriority(@Nullable Integer priority); | ||
|
||
} |
51 changes: 51 additions & 0 deletions
51
src/main/java/com/github/yufiria/craftorithm/recipe/ShapedRecipe.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.github.yufiria.craftorithm.recipe; | ||
|
||
import org.bukkit.NamespacedKey; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.inventory.ItemStack; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class ShapedRecipe extends BaseRecipe<String[][]> { | ||
|
||
protected ItemStack result; | ||
protected String[][] ingredients; | ||
|
||
public ShapedRecipe(NamespacedKey recipeKey) { | ||
super(recipeKey); | ||
this.priority = 0; | ||
} | ||
|
||
public ShapedRecipe(NamespacedKey recipeKey, ItemStack result, String[][] ingredients, Integer priority) { | ||
super(recipeKey); | ||
this.result = result; | ||
this.ingredients = ingredients; | ||
this.priority = priority; | ||
} | ||
|
||
public String[][] ingredientIds() { | ||
return ingredients; | ||
} | ||
|
||
public ShapedRecipe setIngredients(String[][] ingredients) { | ||
this.ingredients = ingredients; | ||
return this; | ||
} | ||
|
||
public ShapedRecipe setResult(ItemStack result) { | ||
this.result = result; | ||
return this; | ||
} | ||
|
||
@Override | ||
@NotNull | ||
public ItemStack result(Player player) { | ||
return result; | ||
} | ||
|
||
@Override | ||
public boolean match(String[][] matchObj) { | ||
//TODO | ||
return false; | ||
} | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/com/github/yufiria/craftorithm/recipe/handler/ShapedRecipeHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.github.yufiria.craftorithm.recipe.handler; | ||
|
||
import crypticlib.listener.BukkitListener; | ||
|
||
@BukkitListener | ||
public class ShapedRecipeHandler { | ||
|
||
|
||
} |