Package stawa.vitalstrike.systems
Class KnockdownManager
java.lang.Object
stawa.vitalstrike.systems.KnockdownManager
Manages the knockdown system in VitalStrike, handling player states when they are downed in combat.
This system allows players to be temporarily incapacitated instead of dying instantly,
giving teammates a chance to revive them or allowing self-revival with special items.
-
Constructor Summary
ConstructorsConstructorDescriptionKnockdownManager(VitalStrike plugin) Initializes the KnockdownManager with configuration settings from the plugin. -
Method Summary
Modifier and TypeMethodDescriptionvoidattemptSelfRevive(org.bukkit.entity.Player player) Attempts to initiate a self-revival process for a downed player using a Vital Awakening item.voidcancelSelfRevive(org.bukkit.entity.Player player) Cancels an ongoing self-revival attempt for a player.voidcleanup()Performs cleanup of all active knockdown-related tasks and resources.voidhandlePlayerDeath(org.bukkit.entity.Player player) Handles the knockdown state when a player would normally die.voidhandlePlayerJoin(org.bukkit.entity.Player player) Handles necessary state updates when a player joins the server.booleanisPlayerDowned(org.bukkit.entity.Player player) Checks if a player is currently in a downed state.voidstartRevive(org.bukkit.entity.Player reviver, org.bukkit.entity.Player target) Initiates the revival process for a downed player by another player.
-
Constructor Details
-
KnockdownManager
Initializes the KnockdownManager with configuration settings from the plugin.- Parameters:
plugin- The VitalStrike plugin instance- Throws:
Errors.ConfigurationException- If there are issues with the configuration values
-
-
Method Details
-
attemptSelfRevive
public void attemptSelfRevive(org.bukkit.entity.Player player) Attempts to initiate a self-revival process for a downed player using a Vital Awakening item. If instant use is enabled, the revival happens immediately. Otherwise, it starts a progress bar.- Parameters:
player- The player attempting to self-revive
-
cancelSelfRevive
public void cancelSelfRevive(org.bukkit.entity.Player player) Cancels an ongoing self-revival attempt for a player. Cleans up associated tasks and progress bars.- Parameters:
player- The player whose self-revival attempt should be cancelled
-
cleanup
public void cleanup()Performs cleanup of all active knockdown-related tasks and resources. This should be called when the plugin is being disabled or reloaded. -
handlePlayerDeath
public void handlePlayerDeath(org.bukkit.entity.Player player) Handles the knockdown state when a player would normally die. Sets up the downed state, effects, and countdown timer.- Parameters:
player- The player entering the knockdown state
-
handlePlayerJoin
public void handlePlayerJoin(org.bukkit.entity.Player player) Handles necessary state updates when a player joins the server. Ensures knockdown states are properly maintained across reconnects.- Parameters:
player- The player who joined the server
-
startRevive
public void startRevive(org.bukkit.entity.Player reviver, org.bukkit.entity.Player target) Initiates the revival process for a downed player by another player. Creates a progress bar and starts the revival countdown.- Parameters:
reviver- The player attempting to revive the downed playertarget- The downed player being revived
-
isPlayerDowned
public boolean isPlayerDowned(org.bukkit.entity.Player player) Checks if a player is currently in a downed state.- Parameters:
player- The player to check- Returns:
- true if the player is downed, false otherwise
-