Class BABBLING

java.lang.Object
net.pottercraft.ollivanders2.effect.O2Effect
net.pottercraft.ollivanders2.effect.BABBLING
Direct Known Subclasses:
LAUGHING, LYCANTHROPY_SPEECH, SLEEP_SPEECH

public class BABBLING extends O2Effect
Effect that forces a player to speak gibberish instead of coherent sentences.

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 Details

    • dictionary

      public ArrayList<String> 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 plugin
      duration - the duration of the babbling effect in game ticks
      isPermanent - 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:
      checkEffect in class O2Effect
    • 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.

      Specified by:
      doRemove in class O2Effect