Class BABBLING
- Direct Known Subclasses:
LAUGHING,LYCANTHROPY_SPEECH,SLEEP_SPEECH
The BABBLING effect causes affected players to be unable to speak clearly, replacing their chat messages with random nonsense words. When the effect is active, on each chat message the player sends, there is an affectPercent% chance (default 100%) that the message will be replaced with gibberish consisting of 1-5 randomly selected nonsense words from an internal dictionary.
Mechanism:
- On each chat message: generates a random value 0-99
- If random value is less than affectPercent, the message is replaced with nonsense
- Nonsense messages consist of 1 to maxWords (default 5) randomly selected gibberish words
- Dictionary contains 40+ nonsense words from Harry Potter and literature sources
- Effect is detectable by information spells (Informous)
- Can be permanent (won't age) or temporary (will expire)
-
Field Summary
FieldsModifier and TypeFieldDescriptionCollection of 40+ nonsense words used to generate babbling speech.Fields inherited from class net.pottercraft.ollivanders2.effect.O2Effect
affectedPlayerText, duration, effectType, informousText, kill, legilimensText, p, permanent, targetID -
Constructor Summary
ConstructorsConstructorDescriptionBABBLING(@NotNull Ollivanders2 plugin, int duration, boolean isPermanent, @NotNull UUID pid) Constructor for creating a babbling effect. -
Method Summary
Modifier and TypeMethodDescriptionvoidAge the babbling effect to track its remaining duration.voiddoRemove()Perform cleanup when the babbling effect is removed.Methods inherited from class net.pottercraft.ollivanders2.effect.O2Effect
age, getAffectedPlayerText, getInformousText, getLegilimensText, getMaxDuration, getMinDuration, getRemainingDuration, getTargetID, isKilled, isPermanent, kill, setPermanent
-
Field Details
-
dictionary
Collection of 40+ nonsense words used to generate babbling speech.This dictionary contains nonsense words from the Harry Potter universe (mimble, oddment, nitwit), classic literature (jabberwock, slithy toves), and whimsical language sources (flummadiddle, razzmatazz). When generating a babbling message, 1 to maxWords random words are selected from this dictionary and concatenated with spaces to form the replacement chat message.
-
-
Constructor Details
-
BABBLING
public BABBLING(@NotNull @NotNull Ollivanders2 plugin, int duration, boolean isPermanent, @NotNull @NotNull UUID pid) Constructor for creating a babbling effect.Creates an effect that forces a player to speak gibberish by replacing their chat messages with nonsense. Sets both information and mind-reading detection text to "is unable to speak clearly".
- Parameters:
plugin- a callback to the MC pluginduration- the duration of the babbling effect in game ticksisPermanent- is this effect permanent (does not age)pid- the unique ID of the player to affect with babbling
-
-
Method Details
-
checkEffect
public void checkEffect()Age the babbling effect to track its remaining duration.Called each game tick to decrement the effect's duration. The actual babbling message replacement is handled by the event handler method (doOnAsyncPlayerChatEvent). If the effect is permanent, it does not age and will persist indefinitely.
- Specified by:
checkEffectin classO2Effect
-
doRemove
public void doRemove()Perform cleanup when the babbling effect is removed.The default implementation does nothing, as the babbling effect has no state to clean up. When removed, the player is simply allowed to speak normally again.
-