Class O2Divination
- Direct Known Subclasses:
ASTROLOGY,CARTOMANCY,CARTOMANCY_TAROT,CENTAUR_DIVINATION,CRYSTAL_BALL,OVOMANCY,TASSEOMANCY
Divination is a branch of magic that involves attempting to foresee the future or gather insights into past, present, and future events. This class provides the framework for creating randomized prophecies based on the specific divination method (astrology, cartomancy, crystal ball, etc.). Each divination subclass defines its own prophecy prefixes and accuracy level, which are combined with randomly selected effects to create a complete prophecy.
The prophecy generation process (divine()) follows a structured workflow:
- Calculate accuracy based on prophet's experience level and the divination method's maximum accuracy cap
- Select a random magical effect from the available divination effects pool
- Select a prophecy prefix from the subclass-specific list (method-specific phrasing)
- Determine the time of day and duration until the prophecy takes effect (1-4 days, varies by time)
- Construct a complete prophecy message combining all elements
- Create an O2Prophecy record and schedule the effect to occur at the designated time
Subclasses must define:
divinationType- The O2DivinationType constant for this divination methodmaxAccuracy- The maximum accuracy percentage this divination method can achieve (caps prophet experience)prophecyPrefixarray - Method-specific prefixes (e.g., "Due to the influence of Mars," for astrology)
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionO2Divination(@NotNull Ollivanders2 plugin, @NotNull org.bukkit.entity.Player prophet, @NotNull org.bukkit.entity.Player target, int experience) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoiddivine()Generate and execute a prophecy for the target player.
-
Constructor Details
-
O2Divination
public O2Divination(@NotNull @NotNull Ollivanders2 plugin, @NotNull @NotNull org.bukkit.entity.Player prophet, @NotNull @NotNull org.bukkit.entity.Player target, int experience) Constructor- Parameters:
plugin- a reference to the pluginprophet- the player making the prophecytarget- the player the prophecy is aboutexperience- the experience level of the prophet with this divination
-
-
Method Details
-
divine
public void divine()Generate and execute a prophecy for the target player.This method orchestrates the complete prophecy generation workflow:
- Calculates the prophet's accuracy based on their experience level (capped by method's maxAccuracy)
- Randomly selects a magical effect from the 21 available divination effects
- Randomly selects a prophecy prefix from the method-specific list
- Determines the prophecy timing (time of day and scheduled day offset)
- Constructs the complete prophecy message with all components
- Creates an O2Prophecy record and schedules the effect to trigger at the designated time
A complete prophecy message combines these components:
- Method-specific prefix (e.g., "Due to the influence of Mars," for astrology)
- Time of day (midnight, dawn, midday, sunset)
- Scheduled day (tomorrow, in two days, in three days, in four days)
- Target player's name
- Effect description from the selected magical effect
Example: "Due to the influence of Mars, at sunset tomorrow, Fred will fall into a deep sleep."
-