Class IMMOBILIZE

java.lang.Object
net.pottercraft.ollivanders2.effect.O2Effect
net.pottercraft.ollivanders2.effect.IMMOBILIZE

public class IMMOBILIZE extends O2Effect
Complete immobilization effect that prevents all player movement and actions.

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"
  • 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 plugin
      duration - the duration of the immobilization effect in game ticks
      isPermanent - 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:
      checkEffect in class O2Effect
    • 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.

      Specified by:
      doRemove in class O2Effect