Skip to content
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

FurnaceEvents, Expressions #7093

Merged
merged 44 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
829e903
Starter Commit
Absolutionism Sep 18, 2024
5869c75
More Commits
Absolutionism Sep 18, 2024
c532d3d
Cleanup
Absolutionism Sep 18, 2024
5e6d1f5
Merge branch 'dev/feature' into dev/FurnaceEvents
Absolutionism Sep 19, 2024
18058fc
Chanages
Absolutionism Sep 19, 2024
4419e88
Merge branch 'dev/FurnaceEvents' of https://github.com/TheAbsolutioni…
Absolutionism Sep 19, 2024
ed3e310
Merge branch 'dev/feature' into dev/FurnaceEvents
Absolutionism Sep 21, 2024
bd0fb12
Merge branch 'dev/feature' into dev/FurnaceEvents
Absolutionism Sep 22, 2024
c62c1bc
Merge branch 'dev/feature' into dev/FurnaceEvents
Absolutionism Sep 22, 2024
c163557
Requested Changes
Absolutionism Sep 24, 2024
fbf8842
Syntax Fix
Absolutionism Sep 26, 2024
077d8c3
Merge branch 'dev/feature' into dev/FurnaceEvents
Absolutionism Oct 1, 2024
6fc4fc9
Merge branch 'dev/feature' into dev/FurnaceEvents
Absolutionism Oct 2, 2024
cde2c53
Requested Changes
Absolutionism Oct 2, 2024
449a95e
Merge branch 'dev/FurnaceEvents' of https://github.com/TheAbsolutioni…
Absolutionism Oct 2, 2024
d64a1c6
Merge branch 'dev/feature' into dev/FurnaceEvents
sovdeeth Oct 3, 2024
abb17c6
Requested Changes
Absolutionism Oct 4, 2024
3e919ab
Requested Changes
Absolutionism Oct 12, 2024
e4c3eb7
Partial Changes
Absolutionism Oct 12, 2024
d884d05
Requested Changes
Absolutionism Oct 12, 2024
9bf22b0
Requested Changes
Absolutionism Oct 15, 2024
6cb8a1a
Merge branch 'dev/feature' into dev/FurnaceEvents
sovdeeth Oct 15, 2024
4597da5
fix merge issues
sovdeeth Oct 15, 2024
1f9a1c1
Removed default case
Absolutionism Oct 16, 2024
49acc83
Merge remote-tracking branch 'upstream/dev/feature' into dev/FurnaceE…
Absolutionism Oct 27, 2024
7a60205
Requested Changes
Absolutionism Oct 30, 2024
e5fd7a4
Module
Absolutionism Oct 30, 2024
0c144c8
Merge remote-tracking branch 'upstream/dev/feature' into dev/FurnaceE…
Absolutionism Nov 2, 2024
95b6307
Merge branch 'dev/feature' into dev/FurnaceEvents
Absolutionism Nov 11, 2024
ecada30
Merge branch 'dev/feature' into dev/FurnaceEvents
Efnilite Nov 14, 2024
9f337b1
Merge remote-tracking branch 'upstream/dev/feature' into dev/FurnaceE…
Absolutionism Nov 23, 2024
9e3b78b
Requested Changes
Absolutionism Nov 30, 2024
3071df2
Merge remote-tracking branch 'upstream/dev/feature' into dev/FurnaceE…
Absolutionism Dec 15, 2024
e2af27b
Merge branch 'dev/feature' into dev/FurnaceEvents
Moderocky Dec 17, 2024
0562198
Merge remote-tracking branch 'upstream/dev/feature' into dev/FurnaceE…
Absolutionism Dec 18, 2024
b2d7a98
Conflict
Absolutionism Dec 18, 2024
6052b88
Merge branch 'dev/feature' into dev/FurnaceEvents
Moderocky Dec 19, 2024
0e826dc
Merge branch 'dev/feature' into dev/FurnaceEvents
Absolutionism Dec 19, 2024
8f0c375
Merge remote-tracking branch 'upstream/dev/feature' into dev/FurnaceE…
Absolutionism Dec 19, 2024
1b3d256
Update Event-Values
Absolutionism Dec 19, 2024
2b9b2f6
Merge branch 'dev/FurnaceEvents' of https://github.com/TheAbsolutioni…
Absolutionism Dec 19, 2024
9e1d0f6
Merge remote-tracking branch 'upstream/dev/feature' into dev/FurnaceE…
Absolutionism Dec 23, 2024
4455f06
Resolve
Absolutionism Dec 23, 2024
a085c64
Merge branch 'dev/feature' into dev/FurnaceEvents
Moderocky Dec 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/main/java/ch/njol/skript/Skript.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
import org.skriptlang.skript.bukkit.SkriptMetrics;
import org.skriptlang.skript.bukkit.breeding.BreedingModule;
import org.skriptlang.skript.bukkit.displays.DisplayModule;
import org.skriptlang.skript.bukkit.furnace.FurnaceModule;
import org.skriptlang.skript.bukkit.fishing.FishingModule;
import org.skriptlang.skript.bukkit.input.InputModule;
import org.skriptlang.skript.bukkit.loottables.LootTableModule;
Expand Down Expand Up @@ -550,6 +551,7 @@ public void onEnable() {
BreedingModule.load();
DisplayModule.load();
InputModule.load();
FurnaceModule.load();
LootTableModule.load();
} catch (final Exception e) {
exception(e, "Could not load required .class files: " + e.getLocalizedMessage());
Expand Down
26 changes: 11 additions & 15 deletions src/main/java/ch/njol/skript/classes/data/BukkitEventValues.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
package ch.njol.skript.classes.data;

import java.time.Duration;
import java.time.temporal.TemporalAmount;
import java.time.temporal.TemporalUnit;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.function.Function;

import ch.njol.skript.Skript;
import ch.njol.skript.aliases.ItemType;
import ch.njol.skript.bukkitutil.InventoryUtils;
Expand All @@ -27,11 +18,6 @@
import com.destroystokyo.paper.event.entity.ProjectileCollideEvent;
import com.destroystokyo.paper.event.player.PlayerArmorChangeEvent;
import io.papermc.paper.event.entity.EntityMoveEvent;
import io.papermc.paper.event.player.PlayerInventorySlotChangeEvent;
import io.papermc.paper.event.player.PlayerStonecutterRecipeSelectEvent;
import io.papermc.paper.event.player.PlayerStopUsingItemEvent;
import io.papermc.paper.event.player.PlayerTradeEvent;
import org.bukkit.*;
import io.papermc.paper.event.player.*;
import org.bukkit.*;
import org.bukkit.block.Block;
Expand Down Expand Up @@ -66,9 +52,13 @@
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.potion.PotionType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public final class BukkitEventValues {

public BukkitEventValues() {
Expand Down Expand Up @@ -1792,6 +1782,12 @@ public RegainReason get(EntityRegainHealthEvent event) {
}
}, EventValues.TIME_NOW);

// FurnaceExtractEvent
EventValues.registerEventValue(FurnaceExtractEvent.class, Player.class, FurnaceExtractEvent::getPlayer);
EventValues.registerEventValue(FurnaceExtractEvent.class, ItemStack[].class,
event -> new ItemStack[]{ItemStack.of(event.getItemType(), event.getItemAmount())
});

// BlockDropItemEvent
EventValues.registerEventValue(BlockDropItemEvent.class, Block.class, new Getter<Block, BlockDropItemEvent>() {
@Override
Expand Down
8 changes: 0 additions & 8 deletions src/main/java/ch/njol/skript/events/SimpleEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,6 @@ public class SimpleEvents {
.description("Called when the hunger bar of a player changes, i.e. either increases by eating or decreases over time.")
.examples("on food bar change:")
.since("1.4.4");
Skript.registerEvent("Fuel Burn", SimpleEvent.class, FurnaceBurnEvent.class, "fuel burn[ing]")
.description("Called when a furnace burns an item from its <a href='expressions.html#ExprFurnaceSlot'>fuel slot</a>.")
.examples("on fuel burning:")
.since("1.0");
Skript.registerEvent("Smelt", SimpleEvent.class, FurnaceSmeltEvent.class, "[ore] smelt[ing]", "smelt[ing] of ore") //TODO SkriptEvent for "smelt[ing] of %itemtype%"
.description("Called when a furnace smelts an item in its <a href='expressions.html#ExprFurnaceSlot'>ore slot</a>.")
.examples("on smelt:")
.since("1.0");
Skript.registerEvent("Leaves Decay", SimpleEvent.class, LeavesDecayEvent.class, "leaves decay[ing]")
.description("Called when a leaf block decays due to not being connected to a tree.")
.examples("on leaves decay:")
Expand Down
152 changes: 0 additions & 152 deletions src/main/java/ch/njol/skript/expressions/ExprBurnCookTime.java

This file was deleted.

8 changes: 3 additions & 5 deletions src/main/java/ch/njol/skript/expressions/ExprFireTicks.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,12 @@ public boolean init(Expression<?>[] expressions, int matchedPattern, Kleenean is
}

@Override
@Nullable
public Timespan convert(Entity entity) {
public @Nullable Timespan convert(Entity entity) {
return new Timespan(TimePeriod.TICK, (max ? entity.getMaxFireTicks() : Math.max(entity.getFireTicks(), 0)));
}

@Override
@Nullable
public Class<?>[] acceptChange(ChangeMode mode) {
public Class<?> @Nullable [] acceptChange(ChangeMode mode) {
if (max)
return null;
return switch (mode) {
Expand Down Expand Up @@ -77,7 +75,7 @@ public void change(Event event, @Nullable Object[] delta, ChangeMode mode) {
}

@Override
public Class<? extends Timespan> getReturnType() {
public Class<Timespan> getReturnType() {
return Timespan.class;
}

Expand Down
Loading
Loading