Simple Timer icon

Simple Timer -----

Timer Plugin



Simple Timer Plugin

a simple timer plugin

create quick and easy timers


[​IMG]

Commands:

  • /simpletimer
  • /stimer set <HH:MM:SS> <ID> <color> <sound> <text>
    • Important arguments:
      • HH:MM:SS - simple time format
      • ID - add a unique id to your timer
    • Optional arguments:
      • color - you can choose the color of the bossbar: BLUE, GREEN, PINK, PURPLE, RED, WHITE or YELLOW.
      • sound - can be true or false, the sound per second is specified in the config
      • text - The text that will have the title of the bossbar must be enclosed in " " and you can use the following placeholders: <HH:MM:SS> <MM:SS> <HH> <MM> <SS>
        (you can also use color code or hexadecimal colors).
  • /stimer modify <ID> <modifier> <value>
    • Important arguments:
      • ID - a timer id
      • modifier - a modifier for the timer
        • add - add time
        • set - set a time
        • take - take time
        • pause - pause a timer
        • resume - resume a timer
        • maxvalue - set a max timer value
        • minvalue - set a min timer value
      • value - the value for the modifier (some modifiers don't need a value):
        • add/set/take/maxvalue/minvalue - need a value (HH:MM:SS)
        • pause/resume - they don't need value
  • /stimer remove <ID>
  • /stimer list
  • /stimer reload
Usage Example:
  • /stimer set 00:05:00 test
  • /stimer set 00:03:00 test RED true "&cMy Timer: #751436<timer>"
  • /stimer modify test add 00:00:30
  • /stimer modify test pause
  • /stimer modify test resume
  • /stimer modify test reset
  • /stimer remove test
It works with a simple time format (HH:MM:SS), where H stands for hours, M stands for minutes and S stands for seconds.

Placeholder:
requires the PlaceholderAPI plugin to work

  • %simpletimer_hhmmss_<ID>% HH:MM:SS (00:00:00)
  • %simpletimer_mmss_<ID>% MM:SS (00:00)
  • %simpletimer_hh_<ID>% HH (00) hours
  • %simpletimer_mm_<ID>% MM (00) minutes
  • %simpletimer_ss_<ID>% SS (00) seconds

Permissions:
  • simpletimer.all


Oh, and if for some reason you want to remove all timers, use "/stimer remove all" ;)

Code (YAML):

#-----------------------------------------------------------------------
#Here you can configure some parameters of the timers.
#-----------------------------------------------------------------------[/SIZE]
timer
:
  #This option indicates how long in seconds the timer should wait after      finishing to clear the bossbar.
  time_after_ending
: 1
  #This option disables the bossbar, but the timer still works.
  bossbar
: true
  #This option gives the default color to the bossbar
  bossbar-color
: WHITE
  #This option you can determine the sound of the timer if it is active
  timer-sound
: UI_BUTTON_CLICK
[SIZE=4 ]

[​IMG]
[​IMG]
[​IMG]
[​IMG]
[​IMG]

This is a small api to use in your plugins

Events:
Code (Java):

//called when a timer is created
@EventHandler
public void onTimerCreate (TimerCreateEvent event ) {

Timer timer = event. getTimer ( ) ;
String timerId = event. getTimerId ( ) ;

}

//called when a timer ends
@EventHandler
public void onTimerFinish (TimerFinishEvent event ) {

Timer timer = event. getTimer ( ) ;
String timerId = event. getTimerId ( ) ;

}
//called when a timer is paused
@EventHandler
public void onTimerPause (TimerPauseEvent event ) {

Timer timer = event. getTimer ( ) ;
String timerId = event. getTimerId ( ) ;

}
//called when a timer is resumed
@EventHandler
public void onTimerResume (TimerResumeEvent event ) {

Timer timer = event. getTimer ( ) ;
String timerId = event. getTimerId ( ) ;

}

//called when a timer changed
@EventHandler
public void onTimerChange (TimerChangeEvent event ) {

Timer timer = event. getTimer ( ) ;
String timerId = event. getTimerId ( ) ;
String timeLeft = event. getTimeLeft ( ) ;

}

 

Examples of what you can do with the API:

Example using the Conditional Events plugin:

Code (YAML):

  create_event
:
    type
: custom
    custom_event_data
:
      event
: xhasi.simpletimer.API.TimerCreateEvent
      variables_to_capture
:
     - ' %timer_name%;getTimerId()'
    conditions
:
   - ' %timer_name% == test'
    actions
:
      default
:
      - "to_all
: actionbar : &c&lCreate %timer_name%;80"
 

  finish_event
:
    type
: custom
    custom_event_data
:
      event
: xhasi.simpletimer.API.TimerFinishEvent
      variables_to_capture
:
     - ' %timer_name%;getTimerId()'
    conditions
:
   - ' %timer_name% == test'
    actions
:
      default
:
      - "to_all
: actionbar : &c&lFinish %timer_name%;80"
 

  pause_event
:
    type
: custom
    custom_event_data
:
      event
: xhasi.simpletimer.API.TimerPauseEvent
      variables_to_capture
:
     - ' %timer_name%;getTimerId()'
    conditions
:
   - ' %timer_name% == test'
    actions
:
      default
:
      - "to_all
: actionbar : &c&lPause %timer_name%;80"
 

  resume_event
:
    type
: custom
    custom_event_data
:
      event
: xhasi.simpletimer.API.TimerResumeEvent
      variables_to_capture
:
     - ' %timer_name%;getTimerId()'
    conditions
:
   - ' %timer_name% == test'
    actions
:
      default
:
      - "to_all
: actionbar : &c&lResume %timer_name%;80"


  change_event
:
    type
: custom
    custom_event_data
:
      event
: xhasi.simpletimer.API.TimerChangeEvent
      variables_to_capture
:
     - ' %timer_name%;getTimerId()'
      - ' %time_left%;getTimeLeft()'
    conditions
:
   - ' %timer_name% == test'
    - ' %time_left% == 00:01:00'
    actions
:
      default
:
      - "console_message
: el timer %timer_name% está por el tiempo: %time_left%"

 



any problem?

contact me on discord: :coffee:

Xhasi#4099
Resource Information
Author:
----------
Total Downloads: 2,987
First Release: Apr 30, 2023
Last Update: Mar 3, 2024
Category: ---------------
All-Time Rating:
10 ratings
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings