Staff++
latest
latest
  • Staff++
  • General information
    • Quick start
    • Reload Configuration
    • Multi Server Setup
    • General Configuration
    • Other
      • Text parsing
      • Styling the GUIs
        • Gui structure
        • Selectors
      • Configuring command hooks
  • Permissions & Commands
    • Commands
    • Permissions
      • Legacy permissions
  • Features
    • Alerts
      • X-Ray
    • Alt account detection
    • Authentication
    • Banning
      • IP Banning
        • Messages
      • Fixed Ban Reason
      • Templates
    • Blacklist
    • Broadcasting
    • Chat module
    • Chest/Inventory Interaction
    • Command detection
    • Examine players
    • Freezing
      • Command hooks
      • Luckperms integration
      • Chat channels
    • Infractions
    • Investigate
      • Command hooks
    • Join messages
    • Player IPs
    • Kicking
    • Muting
      • Appealing
    • Protection
    • Player information
    • Player notes
    • Reporting
      • Command hooks
      • Messages
      • Finding reports
      • Report types & Reasons
      • Chat channels
    • Staff Chat
    • Staff Mode
      • Multiple modes
      • Staff Modules
      • Custom Staff Modules
        • State dependent modules
      • Command hooks
      • Luckperms integration
    • Staff Locations
    • Teleporting
    • Vanish
      • Luckperms integration
    • Warnings
      • Quick start
      • Severity levels
      • Thresholds
      • Actions (punishments)
      • Appealing
      • Warning workflow
  • Web Platform
    • Register Players
    • Setup Web Platform
    • Architecture
  • Integrations
    • Discord Integration
      • Staff Chat
      • Template Packs
      • Customize Discord Templates
    • Trello Integration
    • PAPI expansion
      • PAPI Examples
  • Migration guides
    • Staff+ migration guide
    • Migrating to >=V1.16.43
    • Upgrading Discord Integration to 1.16.51
  • Developers
    • API guide
Powered by GitBook
On this page
  • custom module config
  • Modes config
  • Examples
  • Nightvision modules
  • Modes config

Was this helpful?

  1. Features
  2. Staff Mode
  3. Custom Staff Modules

State dependent modules

This page describes the setup to create state dependent modules. These modules can be used to dynamically show/hide staff items by activating other staff items. Example and use cases below.

custom module config

Each custom module can configure these 3 optional configuration parameters:

option
description

enabled-on-state

A string value which defines that this module should only get enabled when the given state is active

enable-state

Tell staff++ to enable this state when the module is executed.

disable-state

Tell staff++ to disable this state when the module is executed.

Modes config

In the modes config we can specify which states should be active when entering the mode:

modes:
  default:
    ...
    initial-item-states:
    - nightvision-off

Using this system we can create modules which are enabled only on certain states. Because state changes can be done by staff modules themselves we can create some flexible configurations.

Examples

Nightvision modules

We defined 2 modules. 1 for toggling night mode on. And one for turning it off. The first module switches the state to nightvision-on This state change makes it so that the second module will be enabled and shown inside the player's inventory. Vice versa the second module triggers the state to nightvision-off

custom-modules.yml
custom-modules:
  - name: TurnOnNightVisionModule
    enabled: true
    enabled-on-state: nightvision-off
    enable-state: nightvision-on
    disable-state: nightvision-off
    type: COMMAND_STATIC
    item: 
      type: OBSIDIAN
      name: '&bEnables night vision'
      lore: '&7Click to enable night vision'
    commands: 
       - "nightvision on"
  - name: TurnOffNightVisionModule
    enabled: true
    enabled-on-state: nightvision-on
    enable-state: nightvision-off
    disable-state: nightvision-on
    type: COMMAND_STATIC
    item: 
      type: DIAMOND
      name: '&bDisables night vision'
      lore: '&7Click to disable night vision'
    commands: 
       - "nightvision off"

Modes config

To configure the mode I did the following:

  • disable the default night vision of staff mode

  • Disable night vision when exiting staff mode

  • Set initial state to night vision off. So when you enter staff mode the obsidian block will be in your inventory

  • We defined the module on the same inventory location. Due to the state only one will be shown at a time.

modes:
  default:
    # other config here
    ...
    night-vision: false
    disable-commands:
    - command: nightvision off %staff%
    initial-item-states:
    - nightvision-off
    gui:
    - TurnOnNightVisionModule:1
    - TurnOffNightVisionModule:1
PreviousCustom Staff ModulesNextCommand hooks

Last updated 1 year ago

Was this helpful?