TimeUnits Formats - Relicum/CountDownSigns GitHub Wiki

TimeUnits and Valid formats

Description

As mentioned the input on the time for the timer uses a concept called TimeUnits,
this allows for a lot of flexibility when creating the sign and doesn't require
any complicated syntax for the admin.

A brief description of what a TimeUnit is rough what it says, it is a "Unit of Time". 
The reason I choice to implement it this way is for a few reason, 
Minecraft code doesn't deal with Minutes, Hours etc, but in "Ticks" a Tick is used 
in most games but there is no common value in time what a tick is. 
In Minecraft a Tick is 1/20 of a second. So you can say that 1 Second is 20 ticks.
Using this we can can use a minecraft Tick as a proper measurement of time. 
But obviously server owners and admins don't want to be dealing with Ticks.

__

Formats

You can use the following TimeUnits which also show's the valid placeholders (These can be upper or lower case) you can use on the sign itself while inputting them:

  • Days: D or d
  • Minutes: M or m
  • Hours: H or h
  • Seconds: S or s

When I talk about an "input" what do i mean ?? This is just the format you are required to input them in. So the plugin can under stand them. An input uses the following format Value:TimeUnit eg 4:m OR 1:d

Using TimeUnits

To add an input of 2 minutes you using the following format:

2:M or 2:m Notice the ":" this must be included.

To add 1 minute and 30 seconds you at first glance think you need two use to inputs:

1:m and 30:s this is perfectly valid. But so is this:

  1. 90:s = 1 Minute and 30 Seconds
  2. 30:s 60:s = 1 Minute and 30 Seconds
  3. 30:s 1:M = 1 Minute and 30 Seconds (Notice the order doesn't matter either)

I realize at first this will be confusing. Look closely at the 3 inputs above and keep in mind that the sum of all the inputs is added together to make the total length of the timer.

You might ask why not stick to 1:m and 30:s which is 2 inputs on the sign. But if your math is ok it is quicker just to add a single input of 90:s. All I am doing is highlighting that you can use 3 inputs in any order using any combination of TimeUnits as long as the total adds up the the length of the countdown that you require.

Confused ??? I will show you below using images. That will show you exactly how flexible and easy it is.


result

The image above can be produced using ANY of the following inputs shown below.(There is likely to be other combinations but I can list them all).

Single Input

single

90 Seconds adds up to 1 minute and 30 seconds

Two Inputs

double

Alternative Two Inputs

r

Notice the order of the inputs does not matter

sdew

Notice its not case sensitive, and we are using 2 of the same TimeUnit all of this is valid

Three Inputs

For 3 inputs lets change the length of we want the countdown to be that can at least use 3 different TimeUnits.

We want a count down of:

2 Hours 10 minutes 25 seconds

2ho

The image above can be produced using any of the following inputs.

1h

2hh

There many ways you could do this using three inputs as well you could use only 1 or 2 inputs as well. But I think this give you a full under standing. Just remember that 3 inputs is the maximum inputs you can use.