ChatSentry Wiki
  • ChatSentry
  • Features
  • Compatibility details
  • Module list & info
  • FAQ
  • Perms & Cmds
    • Bypass & misc. permissions
    • Commands (and their permissions)
      • In-game view
      • In depth command usages
  • guides
  • Plugin installation & configuring guide
  • Network bridge setup guide
  • In depth Word & Phrase Filter block list setup
  • In depth Chat Executor guide & entry examples
  • Config guides
    • Main/core config guide
    • Module config guides
      • Admin Notifier
      • Anti Chat Flood
      • Anti Command Prefix
      • Anti Join Flood
      • Anti Parrot
      • Anti Statue Spambot
      • Auto Grammar
      • Auto Punisher
      • Cap Limiter
      • Chat Cooldown
      • Chat Executor
      • Command Spy
      • Link & Ad Blocker
      • Spam Blocker
      • Unicode Remover
      • Word & Phrase Filter
    • Lang file guide
  • contact
  • Get support, talk with other cs users, make suggestions, etc.
  • Plugin Files
    • Default plugin configs & other files
      • /ChatSentry
        • config.yml
        • lang.yml
        • storage.yml
        • changelog.txt
      • /ChatSentry/Modules
        • admin-notifier.yml
        • anti-chat-flood.yml
        • anti-command-prefix.yml
        • anti-join-flood.yml
        • anti-parrot.yml
        • anti-statue-spambot.yml
        • auto-grammar.yml
        • auto-punisher.yml
        • cap-limiter.yml
        • chat-cooldown.yml
        • chat-executor.yml
        • command-spy.yml
        • link-and-ad-blocker.yml
        • spam-blocker.yml
        • unicode-remover.yml
        • word-and-phrase-filter.yml
  • Misc info and resources
    • Preset word lists for the word and phrase filter
    • ChatSentry's SpigotMC Page
  • API
    • About
    • Accessing the API
    • API Documentation
      • Events
      • Methods
  • Development
    • v5 Changelog
    • Legacy Changelogs
      • v4 Changelog
      • v3 Changelog
      • v2 Changelog
      • v1 Changelog
  • legal
    • Terms of Use Agreement
Powered by GitBook
On this page
  • ModuleTriggerEvent
  • Violation types / supported modules
  • Context types
  • Code examples

Was this helpful?

  1. API
  2. API Documentation

Events

ModuleTriggerEvent

com.kixmc.csapi.api.ModuleTriggerEvent

This event is fired by ChatSentry whenever any (supported) modules are triggered by a player. It is not cancellable. You can use the below methods to get related information to the event:

// get the violation/detection type
APIViolationType getType()

// get the context in which this event was triggered from (chat, command, etc)
APITriggerContext getContext()

// get the player who triggered this event
Player getPlayer()

// get the message before running through the module
String getOldContent()

// get the message after ran through the module
String getNewContent()

// get return the blocked content
String getBlockedContent()

Violation types / supported modules

Any modules that have a violation/detection (APIViolationType) type associated with them are supported by this event. The below are valid detection types:

  • ON_COOLDOWN

  • LINK_OR_AD_BLOCK

  • MESSAGE_FILTER_BLOCK

  • WORD_REPLACER_REPLACE (legacy)

  • SPAM_BLOCK

  • UNICODE_CHARACTER_BLOCK

  • CAP_LIMITER_BLOCK

  • ANTI_PARROT_BLOCK

  • ANTI_CHAT_FLOOD_BLOCK

  • ANTI_STATUE_SPAMBOT_BLOCK

  • ANTI_JOIN_FLOOD_BLOCK

  • CHAT_MODIFIER_MODIFY (legacy)

  • CHAT_EXECUTOR_MATCH

Context types

Below are the valid APITriggerContext types:

  • CHAT

  • COMMAND

  • ANVIL

  • BOOK

  • SIGN

  • JOIN

  • OTHER (as of 4.2.0 this context is never used)

Code examples

For testing if everything is working properly

@EventHandler
public void onModuleTrigger(ModuleTriggerEvent e) {
    Bukkit.broadcastMessage("Module trigger event fired! Details:");
    Bukkit.broadcastMessage("Trigger player: " + e.getPlayer().getName());
    Bukkit.broadcastMessage("Trigger type: " + e.getType().toString());
    Bukkit.broadcastMessage("Trigger context: " + e.getContext());
    Bukkit.broadcastMessage("Original msg: " + e.getOldContent());
    Bukkit.broadcastMessage("New msg: " + e.getNewContent());
    Bukkit.broadcastMessage("Blocked content: " + e.getBlockedContent());
}

Checking contexts and types

@EventHandler
public void onModuleTrigger(ModuleTriggerEvent e) {
    if (e.getContext() == APITriggerContext.BOOK && e.getType() == APIViolationType.UNICODE_CHARACTER_BLOCK) {
        // do something only if context was a book and detection type was from the unicode remover
    }
}

PreviousAPI DocumentationNextMethods

Last updated 4 years ago

Was this helpful?