-
-
Notifications
You must be signed in to change notification settings - Fork 403
Recipe Support #7150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Recipe Support #7150
Changes from 60 commits
Commits
Show all changes
75 commits
Select commit
Hold shift + click to select a range
2b18331
Starter Commit
Absolutionism 5301401
Shapeless Addition
Absolutionism 5aaf2a6
Testing Stuff
Absolutionism bd2c23f
Testing Fix
Absolutionism 50bb139
More additions
Absolutionism 29bc2e8
Additional Updates + Changes
Absolutionism d73bad2
Further Additions
Absolutionism 23d4dc0
Fuse Changes
Absolutionism fbefde4
Tests (Stopping Point)
Absolutionism a687e0f
Some Fixes
Absolutionism 1f79ed6
Additional Changes + Fixes
Absolutionism 5c3a8c0
Fuzes Wishlist
Absolutionism 78c5411
Almost Done
Absolutionism ebc9428
Fix Imports
Absolutionism 793c3ee
One more fix
Absolutionism 9a628ea
Fix Test
Absolutionism 9307a02
Merge remote-tracking branch 'upstream/dev/feature' into dev/Recipes
Absolutionism ed8f1db
Change RecipeType class register
Absolutionism 1cc3c24
Module + Changes
Absolutionism 48a6c1f
Fuse's Changes
Absolutionism db3e501
Partial Changes
Absolutionism 2d611e0
More Partial Changes
Absolutionism 3c37524
RecipeWrapper
Absolutionism 250c69f
Merge remote-tracking branch 'upstream/dev/feature' into dev/Recipes
Absolutionism 3bd9c4a
Additional Changes
Absolutionism 06d8346
Remove "runtime"
Absolutionism 4b8ba57
Merge branch 'dev/feature' into dev/Recipes
Absolutionism 530ac32
Merge branch 'dev/feature' into dev/Recipes
Absolutionism 0b712cc
Merge branch 'dev/feature' into dev/Recipes
Absolutionism 76716cb
Merge branch 'dev/feature' into dev/Recipes
Efnilite 1087525
Requested Changes
Absolutionism e801263
Additional Changes
Absolutionism ab7edc5
Fix Errors
Absolutionism 99250ad
Fix Docs
Absolutionism e2193ea
Requested Changes
Absolutionism 2eea7a6
More Changes
Absolutionism 6268513
Whoops
Absolutionism 149b842
Partial Changes
Absolutionism 14972f3
Merge remote-tracking branch 'upstream/dev/feature' into dev/Recipes
Absolutionism 0e5e1e4
Secspressions!
Absolutionism cb52649
Remove Duplicated Module
Absolutionism f6bdb2f
Merge branch 'dev/feature' into dev/Recipes
Absolutionism 04ba9fc
Changes + Additions
Absolutionism 9f97e4f
Fix Cond
Absolutionism 64834b0
Merge branch 'dev/Recipes' of https://github.com/TheAbsolutionism/Skr…
Absolutionism b4e809c
Check Lambda
Absolutionism 449148b
Merge branch 'dev/feature' into dev/Recipes
Absolutionism 3788025
Partial Changes
Absolutionism 56ea7a4
Fix Tests
Absolutionism f4d0e77
Additional Changes
Absolutionism b36656c
Merge remote-tracking branch 'upstream/dev/feature' into dev/Recipes
Absolutionism b143f26
Update EventValues
Absolutionism ea18385
Merge branch 'dev/feature' into dev/Recipes
Absolutionism 1679f2d
Fix Comparator Issue
Absolutionism bbc007a
Remove NamespacedUtils
Absolutionism e1c2fac
Requested Changes
Absolutionism a30c03b
Lowercase
Absolutionism b179275
Merge remote-tracking branch 'upstream/dev/feature' into dev/Recipes
Absolutionism a7175fe
Merge branch 'dev/feature' into dev/Recipes
Absolutionism 22b0ea0
SPE Update
Absolutionism 40a04f9
Changes
Absolutionism 1bcb404
Enum Improvements
Absolutionism b972c32
Merge remote-tracking branch 'upstream/dev/feature' into dev/Recipes
Absolutionism 2172a67
Merge remote-tracking branch 'upstream/dev/feature' into dev/Recipes
Absolutionism 07f13ec
Merge remote-tracking branch 'upstream/dev/feature' into dev/Recipes
Absolutionism eff1937
Merge branch 'dev/feature' into dev/Recipes
Moderocky baa600e
Merge branch 'dev/feature' into dev/Recipes
Absolutionism 8274f7c
Merge remote-tracking branch 'upstream/dev/feature' into dev/Recipes
Absolutionism 1829c98
Update skript-aliases
Absolutionism f6df8f3
Merge remote-tracking branch 'upstream/dev/feature' into dev/Recipes
Absolutionism 63d8cb6
Update skript-aliases
Absolutionism 81f6f52
Fixed Everything
Absolutionism f9c159c
Final Commit
Absolutionism 4647ac1
Merge remote-tracking branch 'upstream/dev/feature' into dev/Recipes
Absolutionism 3897e40
Proper Runtime Errors
Absolutionism File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
158 changes: 158 additions & 0 deletions
158
src/main/java/org/skriptlang/skript/bukkit/recipes/CreateRecipeEvent.java
This file contains hidden or 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,158 @@ | ||
package org.skriptlang.skript.bukkit.recipes; | ||
|
||
import org.bukkit.NamespacedKey; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.event.HandlerList; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.skriptlang.skript.bukkit.recipes.MutableRecipe.MutableTransmuteRecipe; | ||
import org.skriptlang.skript.bukkit.recipes.RecipeUtils.RecipeType; | ||
import org.skriptlang.skript.bukkit.recipes.MutableRecipe.MutableCookingRecipe.MutableBlastingRecipe; | ||
import org.skriptlang.skript.bukkit.recipes.MutableRecipe.MutableCookingRecipe.MutableCampfireRecipe; | ||
import org.skriptlang.skript.bukkit.recipes.MutableRecipe.MutableCookingRecipe.MutableFurnaceRecipe; | ||
import org.skriptlang.skript.bukkit.recipes.MutableRecipe.MutableCookingRecipe.MutableSmokingRecipe; | ||
import org.skriptlang.skript.bukkit.recipes.MutableRecipe.MutableCraftingRecipe.MutableShapedRecipe; | ||
import org.skriptlang.skript.bukkit.recipes.MutableRecipe.MutableCraftingRecipe.MutableShapelessRecipe; | ||
import org.skriptlang.skript.bukkit.recipes.MutableRecipe.MutableSmithingRecipe; | ||
import org.skriptlang.skript.bukkit.recipes.MutableRecipe.MutableSmithingRecipe.MutableSmithingTransformRecipe; | ||
import org.skriptlang.skript.bukkit.recipes.MutableRecipe.MutableSmithingRecipe.MutableSmithingTrimRecipe; | ||
import org.skriptlang.skript.bukkit.recipes.MutableRecipe.MutableStonecuttingRecipe; | ||
|
||
/** | ||
* Event class used with ExprSecCreateRecipe to allow the creation of MutableRecipe | ||
*/ | ||
public class CreateRecipeEvent extends Event { | ||
private boolean errorInSection = false; | ||
private RecipeType recipeType; | ||
private MutableRecipe mutableRecipe; | ||
|
||
public CreateRecipeEvent(NamespacedKey key, RecipeType recipeType) { | ||
this.recipeType = recipeType; | ||
this.mutableRecipe = switch (recipeType) { | ||
case SHAPED -> new MutableShapedRecipe(key); | ||
case SHAPELESS -> new MutableShapelessRecipe(key); | ||
case BLASTING -> new MutableBlastingRecipe(key); | ||
case FURNACE -> new MutableFurnaceRecipe(key); | ||
case SMOKING -> new MutableSmokingRecipe(key); | ||
case CAMPFIRE -> new MutableCampfireRecipe(key); | ||
case SMITHING -> new MutableSmithingRecipe(key, recipeType); | ||
case SMITHING_TRANSFORM -> new MutableSmithingTransformRecipe(key); | ||
case SMITHING_TRIM -> new MutableSmithingTrimRecipe(key); | ||
case STONECUTTING -> new MutableStonecuttingRecipe(key); | ||
case TRANSMUTE -> new MutableTransmuteRecipe(key); | ||
default -> null; | ||
}; | ||
} | ||
|
||
public void setErrorInSection() { | ||
this.errorInSection = true; | ||
} | ||
|
||
public boolean getErrorInSection() { | ||
return errorInSection; | ||
} | ||
|
||
public RecipeType getRecipeType() { | ||
return recipeType; | ||
} | ||
|
||
public MutableRecipe getMutableRecipe() { | ||
return mutableRecipe; | ||
} | ||
|
||
/** | ||
* Specific event to determine if the mutableRecipe is of MutableCraftingRecipe | ||
*/ | ||
public static class CraftingRecipeEvent extends CreateRecipeEvent { | ||
Absolutionism marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
public CraftingRecipeEvent(NamespacedKey key, RecipeType recipeType) { | ||
super(key, recipeType); | ||
}; | ||
|
||
/** | ||
* Specific event to determine if the mutableRecipe is of MutableShapedRecipe | ||
*/ | ||
public static class ShapedRecipeEvent extends CraftingRecipeEvent { | ||
public ShapedRecipeEvent(NamespacedKey key) { | ||
super(key, RecipeType.SHAPED); | ||
}; | ||
} | ||
|
||
/** | ||
* Specific event to determine if the mutableRecipe is of MutableShapelessRecipe | ||
*/ | ||
public static class ShapelessRecipeEvent extends CraftingRecipeEvent { | ||
public ShapelessRecipeEvent(NamespacedKey key) { | ||
super(key, RecipeType.SHAPELESS); | ||
}; | ||
} | ||
} | ||
|
||
/** | ||
* Specific event to determine if the mutableRecipe is of MutableCookingRecipe | ||
*/ | ||
public static class CookingRecipeEvent extends CreateRecipeEvent { | ||
|
||
public CookingRecipeEvent(NamespacedKey key, RecipeType recipeType) { | ||
super(key, recipeType); | ||
}; | ||
|
||
public static class BlastingRecipeEvent extends CookingRecipeEvent { | ||
public BlastingRecipeEvent(NamespacedKey key) { | ||
super(key, RecipeType.BLASTING); | ||
} | ||
} | ||
|
||
public static class CampfireRecipeEvent extends CookingRecipeEvent { | ||
public CampfireRecipeEvent(NamespacedKey key) { | ||
super(key, RecipeType.CAMPFIRE); | ||
} | ||
} | ||
|
||
public static class FurnaceRecipeEvent extends CookingRecipeEvent { | ||
public FurnaceRecipeEvent(NamespacedKey key) { | ||
super(key, RecipeType.FURNACE); | ||
} | ||
} | ||
|
||
public static class SmokingRecipeEvent extends CookingRecipeEvent { | ||
public SmokingRecipeEvent(NamespacedKey key) { | ||
super(key, RecipeType.SMOKING); | ||
} | ||
} | ||
} | ||
|
||
public static class SmithingRecipeEvent extends CreateRecipeEvent { | ||
public SmithingRecipeEvent(NamespacedKey key, RecipeType recipeType) { | ||
super(key, recipeType); | ||
} | ||
|
||
public static class SmithingTransformRecipeEvent extends SmithingRecipeEvent { | ||
public SmithingTransformRecipeEvent(NamespacedKey key) { | ||
super(key, RecipeType.SMITHING_TRANSFORM); | ||
} | ||
} | ||
|
||
public static class SmithingTrimRecipeEvent extends SmithingRecipeEvent { | ||
public SmithingTrimRecipeEvent(NamespacedKey key) { | ||
super(key, RecipeType.SMITHING_TRIM); | ||
} | ||
} | ||
} | ||
|
||
public static class StonecuttingRecipeEvent extends CreateRecipeEvent { | ||
public StonecuttingRecipeEvent(NamespacedKey key) { | ||
super(key, RecipeType.STONECUTTING); | ||
} | ||
} | ||
|
||
public static class TransmuteRecipeEvent extends CreateRecipeEvent { | ||
public TransmuteRecipeEvent(NamespacedKey key) { | ||
super(key, RecipeType.TRANSMUTE); | ||
} | ||
} | ||
|
||
@Override | ||
public @NotNull HandlerList getHandlers() { | ||
throw new IllegalStateException(); | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.