Package redempt.redlib.enchants.trigger
Class EnchantTrigger<T extends org.bukkit.event.Event>
java.lang.Object
redempt.redlib.enchants.trigger.EnchantTrigger<T>
- Type Parameters:
 T- The event type this EventTrigger passes
- Direct Known Subclasses:
 KillEntityTrigger
Represents a trigger for a CustomEnchant which will smartly pass relevant events
- 
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final EnchantTrigger<org.bukkit.event.entity.EntityDamageByEntityEvent>Calls activate with an EntityDamageByEntityEvent when a player attacks an entity with an item that has a CustomEnchant with this triggerstatic final EnchantTrigger<PlayerChangedArmorEvent>Calls activate with a PlayerChangedArmorEvent when a player equips armor that has a CustomEnchant with this trigger Also calls activate when a player joins wearing armor with this trigger Calls deactivate with a PlayerChangedArmorEvent when a player unequips armor that has a CustomEnchant with this trigger Also calls deactivate when a player leaves wearing armor with this triggerprotected Map<Class<? extends org.bukkit.event.Event>,Function<org.bukkit.event.Event, EventItems>> static final EnchantTrigger<PlayerChangedHeldItemEvent>Calls activate with a PlayerChangedHeldItemEvent when a player begins holding an item that has a CustomEnchant with this trigger Also calls activate when a player joins holding an item with this trigger Calls deactivate with a PlayerChangedHeldItemEvent when a player stops holding an item that has a CustomEnchant with this trigger Also calls deactivate when a player leaves holding an item with this triggerstatic final EnchantTrigger<org.bukkit.event.entity.EntityDeathEvent>Calls activate with an EntityDeathEvent when a player kills an entity with an item that has a CustomEnchant with this triggerstatic final EnchantTrigger<org.bukkit.event.block.BlockBreakEvent>Calls activate with a BlockBreakEvent when a block is broken with an item that has a CustomEnchant with this triggerstatic final EnchantTrigger<org.bukkit.event.entity.ProjectileLaunchEvent>Calls activate with a ProjectileLaunchEvent when a player shoots a projectile with an item that has a CustomEnchant with this triggerstatic final EnchantTrigger<org.bukkit.event.entity.EntityDamageEvent>Calls activate with an EntityDamageEvent when a player takes damage wearing armor that has a CustomEnchant with this trigger - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionprotected <T extends org.bukkit.event.Event>
voidaddListener(Class<T> eventClass, Function<T, EventItems> func) Registers a listener for this EventTrigger to get the items and event for the specified eventabstract booleandefaultAppliesTo(org.bukkit.Material type) Returns whether this EnchantTrigger applies to the given type by defaultMap<Class<? extends org.bukkit.event.Event>,Function<org.bukkit.event.Event, EventItems>> Gets the event listeners registered by this EnchantTriggerorg.bukkit.event.EventPriorityfinal voidinit()protected abstract voidregister()withPriority(org.bukkit.event.EventPriority priority) Creates a copy of this EnchantTrigger with a different EventPriority 
- 
Field Details
- 
MINE_BLOCK
Calls activate with a BlockBreakEvent when a block is broken with an item that has a CustomEnchant with this trigger - 
ATTACK_ENTITY
Calls activate with an EntityDamageByEntityEvent when a player attacks an entity with an item that has a CustomEnchant with this trigger - 
KILL_ENTITY
Calls activate with an EntityDeathEvent when a player kills an entity with an item that has a CustomEnchant with this trigger - 
SHOOT_ARROW
Calls activate with a ProjectileLaunchEvent when a player shoots a projectile with an item that has a CustomEnchant with this trigger - 
TAKE_DAMAGE
Calls activate with an EntityDamageEvent when a player takes damage wearing armor that has a CustomEnchant with this trigger - 
EQUIP_ARMOR
Calls activate with a PlayerChangedArmorEvent when a player equips armor that has a CustomEnchant with this trigger Also calls activate when a player joins wearing armor with this trigger Calls deactivate with a PlayerChangedArmorEvent when a player unequips armor that has a CustomEnchant with this trigger Also calls deactivate when a player leaves wearing armor with this trigger - 
HOLD_ITEM
Calls activate with a PlayerChangedHeldItemEvent when a player begins holding an item that has a CustomEnchant with this trigger Also calls activate when a player joins holding an item with this trigger Calls deactivate with a PlayerChangedHeldItemEvent when a player stops holding an item that has a CustomEnchant with this trigger Also calls deactivate when a player leaves holding an item with this trigger - 
events
protected Map<Class<? extends org.bukkit.event.Event>,Function<org.bukkit.event.Event, eventsEventItems>>  
 - 
 - 
Constructor Details
- 
EnchantTrigger
public EnchantTrigger() 
 - 
 - 
Method Details
- 
register
protected abstract void register() - 
init
public final void init() - 
addListener
protected <T extends org.bukkit.event.Event> void addListener(Class<T> eventClass, Function<T, EventItems> func) Registers a listener for this EventTrigger to get the items and event for the specified event- Type Parameters:
 T- The event type- Parameters:
 eventClass- The class of the eventfunc- The function to get the EventItems from the event
 - 
getEvents
public Map<Class<? extends org.bukkit.event.Event>,Function<org.bukkit.event.Event, getEvents()EventItems>> Gets the event listeners registered by this EnchantTrigger- Returns:
 - The map of events to their functions which will retrieve relevant items
 
 - 
getPriority
public org.bukkit.event.EventPriority getPriority()- Returns:
 - The EventPriority this EnchantTrigger's listeners should be registered with
 
 - 
defaultAppliesTo
public abstract boolean defaultAppliesTo(org.bukkit.Material type) Returns whether this EnchantTrigger applies to the given type by default- Parameters:
 type- The type to check- Returns:
 - Whether this EnchantTrigger applies to the type by default
 
 - 
withPriority
Creates a copy of this EnchantTrigger with a different EventPriority- Parameters:
 priority- The EventPriority to set on the copy- Returns:
 - A copy of this EnchantTrigger with the given priority
 
 
 -