Class EventValues
java.lang.Object
ch.njol.skript.registrations.EventValues
Deprecated, for removal: This API element is subject to removal in a future version.
Use
EventValueRegistry instead.
Obtain an instance using SkriptAddon#registry(EventValueRegistry.class).
Or an unmodifiable view using Skript.instance().registry(EventValueRegistry.class).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordEventValues.EventValueInfo<E extends org.bukkit.event.Event, T>Deprecated, for removal: This API element is subject to removal in a future version. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDeprecated.static final intDeprecated.UseEventValue.Time.NOWinstead.static final intDeprecated.UseEventValue.Time.PASTinstead. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleandoesEventValueHaveTimeStates(Class<? extends org.bukkit.event.Event> eventClass, Class<?> valueClass) Deprecated, for removal: This API element is subject to removal in a future version.static booleandoesExactEventValueHaveTimeStates(Class<? extends org.bukkit.event.Event> eventClass, Class<?> valueClass) Deprecated, for removal: This API element is subject to removal in a future version.static <T, E extends org.bukkit.event.Event>
TgetEventValue(E event, Class<T> valueClass, int time) Deprecated.static <T, E extends org.bukkit.event.Event>
@Nullable Converter<? super E, ? extends T> getEventValueConverter(Class<E> eventClass, Class<T> valueClass, int time) Deprecated.static @Unmodifiable List<EventValues.EventValueInfo<?, ?>> getEventValuesListForTime(int time) Deprecated.UseEventValueRegistry.elements(EventValue.Time)instead.static <E extends org.bukkit.event.Event, T>
@Nullable Converter<? super E, ? extends T> getExactEventValueConverter(Class<E> eventClass, Class<T> valueClass, int time) Deprecated.static com.google.common.collect.Multimap<Class<? extends org.bukkit.event.Event>, EventValues.EventValueInfo<?, ?>> Deprecated, for removal: This API element is subject to removal in a future version.static int[]Deprecated, for removal: This API element is subject to removal in a future version.All supported time states for an event value.static <T, E extends org.bukkit.event.Event>
KleeneanhasMultipleConverters(Class<E> eventClass, Class<T> valueClass, int time) Deprecated, for removal: This API element is subject to removal in a future version.Checks if an event has multipleConverters, including default ones.static <T, E extends org.bukkit.event.Event>
voidregisterEventValue(Class<E> eventClass, Class<T> valueClass, Converter<E, T> converter) Deprecated.UseEventValueRegistry.register(EventValue)instead.static <T, E extends org.bukkit.event.Event>
voidregisterEventValue(Class<E> eventClass, Class<T> valueClass, Converter<E, T> converter, int time) Deprecated.UseEventValueRegistry.register(EventValue)instead.static <T, E extends org.bukkit.event.Event>
voidregisterEventValue(Class<E> eventClass, Class<T> valueClass, Converter<E, T> converter, int time, @Nullable String excludeErrorMessage, @Nullable Class<? extends E>... excludes) Deprecated.UseEventValueRegistry.register(EventValue)instead.static voidsetEventValueRegistry(EventValueRegistry registry) Deprecated, for removal: This API element is subject to removal in a future version.
-
Field Details
-
TIME_PAST
public static final int TIME_PASTDeprecated.UseEventValue.Time.PASTinstead.The past value of an event value. Represented by "past" or "former". -
TIME_NOW
public static final int TIME_NOWDeprecated.UseEventValue.Time.NOWinstead.The current time of an event value. -
TIME_FUTURE
public static final int TIME_FUTUREDeprecated.UseEventValue.Time.FUTUREinstead.The future time of an event value.
-
-
Method Details
-
setEventValueRegistry
Deprecated, for removal: This API element is subject to removal in a future version. -
getEventValuesListForTime
public static @Unmodifiable List<EventValues.EventValueInfo<?,?>> getEventValuesListForTime(int time) Deprecated.UseEventValueRegistry.elements(EventValue.Time)instead.Get Event Values list for the specified time- Parameters:
time- The time of the event values. One ofTIME_PAST,TIME_NOWorTIME_FUTURE.- Returns:
- An immutable copy of the event values list for the specified time
-
registerEventValue
public static <T, E extends org.bukkit.event.Event> void registerEventValue(Class<E> eventClass, Class<T> valueClass, Converter<E, T> converter) Deprecated.UseEventValueRegistry.register(EventValue)instead. Build anEventValueusingEventValue.builder(Class, Class).Registers an event value, specified by the providedConverter, with excluded events. Uses the default time,TIME_NOW.- See Also:
-
registerEventValue
public static <T, E extends org.bukkit.event.Event> void registerEventValue(Class<E> eventClass, Class<T> valueClass, Converter<E, T> converter, int time) Deprecated.UseEventValueRegistry.register(EventValue)instead. Build anEventValueusingEventValue.builder(Class, Class).Registers an event value.- Parameters:
eventClass- the event class.valueClass- the return type of the converter for the event value.converter- the converter to get the value with the provided eventClass.time- value of TIME_PAST if this is the value before the eventClass, TIME_FUTURE if after, and TIME_NOW if it's the default or this value doesn't have distinct states. Always register a default state! You can leave out one of the other states instead, e.g. only register a default and a past state. The future state will default to the default state in this case.
-
registerEventValue
@SafeVarargs public static <T, E extends org.bukkit.event.Event> void registerEventValue(Class<E> eventClass, Class<T> valueClass, Converter<E, T> converter, int time, @Nullable @Nullable String excludeErrorMessage, @Nullable @Nullable Class<? extends E>... excludes) Deprecated.UseEventValueRegistry.register(EventValue)instead. Build anEventValueusingEventValue.builder(Class, Class).Registers an event value and with excluded events. Excluded events are events that this event value can't operate in.- Parameters:
eventClass- the event class.valueClass- the return type of the converter for the event value.converter- the converter to get the value with the provided eventClass.time- value of TIME_PAST if this is the value before the eventClass, TIME_FUTURE if after, and TIME_NOW if it's the default or this value doesn't have distinct states. Always register a default state! You can leave out one of the other states instead, e.g. only register a default and a past state. The future state will default to the default state in this case.excludeErrorMessage- The error message to display when used in the excluded events.excludes- subclasses of the eventClass for which this event value should not be registered for
-
getEventValue
@Nullable public static <T, E extends org.bukkit.event.Event> T getEventValue(E event, Class<T> valueClass, int time) Deprecated.Gets a specific value from an eventClass. Returns null if the eventClass doesn't have such a value (conversions are done to try and get the desired value).- Parameters:
event- eventClassvalueClass- return type of gettertime- -1 if this is the value before the eventClass, 1 if after, and 0 if it's the default or this value doesn't have distinct states. Always register a default state! You can leave out one of the other states instead, e.g. only register a default and a past state. The future state will default to the default state in this case.- Returns:
- The event's value
- See Also:
-
getExactEventValueConverter
@Nullable public static <E extends org.bukkit.event.Event, T> @Nullable Converter<? super E, ? extends T> getExactEventValueConverter(Class<E> eventClass, Class<T> valueClass, int time) Deprecated.Checks that aConverterexists for the exact type. No converting or subclass checking.- Parameters:
eventClass- the event class the getter will be getting fromvalueClass- type ofConvertertime- the event-value's time- Returns:
- A getter to get values for a given type of events
- See Also:
-
hasMultipleConverters
-
getEventValueConverter
@Nullable public static <T, E extends org.bukkit.event.Event> @Nullable Converter<? super E, ? extends T> getEventValueConverter(Class<E> eventClass, Class<T> valueClass, int time) Deprecated.Returns aConverterto get a value from in an event.Can print an error if the event value is blocked for the given event.
-
doesExactEventValueHaveTimeStates
-
doesEventValueHaveTimeStates
-
getTimeStates
public static int[] getTimeStates()Deprecated, for removal: This API element is subject to removal in a future version.All supported time states for an event value.- Returns:
- An array of all the time states.
-
getPerEventEventValues
public static com.google.common.collect.Multimap<Class<? extends org.bukkit.event.Event>, EventValues.EventValueInfo<?,?>> getPerEventEventValues()Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
- All the event values for each registered event's class.
-
EventValue.Time.FUTUREinstead.