Class IMMOBILIZE
IMMOBILIZE completely paralyzes the affected player by preventing all forms of movement and interaction. The effect cancels all movement-related events (movement, velocity changes, flight toggling, sprinting, sneaking) as well as player interaction events to ensure the player cannot perform any action. The player is effectively frozen in place for the duration of the effect.
Mechanism:
- Player movement events are cancelled
- Velocity changes are cancelled
- Flight toggling is cancelled
- Sneak toggling is cancelled
- Sprint toggling is cancelled
- Interaction events (block breaking, placing, etc.) are cancelled
- Detectable by mind-reading spells (Legilimens)
- Detection text: "is unable to move"
-
Field Summary
Fields inherited from class net.pottercraft.ollivanders2.effect.O2Effect
affectedPlayerText, duration, effectType, informousText, kill, legilimensText, p, permanent, targetID -
Constructor Summary
ConstructorsConstructorDescriptionIMMOBILIZE(@NotNull Ollivanders2 plugin, int duration, boolean isPermanent, @NotNull UUID pid) Constructor for creating a complete immobilization effect. -
Method Summary
Modifier and TypeMethodDescriptionvoidAge the immobilize effect each game tick.voiddoRemove()Perform cleanup when the immobilization effect is removed.Methods inherited from class net.pottercraft.ollivanders2.effect.O2Effect
age, getAffectedPlayerText, getInformousText, getLegilimensText, getMaxDuration, getMinDuration, getRemainingDuration, getTargetID, isKilled, isPermanent, kill, setPermanent
-
Constructor Details
-
IMMOBILIZE
public IMMOBILIZE(@NotNull @NotNull Ollivanders2 plugin, int duration, boolean isPermanent, @NotNull @NotNull UUID pid) Constructor for creating a complete immobilization effect.Creates an effect that completely paralyzes the target player, preventing all movement and interaction. Sets the detection text for mind-reading spells to "is unable to move".
- Parameters:
plugin- a callback to the MC pluginduration- the duration of the immobilization effect in game ticksisPermanent- is this effect permanent (does not age)pid- the unique ID of the player to immobilize
-
-
Method Details
-
checkEffect
public void checkEffect()Age the immobilize effect each game tick.Called each game tick. This effect tracks its remaining duration. All movement prevention is handled through event cancellation in the various event handler methods. When the duration reaches zero, the effect is automatically killed and removed from the player.
- Specified by:
checkEffectin classO2Effect
-
doRemove
public void doRemove()Perform cleanup when the immobilization effect is removed.The default implementation does nothing, as the immobilization effect has no persistent state to clean up. When removed, the player regains normal control over movement and interaction.
-