Class DANCING_FEET
The DANCING_FEET effect causes affected players to dance uncontrollably by repeatedly toggling their sneak state at half-second intervals (10 ticks). Each cycle alternates between sneaking and standing, with a random directional rotation (0-360 degrees) applied before teleporting the player to the new location. The teleportation is delayed by 5 ticks to prevent all movements from happening simultaneously.
Mechanism:
- Sneak state toggled every half-second (10 tick cooldown)
- Random rotation (0-360 degrees) applied each cycle
- Player teleported to new location with 5-tick delay
- Player movement events cancelled to prevent manual control
- Sneak and sprint toggles cancelled to prevent state override
- Detectable by information spells (Informous)
- Informs player "You start dancing" on application
-
Field Summary
Fields inherited from class net.pottercraft.ollivanders2.effect.O2Effect
affectedPlayerText, duration, effectType, informousText, kill, legilimensText, p, permanent, targetID -
Constructor Summary
ConstructorsConstructorDescriptionDANCING_FEET(@NotNull Ollivanders2 plugin, int duration, boolean isPermanent, @NotNull UUID pid) Constructor for creating a dancing feet uncontrollable movement effect. -
Method Summary
Modifier and TypeMethodDescriptionvoidAge the effect and apply periodic sneak toggles with delayed teleportation.voiddoRemove()Perform cleanup when the dancing 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
-
DANCING_FEET
public DANCING_FEET(@NotNull @NotNull Ollivanders2 plugin, int duration, boolean isPermanent, @NotNull @NotNull UUID pid) Constructor for creating a dancing feet uncontrollable movement effect.Creates an effect that forces the player to dance uncontrollably by repeatedly toggling their sneak state and teleporting them with random rotations. Sets information detection text to "cannot control their feet" and affected player text to "You start dancing" to notify the player they are affected.
- Parameters:
plugin- a callback to the MC pluginduration- the duration of the effect in game ticksisPermanent- is this effect permanent (does not age)pid- the unique ID of the player to affect with dancing
-
-
Method Details
-
checkEffect
public void checkEffect()Age the effect and apply periodic sneak toggles with delayed teleportation.Called each game tick. This method:
- Ages the effect (decrements duration until expiration)
- Decrements the cooldownCounter by 1 each tick
- When cooldownCounter reaches 0, executes a dance cycle:
- Resets cooldownCounter to cooldown (10 ticks)
- Toggles player sneak state (returns early if turning sneak ON to split toggles across ticks)
- Generates random rotation (0-360 degrees)
- Schedules teleportation 5 ticks later with the new rotated location
- Specified by:
checkEffectin classO2Effect
-
doRemove
public void doRemove()Perform cleanup when the dancing effect is removed.The default implementation does nothing, as the dancing effect has no persistent state to clean up. The player regains normal control over movement once the effect expires or is killed.
-