{"id":18866648,"url":"https://github.com/andre601/math-expansion","last_synced_at":"2025-04-14T14:31:11.652Z","repository":{"id":40545911,"uuid":"199294618","full_name":"Andre601/Math-Expansion","owner":"Andre601","description":"Mirror of the Repo on Codeberg","archived":false,"fork":false,"pushed_at":"2023-07-21T10:46:29.000Z","size":92,"stargazers_count":8,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-29T22:48:04.266Z","etag":null,"topics":["evalex","math-expansion","placeholderapi"],"latest_commit_sha":null,"homepage":"https://codeberg.org/Andre601/Math-Expansion","language":"Java","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Andre601.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-28T14:04:35.000Z","updated_at":"2023-12-17T00:52:31.000Z","dependencies_parsed_at":"2024-10-25T18:48:01.701Z","dependency_job_id":"f36c8326-bed0-42b3-8b6f-7c9243af56f4","html_url":"https://github.com/Andre601/Math-Expansion","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Andre601%2FMath-Expansion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Andre601%2FMath-Expansion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Andre601%2FMath-Expansion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Andre601%2FMath-Expansion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Andre601","download_url":"https://codeload.github.com/Andre601/Math-Expansion/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248897089,"owners_count":21179536,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["evalex","math-expansion","placeholderapi"],"created_at":"2024-11-08T05:07:07.722Z","updated_at":"2025-04-14T14:31:11.378Z","avatar_url":"https://github.com/Andre601.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e [!IMPORTANT]\n\u003e Repository archived. The up-to-date source code, including Wiki, can be found on [Codeberg](https://codeberg.org/Andre601/Math-Expansion).\n\n[placeholderapi]: https://www.spigotmc.org/resources/6245/\n[evalex]: https://github.com/uklimaschewski/EvalEx\n[examples]: https://github.com/Andre601/Math-Expansion/wiki/Examples\n[rounding]: https://github.com/Andre601/Math-Expansion/wiki/Config-options#rounding\n\n[changelog]: https://github.com/Andre601/Math-Expansion/blob/master/CHANGELOG.md\n\n# Math-Expansion\n\n\u003ca href=\"https://discord.gg/6dazXp6\" target=\"_blank\"\u003e\n  \u003cimg alt=\"discord\" src=\"https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@2/assets/minimal/social/discord-singular_vector.svg\" height=\"64\" align=\"right\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://app.revolt.chat/invite/74TpERXA\" target=\"_blank\"\u003e\n  \u003cimg alt=\"revolt\" src=\"https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@2/assets/minimal/social/revolt-singular_vector.svg\" height=\"64\" align=\"right\"\u003e\n\u003c/a\u003e\n\n\u003e [!IMPORTANT]  \n\u003e Versions 1.2.7 and newer require Java 11 or higher to work!  \n\u003e This is due to some required dependencies needing it.\n\nThe Math-Expansion is an Expansion for [PlaceholderAPI] which allows you to do math-expressions.  \nSupported are all expression supported by [EvalEx], which this Expansion uses. See the [examples](#examples) below for some features.\n\n## Syntax\nThe expansion has two specific Placeholder patterns to use.\n\n### `%math_\u003cexpression\u003e%`\nUsed for normal calculations while using the default [decimal count](#decimals) and [rounding behaviour](#rounding)\n\n### `%math_[decimals]:[rounding]_\u003cexpression\u003e%`\nUsed for calculations using your own [decimal count](#set-amount-of-shown-decimals) and [rounding behaviour](#set-rounding-behaviour).  \nEither value is optional and not providing one uses the default values set in the [Config](#config-options).\n\n## Features\n\n### Normal Math expressions\nMath-Expansion supports all common math expressions such as $1+2$, $3-4$, $5*6$ or $7/8$  \nThose expressions can be used as-is without any real problem. Just keep in mind that expressions follow common logic which is that **multiplication and division come before addition and substraction**.\n\nIf you want specific expressions to be done first, even tho logic would prioritize others can you put them into brackets (i.e. `(1+2)*3` would result in `1+2` being done first before multiplying by 3).\n\n----\n\n### Placeholders in Math expressions\nYou can use any placeholders from PlaceholderAPI that return **valid numbers**.  \nWhen using placeholders will you need to use the curly brackets format (`{some_placeholder}`) rather than the percent placeholders.\n\nAs an example can you use `{server_online}` in your expressions to use the amount of online players in your server.\n\n----\n\n### Using percent symbol\nDue to how PlaceholderAPI handles placeholders can you not use the percent symbol (`%`) inside math expressions, as PlaceholderAPI would assume this to be the end of a placeholder.  \nTo bypass this limitation does the Math-Expansion add a `[prc]` placeholder that you can use. This text will be replaced with an actual percent symbol before doing calculations.\n\n\u003e **Warning**  \n\u003e The `[prc]` can NOT be used for placeholders in PlaceholderAPI. See the [Previous section](#placeholders-in-math-expressions) for more info.\n\n----\n\n### Special expressions\nCertain expressions cannot be reproduced with letters in the Math-Expansion. For example can $\\sqrt{100*10}$ not be used as shown.  \nBecause of this does [EvalEx][evalex], the library used by Math-Expansion, provide specific custom patterns that allow to do these kinds of special calculations.\n\nTo f.e. do the above expression would you use `SQRT(100*10)` as the expression, which would now get the square root of $100*10$.\n\nEvalEx offers a lot of different formats you can use, so check out their readme for more information.  \nNote: Those patterns are case-insensitive.\n\n----\n\n### Set amount of shown decimals\nSometimes an expression can return a relatively large number such as `3.333333...`.  \nThe Math-Expansion does by default only show the first three decimals of a number, turning the above shown one into `3.333`.\n\nIf you want to lower or increase the amount of decimals without altering the [config option](#decimals) can you set your own decimals count using the [advanced placeholder-pattern](#math_decimalsrounding_expression).\n\nFor example will `%math_5:_8+1.234567%` set the amount of decimals to 5, resulting in the returned number looking like this: `9.23457`\n\n\u003e [!NOTE]  \n\u003e The final number depends on what rounding behaviour has been set.\n\n----\n\n### Set rounding behaviour\nBy default, is the Math-Expression using `Half Up` as rounding behaviour, which means that numbers between 1 and 4 will be rounded down while numbers 5 to 9 will be rounded up.\n\nIf you would like to use a different rounding behaviour while not altering the [config option](#rounding) can you provide a valid rounding behaviour in the [advanced placeholder-pattern](#math_decimalsrounding_expression) like this: `%math_:ceiling_8+1.2222%`\n\nThe above shown expression would - assuming a default decimals count of 3 is used - result in `9.223` even tho by normal standards would it be `9.222`.\n\nYou may find more detailed explanations and examples of this option on the [wiki](https://github.com/Andre601/Math-Expansion/wiki/Config-options#rounding).\n\n## Config options\nThe expansion adds a few specific settings to the config.yml of PlaceholderAPI, which can be changed if desired.\n\n### Debug\nThe Debug option enables or disables the expansion's debug mode.  \nWith debug enabled will warnings also print an exception, if the warning is a result of an exception.\n\nThis is mostly useful for support and could increase the size of your server log files.\n\n----\n\n### Decimals\nSets the amount of decimal points (digits after the dot) should be shown by default in the final number.\n\nThe default value - which is also used whenever an invalid value has been set in the config - is `3` meaning a number such as `123.456789` will be displayed as `123.457`.  \nKeep in mind that the actual number also depends on what [rounding behaviour](#rounding) is used.\n\nIf the number is lower than 0 will it default to 0.\n\n----\n\n### Disable-Warnings\nWhen true, disables the printing of warnings such as this one:  \n```\n[00:00:00 WARN]: [PlaceholderAPI] [math] Invalid Placeholder detected!\n[00:00:00 WARN]: [PlaceholderAPI] [math] Placeholder: %math_1-%\n[00:00:00 WARN]: [PlaceholderAPI] [math] Cause: '1-' is not a valid Math Expression\n```\nIt is recommended to **not** enable this option as it would otherwise make it more difficult to detect and find wrongly formatted placeholders.\n\n----\n\n### Rounding\nThe default rounding behaviour to use.  \nWhen the number returns more decimals than what should be displayed will it get rounded to the set decimal count.\n\nExample: `5.684` with `half up` as rounding (Default) and a decimal count set to 2 returns `5.68` while a decimal count of 1 returns `6.7`.\n\nThe default rounding is `half-up` which means that any number greater or equal to 5 is rounded up and anything below is rounded down.  \nTake a look at the [wiki][rounding] for a list of supported options.\n\n## Credits\nMath-expansion uses [EvalEx] for evaluating the math-expressions.  \nCheck the repository for available math-expressions.\n\n## Changelog\nTake a look at the [CHANGELOG.md][changelog] for all versions and their changes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandre601%2Fmath-expansion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandre601%2Fmath-expansion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandre601%2Fmath-expansion/lists"}