/value of 4.1e7

Discussion in 'Plugin Requests' started by MrEminent42, Dec 14, 2017.

Thread Status:
Not open for further replies.
  1. Offline

    MrEminent42

    Hello! I have an idea for a plugin that might be of help to a lot of servers with inflated economies :)p)

    Plugin category: String parsing? Regex? Please read on.

    Minecraft version: 1.8.8

    Suggested name: ScientificValue

    What I want: Lots of times, plugins will spit out an ugly number like 4.1e7 and nobody really knows what that means. I would love a /value command that could turn that string into formatted numbers like 41,000,000, or preferably, 41M (for million). If possible, please include letters all the way up to Q for quadrillions (i.e. /value 2.6e16 would return 26Q).

    Also, a config would be a nice bonus. Just a simple 'message' option to set the message to the sender, something like
    "&a» The value of {input} is: {formatted}"

    Ideas for commands: /value [#][.#]E[#] would return a formatted number as described above.

    Ideas for permissions: value.use. Defaults to OP, ability to use the command.

    When I'd like it by: As soon as you can get it done :)

    Cheers!
     
  2. Offline

    Tabuu_

    [✓] I'll give this a quick try, should not be too hard.
     
    Last edited by a moderator: Dec 14, 2017
  3. Offline

    MrEminent42

    Much appreciated! I can't figure out how to split and use the different parts of the string "7.135e10". Let me know how it goes!
     
  4. Offline

    Tabuu_

    ScientificValue 1.0 BETA by Tabuu

    All commands and permissions can be found in the plugin.yml

    >> DOWNLOAD <<
    Plugin.yml (open)

    Code:
    name: ScientificValue
    version: 1.0 BETA
    main: nl.tabuu.scientificvalue.ScientificValue
    description: Adds a command that returns the true value of a scientificly notated number.
    authors: [Tabuu]
    website: https://www.tabuu.nl
    
    commands:
      value:
        usage: /value <Scientificly Notated Number>
        description: Returns the true value of a number
    permissions:
      value.use:
        description: Allows players to user the '/value' command.
        default: op
     
  5. Offline

    MightyOne

    *number*e2 means *number* ×10^2
    I am glad that I could help you
     
  6. Offline

    Tabuu_

    I think that he knew that much.
     
  7. I don't think a lot of plugins give you numbers with exponents like that...
     
  8. Offline

    MrEminent42

    Thanks so much! I do have a few more requests if you're willing to make a 1.1 version of this plugin:
    • Could you change the "1,1Q" to "1.1Q" to fit the US system of decimals?
    • Could you add a message for when the given string is invalid? e.g. I executed "/value test" and the plugin threw an error: https://hastebin.com/pijebonuqa.go
    • Could you add support for strings without a decimal, e.g. /value 2e10
    • Also if possible please add a try/catch when parsing the strings to avoid NPEs etc.
    Thanks again in advance!

    I find that quite a few do, unfortunately :(

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited: Dec 15, 2017
Thread Status:
Not open for further replies.

Share This Page