Skip to content

Commit

Permalink
Merge branch 'dev/feature' into feature/safe-config-update
Browse files Browse the repository at this point in the history
  • Loading branch information
Efnilite authored Dec 21, 2024
2 parents dc382f2 + 8bbd534 commit 175172b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/ch/njol/skript/lang/Expression.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -341,6 +342,7 @@ default Map<ChangeMode, Class<?>[]> getAcceptedChangeModes() {
* @param <R> The output type of the change function. Must be a type returned
* by {{@link #acceptChange(ChangeMode)}} for {@link ChangeMode#SET}.
*/
@ApiStatus.Internal
default <R> void changeInPlace(Event event, Function<T, R> changeFunction) {
changeInPlace(event, changeFunction, false);
}
Expand All @@ -362,6 +364,7 @@ default <R> void changeInPlace(Event event, Function<T, R> changeFunction) {
* @param <R> The output type of the change function. Must be a type returned
* by {{@link #acceptChange(ChangeMode)}} for {@link ChangeMode#SET}.
*/
@ApiStatus.Internal
default <R> void changeInPlace(Event event, Function<T, R> changeFunction, boolean getAll) {
T[] values = getAll ? getAll(event) : getArray(event);
if (values.length == 0)
Expand Down
26 changes: 26 additions & 0 deletions src/main/java/ch/njol/skript/registrations/EventValues.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -124,6 +125,31 @@ public static <T, E extends Event> void registerEventValue(
eventValues.add(element);
}

/**
* @deprecated Use {@link #registerEventValue(Class, Class, Converter, int, String, Class[])} instead.
*/
@Deprecated(forRemoval = true)
@SafeVarargs
public static <T, E extends Event> void registerEventValue(
Class<E> event, Class<T> type,
Getter<T, E> getter, int time,
@Nullable String excludeErrorMessage,
@Nullable Class<? extends E>... excludes
) {
registerEventValue(event, type, (Converter<E, T>) getter, time, excludeErrorMessage, excludes);
}

/**
* @deprecated Use {@link #registerEventValue(Class, Class, Converter, int)} instead.
*/
@Deprecated(forRemoval = true)
public static <T, E extends Event> void registerEventValue(
Class<E> event, Class<T> type,
Getter<T, E> getter, int time
) {
registerEventValue(event, type, (Converter<E, T>) 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).
* <p>
Expand Down

0 comments on commit 175172b

Please sign in to comment.