Class ContextFactory
java.lang.Object
io.artificial.enchantments.internal.ContextFactory
Factory for creating EffectContext implementations based on Bukkit events.
This factory extracts relevant data from Bukkit events and creates the appropriate context implementation for each dispatch event type.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable EffectContextcreateContext(EffectDispatchSpine.DispatchEventType eventType, @NotNull EnchantmentDefinition enchantment, int level, double scaledValue, @NotNull org.bukkit.event.Event bukkitEvent, @Nullable org.bukkit.inventory.EquipmentSlot slot) Creates the appropriate context for the given event type.
-
Constructor Details
-
ContextFactory
public ContextFactory()Creates a new context factory.
-
-
Method Details
-
createContext
@Nullable public @Nullable EffectContext createContext(@NotNull EffectDispatchSpine.DispatchEventType eventType, @NotNull @NotNull EnchantmentDefinition enchantment, int level, double scaledValue, @NotNull @NotNull org.bukkit.event.Event bukkitEvent, @Nullable @Nullable org.bukkit.inventory.EquipmentSlot slot) Creates the appropriate context for the given event type.- Parameters:
eventType- the type of event being dispatchedenchantment- the enchantment definitionlevel- the enchantment levelscaledValue- the calculated scaled valuebukkitEvent- the underlying Bukkit eventslot- the equipment slot (may be null)- Returns:
- the created context, or null if the event type is not supported
-