Package ch.njol.skript.classes
Interface Changer<T>
- All Known Subinterfaces:
SerializableChanger<T>
public interface Changer<T>
An interface to declare changeable values. All Expressions implement something similar like this by default, but refuse any change if
Expression.acceptChange(ChangeMode)
isn't overridden.
Some useful Changers can be found in DefaultChangers
- See Also:
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
static class
-
Method Summary
Modifier and TypeMethodDescription@Nullable Class<?>[]
Tests whether this changer supports the given mode, and if yes what type(s) it expects the elements ofdelta
to be.void
change
(T[] what, @Nullable Object[] delta, Changer.ChangeMode mode)
-
Method Details
-
acceptChange
Tests whether this changer supports the given mode, and if yes what type(s) it expects the elements ofdelta
to be.Unlike
Expression.acceptChange(ChangeMode)
this method must not print errors.- Parameters:
mode
-- Returns:
- An array of types that
change(Object[], Object[], ChangeMode)
accepts as itsdelta
parameter (which can be arrays to denote that multiple of that type are accepted), or null if the given mode is not supported. ForChanger.ChangeMode.DELETE
andChanger.ChangeMode.RESET
this can return any non-null array to mark them as supported.
-
change
- Parameters:
what
- The objects to changedelta
- An array with one or more instances of one or more of the the classes returned byacceptChange(ChangeMode)
for the given change mode (null forChanger.ChangeMode.DELETE
andChanger.ChangeMode.RESET
). This can be a Object[], thus casting is not allowed.mode
-- Throws:
UnsupportedOperationException
- (optional) if this method was called on an unsupported ChangeMode.
-