Class FLAGRANTE
When a player holds a flagrante-cursed item, they suffer continuous FLAGRANTE_BURNING damage.
The curse is applied whenever the player picks up or holds the cursed item, and removed when they no
longer hold it. Flagrante items cannot be picked up by hoppers or other block inventories, and they
will not despawn from the world.
Damage is calculated from magnitude: damage = magnitude / 20, clamped between 0.5 and 8.0.
- See Also:
-
Field Summary
Fields inherited from class net.pottercraft.ollivanders2.item.enchantment.Enchantment
args, common, enchantmentType, lore, magnitude, p -
Constructor Summary
ConstructorsConstructorDescriptionFLAGRANTE(@NotNull Ollivanders2 plugin, int mag, @Nullable String args, @Nullable String itemLore) Constructor for creating a flagrante curse enchantment instance. -
Method Summary
Modifier and TypeMethodDescriptionvoiddoEntityPickupItem(@NotNull org.bukkit.event.entity.EntityPickupItemEvent event) Apply the flagrante curse when a player picks up a cursed item.voiddoInventoryPickupItem(@NotNull org.bukkit.event.inventory.InventoryPickupItemEvent event) Prevent hoppers and other block inventories from picking up flagrante items.voiddoItemDrop(@NotNull org.bukkit.event.player.PlayerDropItemEvent event) Update curse status when a player drops a cursed item.voiddoItemHeld(@NotNull org.bukkit.event.player.PlayerItemHeldEvent event) No action needed for item held events.Methods inherited from class net.pottercraft.ollivanders2.item.enchantment.Enchantment
doItemDespawn, getArgs, getMagnitude, getName, getType, isHoldingEnchantedItem
-
Constructor Details
-
FLAGRANTE
public FLAGRANTE(@NotNull @NotNull Ollivanders2 plugin, int mag, @Nullable @Nullable String args, @Nullable @Nullable String itemLore) Constructor for creating a flagrante curse enchantment instance.Initializes the curse with a calculated damage value based on magnitude. The damage is computed as
magnitude / 20, then clamped betweenminDamageandmaxDamageto ensure balanced curse strength across all magnitude levels.- Parameters:
plugin- the Ollivanders2 plugin instancemag- the magnitude (power level) of this enchantment instanceargs- optional configuration arguments specific to this enchantment instanceitemLore- optional custom lore to display on the cursed item
-
-
Method Details
-
doEntityPickupItem
public void doEntityPickupItem(@NotNull @NotNull org.bukkit.event.entity.EntityPickupItemEvent event) Apply the flagrante curse when a player picks up a cursed item.Triggers
checkFlagranteStatus(Player)for the player picking up the item. Non-player entities are ignored since only players can be affected by the curse.- Specified by:
doEntityPickupItemin classEnchantment- Parameters:
event- the entity item pickup event
-
doInventoryPickupItem
public void doInventoryPickupItem(@NotNull @NotNull org.bukkit.event.inventory.InventoryPickupItemEvent event) Prevent hoppers and other block inventories from picking up flagrante items.Flagrante-cursed items are too dangerous for automated collection systems and will not be picked up by hoppers, droppers, or other block-based inventories.
- Specified by:
doInventoryPickupItemin classEnchantment- Parameters:
event- the inventory pickup event
-
doItemDrop
public void doItemDrop(@NotNull @NotNull org.bukkit.event.player.PlayerDropItemEvent event) Update curse status when a player drops a cursed item.When a player drops a flagrante item, re-evaluate their curse status in case they are no longer holding another cursed item. If they are, the curse continues; otherwise it is removed.
- Specified by:
doItemDropin classEnchantment- Parameters:
event- the item drop event
-
doItemHeld
public void doItemHeld(@NotNull @NotNull org.bukkit.event.player.PlayerItemHeldEvent event) No action needed for item held events.The flagrante curse is applied immediately when items enter the player's inventory (via
doEntityPickupItem(EntityPickupItemEvent)), so no additional handling is required when the player changes which item slot is held.- Specified by:
doItemHeldin classEnchantment- Parameters:
event- the item held event
-