-
-
Notifications
You must be signed in to change notification settings - Fork 394
FurnaceEvents, Expressions #7093
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
Merged
Moderocky
merged 44 commits into
SkriptLang:dev/feature
from
Absolutionism:dev/FurnaceEvents
Dec 24, 2024
Merged
Changes from 6 commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
829e903
Starter Commit
Absolutionism 5869c75
More Commits
Absolutionism c532d3d
Cleanup
Absolutionism 5e6d1f5
Merge branch 'dev/feature' into dev/FurnaceEvents
Absolutionism 18058fc
Chanages
Absolutionism 4419e88
Merge branch 'dev/FurnaceEvents' of https://github.com/TheAbsolutioni…
Absolutionism ed3e310
Merge branch 'dev/feature' into dev/FurnaceEvents
Absolutionism bd0fb12
Merge branch 'dev/feature' into dev/FurnaceEvents
Absolutionism c62c1bc
Merge branch 'dev/feature' into dev/FurnaceEvents
Absolutionism c163557
Requested Changes
Absolutionism fbf8842
Syntax Fix
Absolutionism 077d8c3
Merge branch 'dev/feature' into dev/FurnaceEvents
Absolutionism 6fc4fc9
Merge branch 'dev/feature' into dev/FurnaceEvents
Absolutionism cde2c53
Requested Changes
Absolutionism 449a95e
Merge branch 'dev/FurnaceEvents' of https://github.com/TheAbsolutioni…
Absolutionism d64a1c6
Merge branch 'dev/feature' into dev/FurnaceEvents
sovdeeth abb17c6
Requested Changes
Absolutionism 3e919ab
Requested Changes
Absolutionism e4c3eb7
Partial Changes
Absolutionism d884d05
Requested Changes
Absolutionism 9bf22b0
Requested Changes
Absolutionism 6cb8a1a
Merge branch 'dev/feature' into dev/FurnaceEvents
sovdeeth 4597da5
fix merge issues
sovdeeth 1f9a1c1
Removed default case
Absolutionism 49acc83
Merge remote-tracking branch 'upstream/dev/feature' into dev/FurnaceE…
Absolutionism 7a60205
Requested Changes
Absolutionism e5fd7a4
Module
Absolutionism 0c144c8
Merge remote-tracking branch 'upstream/dev/feature' into dev/FurnaceE…
Absolutionism 95b6307
Merge branch 'dev/feature' into dev/FurnaceEvents
Absolutionism ecada30
Merge branch 'dev/feature' into dev/FurnaceEvents
Efnilite 9f337b1
Merge remote-tracking branch 'upstream/dev/feature' into dev/FurnaceE…
Absolutionism 9e3b78b
Requested Changes
Absolutionism 3071df2
Merge remote-tracking branch 'upstream/dev/feature' into dev/FurnaceE…
Absolutionism e2af27b
Merge branch 'dev/feature' into dev/FurnaceEvents
Moderocky 0562198
Merge remote-tracking branch 'upstream/dev/feature' into dev/FurnaceE…
Absolutionism b2d7a98
Conflict
Absolutionism 6052b88
Merge branch 'dev/feature' into dev/FurnaceEvents
Moderocky 0e826dc
Merge branch 'dev/feature' into dev/FurnaceEvents
Absolutionism 8f0c375
Merge remote-tracking branch 'upstream/dev/feature' into dev/FurnaceE…
Absolutionism 1b3d256
Update Event-Values
Absolutionism 2b9b2f6
Merge branch 'dev/FurnaceEvents' of https://github.com/TheAbsolutioni…
Absolutionism 9e1d0f6
Merge remote-tracking branch 'upstream/dev/feature' into dev/FurnaceE…
Absolutionism 4455f06
Resolve
Absolutionism a085c64
Merge branch 'dev/feature' into dev/FurnaceEvents
Moderocky 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
package ch.njol.skript.events; | ||
|
||
import ch.njol.skript.Skript; | ||
import ch.njol.skript.aliases.ItemType; | ||
import ch.njol.skript.lang.Literal; | ||
import ch.njol.skript.lang.SkriptEvent; | ||
import ch.njol.skript.lang.SkriptParser.ParseResult; | ||
import ch.njol.skript.registrations.Classes; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.event.inventory.FurnaceBurnEvent; | ||
import org.bukkit.event.inventory.FurnaceExtractEvent; | ||
import org.bukkit.event.inventory.FurnaceSmeltEvent; | ||
import org.bukkit.event.inventory.FurnaceStartSmeltEvent; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class EvtFurnace extends SkriptEvent { | ||
|
||
static { | ||
Skript.registerEvent("Smelt", EvtFurnace.class, FurnaceSmeltEvent.class, | ||
"[furnace] [ore] smelt[ed|ing] [of %-itemtypes%]", | ||
"[furnace] smelt[ed|ing] of ore") | ||
.description("Called when a furnace smelts an item in its <a href='expressions.html#ExprFurnaceSlot'>ore slot</a>.") | ||
Absolutionism marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.examples( | ||
"on smelt:", | ||
Absolutionism marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"on smelt of raw iron:", | ||
"\tbroadcast smelted item", | ||
"\tset smelt item to iron block" | ||
) | ||
.since("1.0, INSERT VERSION (specific item)"); | ||
Skript.registerEvent("Fuel Burn", EvtFurnace.class, FurnaceBurnEvent.class, "[furnace] fuel burn[ing] [of %-itemtypes%]") | ||
Absolutionism marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.description("Called when a furnace burns an item from its <a href='expressions.html#ExprFurnaceSlot'>fuel slot</a>.") | ||
.examples( | ||
"on fuel burning:", | ||
"\tbroadcast fuel burned", | ||
"\tif fuel burned is coal:", | ||
"\t\tadd 20 seconds to burn time" | ||
) | ||
.since("1.0, INSERT VERSION (specific item)"); | ||
Skript.registerEvent("Furnace Extract", EvtFurnace.class, FurnaceExtractEvent.class, "furnace extract[ion] [of %-itemtypes%]") | ||
Absolutionism marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.description("Called when a player takes any item out of the furnace.") | ||
.examples( | ||
"on furnace extract:", | ||
"\tif event-items is an iron ingot:", | ||
"\t\tremove event-items from event-player's inventory" | ||
) | ||
.since("INSERT VERSION"); | ||
Skript.registerEvent("Start Smelt", EvtFurnace.class, FurnaceStartSmeltEvent.class, | ||
"[furnace] start [of] smelt[ing] [[of] %-itemtypes%]", | ||
"[furnace] smelting start [of %-itemtypes%]") | ||
Absolutionism marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.description("Called when a furnace starts smelting an item in its ...") | ||
Absolutionism marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.examples( | ||
"on smelting start:", | ||
"\tif the smelting item is raw iron:", | ||
"\t\tset total cook time to 1 second", | ||
"on smelting start of raw iron:" | ||
Absolutionism marked this conversation as resolved.
Show resolved
Hide resolved
|
||
) | ||
.since("INSERT VERSION"); | ||
} | ||
|
||
private @Nullable Literal<Object> types; | ||
Absolutionism marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
@Override | ||
public boolean init(Literal<?>[] exprs, int matchedPattern, ParseResult parseResult) { | ||
if (exprs[0] != null) | ||
types = (Literal<Object>) exprs[0]; | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean check(Event event) { | ||
if (types == null) | ||
return true; | ||
|
||
ItemType item; | ||
|
||
if (event instanceof FurnaceSmeltEvent smeltEvent) { | ||
item = new ItemType(smeltEvent.getSource()); | ||
} else if (event instanceof FurnaceBurnEvent burnEvent) { | ||
item = new ItemType(burnEvent.getFuel()); | ||
} else if (event instanceof FurnaceExtractEvent extractEvent) { | ||
item = new ItemType(extractEvent.getItemType()); | ||
} else if (event instanceof FurnaceStartSmeltEvent startEvent) { | ||
item = new ItemType(startEvent.getSource()); | ||
} else { | ||
assert false; | ||
return false; | ||
} | ||
|
||
return types.check(event, o -> { | ||
if (o instanceof ItemType) | ||
Absolutionism marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return ((ItemType) o).isSupertypeOf(item); | ||
return false; | ||
}); | ||
} | ||
|
||
@Override | ||
public String toString(@Nullable Event event, boolean debug) { | ||
return "smelt/burn/extract/start smelt of " + Classes.toString(types); | ||
Absolutionism marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
} |
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
170 changes: 0 additions & 170 deletions
170
src/main/java/ch/njol/skript/expressions/ExprBurnCookTime.java
This file was deleted.
Oops, something went wrong.
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
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.