From 66bb52e9cda8bbe7444182b81d2302e3a6d9073f Mon Sep 17 00:00:00 2001 From: Efnilite <35348263+Efnilite@users.noreply.github.com> Date: Sat, 21 Dec 2024 19:07:49 +0100 Subject: [PATCH 1/2] Fix registering EventValues for addons (#7291) init commit Co-authored-by: Moderocky --- .../skript/registrations/EventValues.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/main/java/ch/njol/skript/registrations/EventValues.java b/src/main/java/ch/njol/skript/registrations/EventValues.java index 81c9f44ffa9..c5fa245bf34 100644 --- a/src/main/java/ch/njol/skript/registrations/EventValues.java +++ b/src/main/java/ch/njol/skript/registrations/EventValues.java @@ -2,6 +2,7 @@ import ch.njol.skript.Skript; import ch.njol.skript.expressions.base.EventValueExpression; +import ch.njol.skript.util.Getter; import ch.njol.util.Kleenean; import com.google.common.collect.ImmutableList; import org.bukkit.event.Event; @@ -124,6 +125,31 @@ public static void registerEventValue( eventValues.add(element); } + /** + * @deprecated Use {@link #registerEventValue(Class, Class, Converter, int, String, Class[])} instead. + */ + @Deprecated(forRemoval = true) + @SafeVarargs + public static void registerEventValue( + Class event, Class type, + Getter getter, int time, + @Nullable String excludeErrorMessage, + @Nullable Class... excludes + ) { + registerEventValue(event, type, (Converter) getter, time, excludeErrorMessage, excludes); + } + + /** + * @deprecated Use {@link #registerEventValue(Class, Class, Converter, int)} instead. + */ + @Deprecated(forRemoval = true) + public static void registerEventValue( + Class event, Class type, + Getter getter, int time + ) { + registerEventValue(event, type, (Converter) getter, time); + } + /** * Gets a specific value from an event. Returns null if the event doesn't have such a value (conversions are done to try and get the desired value). *

From 8bbd5346670f9fcede99aa36d95992a08e060402 Mon Sep 17 00:00:00 2001 From: sovdee <10354869+sovdeeth@users.noreply.github.com> Date: Sat, 21 Dec 2024 13:14:52 -0500 Subject: [PATCH 2/2] Mark ChangeInPlace as internal to prevent outside use for now. (#7294) unsafe Co-authored-by: Moderocky --- src/main/java/ch/njol/skript/lang/Expression.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/ch/njol/skript/lang/Expression.java b/src/main/java/ch/njol/skript/lang/Expression.java index d6cc79c4ead..d8bc4006adf 100644 --- a/src/main/java/ch/njol/skript/lang/Expression.java +++ b/src/main/java/ch/njol/skript/lang/Expression.java @@ -31,6 +31,7 @@ import ch.njol.util.Checker; import org.bukkit.event.Event; import org.bukkit.inventory.ItemStack; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.skriptlang.skript.lang.converter.Converter; @@ -341,6 +342,7 @@ default Map[]> getAcceptedChangeModes() { * @param The output type of the change function. Must be a type returned * by {{@link #acceptChange(ChangeMode)}} for {@link ChangeMode#SET}. */ + @ApiStatus.Internal default void changeInPlace(Event event, Function changeFunction) { changeInPlace(event, changeFunction, false); } @@ -362,6 +364,7 @@ default void changeInPlace(Event event, Function changeFunction) { * @param The output type of the change function. Must be a type returned * by {{@link #acceptChange(ChangeMode)}} for {@link ChangeMode#SET}. */ + @ApiStatus.Internal default void changeInPlace(Event event, Function changeFunction, boolean getAll) { T[] values = getAll ? getAll(event) : getArray(event); if (values.length == 0)