-*- TimeEZEntry -*-
Let's make entering times into a command much easier!!! Instead of having to calculate how many seconds are in a minute, hour, day, week, month, year, etc. to put it into your command, this lets you put something like "5w3d4m17s" into the command instead. This does not let you do this for other plugin's commands unless they are using this (or if it is essentials, as they have a similar time entry system).
In order to use this plugin, you probably want to add BlockheadsAPI into the dependencies of your plugin, so people don't end up getting errors about a plugin not existing.
The Only Method
There is only one thing you have to do to convert a string like "1y2M3w2m" into the amount of milliseconds that you want.
This converts the string into milliseconds. You can then divide the long by 1000 to get the amount in seconds.
If the inputted string was formatted incorrectly, the getMillis method will return -1. You could use this to say that if the getMillis is -1, then send a message to the player saying that it was incorrectly formatted.
The String Input
If you know the Essentials time input system (for things like /jail and /tempban), then the string format is basically the same. Make sure you tell your players to format their command argument like this:
Replace the "#"s with the amount of that time. You do not have to have all the variables (ex. you don't have to have 0y0M0w).
Leave a comment if you like it! Post suggestions or report errors by clicking the buttons on the sidebar!