Skip to main content

Usage Example

//// VCTActions.modifyTimer(modifier, value, sender?) ////

// Add 5 minutes to the timer
boolean success = VCTActions.modifyTimer("add", "00:05:00");

// Take 2 minutes from the timer
boolean success = VCTActions.modifyTimer("take", "00:02:00");

// Set the timer to 10 minutes exactly
boolean success = VCTActions.modifyTimer("set", "00:10:00");

// Change the BossBar color
boolean success = VCTActions.modifyTimer("bossbar_color", "RED");

// Change the BossBar style
boolean success = VCTActions.modifyTimer("bossbar_style", "SEGMENTED_10");

// Change the timer's display text
boolean success = VCTActions.modifyTimer("text", "&aTime left:&f %M1% %M2% : %S1% %S2%");

// Change the sound used when the timer updates
boolean success = VCTActions.modifyTimer("sound", "ENTITY_EXPERIENCE_ORB_PICKUP");

// Enable or disable sound playback
boolean success = VCTActions.modifyTimer("sound_enable", "true");

// Adjust sound volume (0.1 - 2.0)
boolean success = VCTActions.modifyTimer("sound_volume", "1.0");

// Adjust sound pitch (0.1 - 2.0)
boolean success = VCTActions.modifyTimer("sound_pitch", "1.5");

Behavior

  • The method requires that a timer already exists.
    • If no active timer is found, the method will fail and return false.
  • Available actions (modifier):
    ModifierDescription
    "add"Adds time to the current timer (HH:MM:SS format).
    "take"Subtracts time from the timer (HH:MM:SS format, not below 00:00:00).
    "set"Sets the timer to an exact duration.
    "bossbar_color"Changes the BossBar’s color. Must be a valid BarColor.
    "bossbar_style"Changes the BossBar’s style. Must be a valid BarStyle.
    "text"Updates the BossBar’s displayed text. Color codes (&) are supported.
    "sound"Sets the name of the sound effect used. Must be a valid sound identifier.
    "sound_enable"Enables or disables sound ("true" / "false").
    "sound_volume"Sets the sound volume (float between 0.1 and 2.0).
    "sound_pitch"Sets the sound pitch (float between 0.1 and 2.0).
  • When modified:
    • The BossBar and other settings update in real time.
    • The MODIFY event is triggered.
    • Config changes (color, style, sound, etc.) are persisted to the timer’s config file.

Parameters

modifier
string
required
Action to perform on the timer.The available actions are "add", "take", "set", "bossbar_color", "bossbar_style", "text", "sound", "sound_enable", "sound_volume", "sound_pitch".
value
string
required
The new value to apply for the chosen modifier.
  • For time modifiers: HH:MM:SS (e.g. "00:05:30")
  • For BossBar color: any valid BarColor
  • For BossBar style: any valid BarStyle
  • For sound settings: depends on the modifier
    • sound: valid sound name (vanilla or custom)
    • sound_enable: "true" or "false"
    • sound_volume / sound_pitch: float between 0.1 and 2.0
sender
CommandSender
Reference to the player who performed the action.
  • If a player passes, they will receive a message indicating that the timer was modified
    • It is usually not necessary to use it directly in the API

Returns

success
boolean
Indicates whether the operation succeeded.
  • true — Timer exists and modification applied successfully.
  • false — Invalid parameters or no active timer.
I