Class O2Potion
java.lang.Object
net.pottercraft.ollivanders2.potion.O2Potion
- Direct Known Subclasses:
ANIMAGUS_POTION,BABBLING_BEVERAGE,BARUFFIOS_BRAIN_ELIXIR,COMMON_ANTIDOTE_POTION,CURE_FOR_BOILS,DRAUGHT_OF_LIVING_DEATH,FORGETFULNESS_POTION,HUNGER_POTION,ICE_POTION,MEMORY_POTION,O2SplashPotion,OCULUS_FELIS,REGENERATION_POTION,SATIATION_POTION,SHRINKING_SOLUTION,SLEEPING_DRAUGHT,STRENGTHENING_SOLUTION,SWELLING_SOLUTION,WEAKNESS_POTION,WIDEYE_POTION,WIT_SHARPENING_POTION,WOLFSBANE_POTION
Ollivanders2 magical potion.
O2Potions can have either or both of the following types of effects:
PotionEffect - this is a standard Minecraft potion effect such as Night Vision and is set in the item metadata in the brew().
Ollivanders Effect - effects related to the mechanics of the Ollivanders plugin. These are applied on the potion
drink action in OllivandersListener in the onPlayerDrink().
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intThe duration for this potionFlavor text for this potion in books, etc.protected Map<O2ItemType, Integer> The ingredients list for this potion.protected org.bukkit.ColorColor of this potion.protected StringThe success message to send when this potion is consumedprotected O2PotionTypeThe type this potion is.protected StringThe description text for this potion in books.doubleThe modifier for this potion based on usage. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull org.bukkit.inventory.ItemStackbrew(@NotNull org.bukkit.entity.Player brewer, boolean checkCanBrew) Brew this potion.static @NotNull org.bukkit.inventory.ItemStackBrew a random bad potion.booleancheckRecipe(@NotNull Map<O2ItemType, Integer> cauldronIngredients) Check the recipe for this potion against a set of ingredients.org.bukkit.inventory.ItemStackcreatePotionItemStack(int amount) Create an ItemStack for this potion with the specified amount.abstract voiddrink(@NotNull org.bukkit.entity.Player player) Drink this potion and do effects@Nullable StringGet the flavor text for this potion.@NotNull Map<O2ItemType, Integer> Get the ingredients list for this potionprotected @NotNull StringGet the ingredients text for this potion@NotNull MagicLevelgetLevel()Get the level of magic for this potion@NotNull O2MagicBranchGet the branch of magic for this potion@NotNull StringgetName()Get the name of this potion@NotNull StringGet the potion success message used in drink()@NotNull O2PotionTypeGet the type of this potion.@NotNull StringgetText()Get the description text for this potion.protected voidsetUsesModifier(@NotNull O2Player o2p) Sets the uses modifier that takes into account potion brew count and level, if years is enabled.
-
Field Details
-
potionType
The type this potion is. -
ingredients
The ingredients list for this potion. -
text
The description text for this potion in books. Required or potion cannot be written in a book. -
flavorText
Flavor text for this potion in books, etc. Optional. -
potionColor
protected org.bukkit.Color potionColorColor of this potion. -
duration
protected int durationThe duration for this potion -
usesModifier
public double usesModifierThe modifier for this potion based on usage. -
potionSuccessMessage
The success message to send when this potion is consumed
-
-
Constructor Details
-
O2Potion
Constructor- Parameters:
plugin- a callback to the plugin
-
-
Method Details
-
getIngredientsText
Get the ingredients text for this potion- Returns:
- the recipe text for this ingredient
-
getPotionType
Get the type of this potion.- Returns:
- the type of potion
-
getName
Get the name of this potion- Returns:
- the name of the potion
-
getIngredients
Get the ingredients list for this potion- Returns:
- a Map of the ingredients for this potion
-
getText
Get the description text for this potion. This can be used to write books, for lessons, or other in-game messages. Description text is required for adding a spell to an Ollivanders2 book.- Returns:
- the description text for this potion
-
getFlavorText
Get the flavor text for this potion. This can be used to make books, lessons, and other descriptions of spells more interesting. Flavor text is optional.- Returns:
- the flavor text for this potion.
-
getMagicBranch
Get the branch of magic for this potion- Returns:
- the branch of magic for this potion
-
getLevel
Get the level of magic for this potion- Returns:
- the level of magic for this potion
-
getPotionSuccessMessage
Get the potion success message used in drink()- Returns:
- the potion success message
-
checkRecipe
Check the recipe for this potion against a set of ingredients.- Parameters:
cauldronIngredients- the ingredients found in the cauldron- Returns:
- true if the ingredient list matches this potion recipe exactly, false otherwise
-
brew
@NotNull public @NotNull org.bukkit.inventory.ItemStack brew(@NotNull @NotNull org.bukkit.entity.Player brewer, boolean checkCanBrew) Brew this potion.- Parameters:
brewer- the player brewing the potioncheckCanBrew- should we enforce checking if the brewer can brew or not- Returns:
- an ItemStack with a single bottle of this potion
-
createPotionItemStack
public org.bukkit.inventory.ItemStack createPotionItemStack(int amount) Create an ItemStack for this potion with the specified amount.Sets up the potion metadata including display name, color, custom effects, and NBT tags for potion type identification.
- Parameters:
amount- the number of potions in the ItemStack- Returns:
- an ItemStack containing the potion, or a bad potion if metadata creation fails
-
brewBadPotion
@NotNull public static @NotNull org.bukkit.inventory.ItemStack brewBadPotion()Brew a random bad potion.- Returns:
- a random bad potion
-
drink
public abstract void drink(@NotNull @NotNull org.bukkit.entity.Player player) Drink this potion and do effects- Parameters:
player- the player who drank the potion
-
setUsesModifier
Sets the uses modifier that takes into account potion brew count and level, if years is enabled.- Parameters:
o2p- the player who is brewing the potion
-