Filled String to milliseconds converter

Discussion in 'Plugin Requests' started by Darvys, Sep 3, 2020.

  1. Offline


    Plugin category: I have no idea

    Minecraft version: 1.14

    Suggested name: TimeConverter

    What I want: A player will have a command to convert a string to milliseconds. Like /command 3h(ours) or /command 10w(eeks) and it will return what 3 hours is in time or in the second case what 10 weeks is in milliseconds. This has to work with minutes, hours, days, months and years. It should be able to recognize m as minutes, h as hours, w as weeks, mo as months and y as years. Being able to recognize the full word is appreciated but not a must. Time will always be 1 word. So 1h but never 1 h.

    Ideas for commands: /convert [time]
    Ideas for permissions: No permissions are needed

    When I'd like it by: No deadline
  2. Offline


    Here's the plugin, hope it works for you.

    Couldn't find a tool to convert it online so I guessed if it was working, seems to be okay. Let me know if it's not.

    Command is exactly as you asked for, /convert [time]


    /convert 1d1y4m5s10mo

    I used longs so hopefully you won't have trouble with limits in length of the value, but nevertheless it's possible on ridiculous dates such as 99999999 years, you'll start getting negative values and all sorts of weird and wonderful values. Hope you don't need anything longer than that.
    Last edited: Sep 7, 2020
  3. Offline


    Sorry for my late reply, but we have been using it and it works like a charm! Thank you so much!
    CraftCreeper6 likes this.

Share This Page