By continuing to use this site, you agree to the Terms of Service of this website, including usage of cookies.

OK, Don't show this again

Execute math expressions in the server or console on PocketMine-MP servers.
version 0.0.21
Approved
Direct Download How to install?
Switch version
82 Downloads / 743 Total
4 Reviews
Plugin Description §

General

Execute math expressions in the server or console on PocketMine-MP servers with /calculator command

EgImg

Arithmetic Operators

Constants

  • List of supported constants: e, euler, false, inf, log2e, log10e, ln2, ln10, lnpi, pi, nan, pi2, pi4, m_1pi, m_2pi, m_2sqrtpi, sqrtpi, sqrt2, sqrt3, sqrt12, true.
  • Description of constants: https://github.com/Muqsit/arithmexp/wiki/Constant
  • Eg: /calculator 3**2 * pi > Result: 28.2

Math functions

  • List of supported math functions: abs(), acos(), acosh(), asin(), asinh(), atan2(), atan(), atanh(), boolval(), ceil(), cos(), cosh(), deg2rad(), exp(), expm1(), fdiv(), floatval(), floor(), fmod(), hypot(), intdiv(), intval(), is_bool(), is_float(), is_finite(), is_infinite(), is_nan(), lcg_value(), log10(), log1p(), log(), max(), min(), mt_getrandmax(), mt_rand(), pi(), pow(), rad2deg(), round(), sin(), sinh(), sqrt(), tan(), tanh().
  • Description of math functions: https://github.com/Muqsit/arithmexp/wiki/Function
  • Eg: /calculator sqrt(369) > Result: 19.2

Operator

Commands & Permissions

commands:
  calculator:
    description: "Perform a math operation"
    usage: "/calculator <expression>"
    permission: calculator.command
    aliases: ["calc"]
permissions:
  calculator.command:
    default: true
    description: "Allows the use of /calculator"

Config

---
# Prefix of messages.
prefix: "&f[&6Calculator&f]&r"

# {prefix} : Prefix.
# {result} : The result of the math.
result: "{prefix} &aResult: &b{result}"

# {prefix} : Prefix.
# {error} : Error information.
error: "{prefix} &cError: {error}"

# playSound: true > A sound will be sent to the player when a math expressions is performed.
playSound: true

# showDataType: true > The data type will be displayed with the result.
showDataType: true

# Config version
configVersion: "0.0.15"
...

Contact

Discord
You can contact me directly via Discord NhanAZ

What's new §
  • Update arithmexp library version from 0.1.30 to 1.0.0

    • Expressions may now return a boolean value. Consequently, constants may be assigned a boolean value, functions may accept and return a boolean value, and variables may be mapped to a boolean value.
    • Implemented comparison operators (> >= < <= <=> == != === !==) (#9) (427e2f4)
    • Implemented logical operators (! && || and or xor) (#9) (77f988c)
    • Implemented boolean functions (is_bool is_float is_finite is_infinite is_nan boolval intval floatval) (fdcb6ce)
  • Update arithmexp library version from 0.1.30 to 1.0.1

    • Fix spaceship operator (<=>) cannot be stringified (73fe866)
  • Bump lib muqsit/arithmexp to 0.1.29
    • Fixed unary positive operation resulting in negation since v0.1.28 (80ceccf)
    • Further optimized expression evaluation (6d0c799)
    • Implemented modulo operator strength reduction for identity property ((a % n) % n => a % n) (bca7b17, 9853547)
    • Removed functions rand() and getrandmax() (these functions exist in PHP only for backward compatibility) (ce8dfb3)
    • mt_rand() now accepts zero parameters (in addition to accepting two parameters) (8194bf3, f73be61)
    • Implemented mode constants for round() (HALF_UP, HALF_DOWN, HALF_EVEN, HALF_ODD) (c21ce74, 90c0f5d)
    • Renamed FunctionRegistry::register() to FunctionRegistry::register() (ad07641)
    • Renamed ConstantRegistry::register() to ConstantRegistry::registerLabel() (1b0d2d5)
    • Moved FunctionRegistry::registerMacro() to MacroRegistry::registerFunction() (0d0889f)
    • Implemented object-like macros that can be registered by calling MacroRegistry::registerObject() (34e5ad7)
  • Bump lib muqsit/arithmexp to 0.1.27
    • Implemented function-like macros (see the wiki) (b1fc5c3)
  • Bump lib muqsit/arithmexp to 0.1.26
    • Introduced Parser::getOperatorManager() (4ff725f)
    • Replaced Parser::getBinaryOperatorRegistry() with Parser::getOperatorManager()->getBinaryRegistry()
    • Replaced Parser::getUnaryOperatorRegistry() with Parser::getOperatorManager()->getUnaryRegistry()
    • Fixed a few cases where optimizers did not account for INF and NAN (#16) (1ef49eb, db1df91, 03440ab, b9dd31e, 3c9b8a0, 14442ca, 082ccf3)
    • Fixed operator precedence of unary operators being greater than exponentiation (#17) (4ff725f)
    • Fixed division by zero with zero 0 / 0 returning int(0) with optimizations (1672970)
    • Function properties (commutativity and determinism) are governed by function flags instead of boolean properties (3e34845)
    • See newer examples on the wiki about how to register custom binary operators, unary operators, and functions
    • Implemented idempotent functions (bd08609)
  • Bump lib muqsit/arithmexp to 0.1.25
    • Fixed a bug that allowed using square brackets and curly brackets to enclose function call argument list (aa71629)
    • Errored subexpressions are no longer highlighted if the subexpression is the expression itself (65290a6)
    • Improved performance of operator strength reduction by precomputing numeric literals within operands (32cf8f4)
  • Bump lib muqsit/arithmexp to 0.1.24
    • Added support for various forms of brackets (square brackets [] and curly brackets {} are now considered as valid in expressions)
  • Added option: Advanced brackets > Input will accept brackets: [ ] { }
  • Bump lib muqsit/arithmexp to 0.1.23
    • Registered functions for a parser can now be accessed via FunctionRegistry::register() (d003841)
    • Improved operator strength reduction performance over addition with negative operands (2bf277e, ff81320)
    • Improved operator strength reduction performance over subtraction with negative operands (da21685, ff81320)
    • Fixed a critical bug where operator strength reduction over subtraction with lvalue=0 resulted in rvalue instead of -rvalue (#11, 4f4aaea, 029e470)
  • Added option: Show data type of result
  • Bump lib nhanaz-pm-pl/libBedrock to 0.0.2
  • Bump lib muqsit/arithmexp to 0.1.22
    • Implemented quotient rule of exponents (a ** m / a ** n = a ** (m - n)) in strength reduction optimization (757e7b0)
    • Fixed a bug in the optimizer that caused function calls in expressions to be optimized by name (8891458)
    • Fixed a bug in the optimizer that failed to parse expressions containing nested function calls with zero parameters (such as min(pi())) (4d33414)
  • Added data type to the result.
  • Bump lib muqsit/arithmexp to 0.1.21
    • Expression::getVariables() has been renamed to Expression::findVariables()
    • Fixed a bug where exponentiation of 2 with itself resulted expression executing indefinitely
  • Bump lib muqsit/arithmexp to 0.1.20
    • Fixed a bug causing operator strength reduction to not work on function calls with >2 arguments
    • Use of same unary operator consecutively is now valid
    • Operator strength reduction now optimizes unary positive and unary negative operations
  • Bump lib muqsit/arithmexp to 0.1.19
    • Improved strength reduction over division operations
    • Added a "commutative" property to functions
    • min and max no longer throw an error when only 1 parameter is supplied
    • Parser now attempts to catch division-by-zero during parsing
  • Bump lib muqsit/arithmexp to 0.1.18
    • Fixed a bug causing non-deterministic function calls from being optimized away during parsing
    • Argument underflow in function calls now throws a ParseException during parsing
    • Added more constants (see List of pre defined constants)
  • Bump lib muqsit/arithmexp to 0.1.17
    • BinaryOperators can now be checked for commutativity through BinaryOperator::isCommutative()
    • Improved Operator Strength Reduction optimization by accounting for commutativity of binary operations
  • Bump lib muqsit/arithmexp to 0.1.16
    • OSR now optimizes expressions such as x - x to 0
    • OSR now optimizes 1 ** x to 1
    • Fixed parse errors arising from OSR not correctly building token tree
    • Removed Parser::parseRawExpression()
      • Parser::createUnoptimized()->parse() may be used instead
  • Bump lib muqsit/arithmexp to 0.1.15
  • Initial version

Jack10270
Outdated
using v0.0.12
18 Oct 22
This is the best calculator plugin it can calculate ANYTHING and also very large expression. And is is useful when you are developing custom pvp damage plugin on phone and don't want to switch to calculator app
jasonw4331
Staff Outdated
using v0.0.12
18 Oct 22
I'll never say this again. This plugin updates too often. Someone stop the updates im boutto 💀
harryitz
Outdated
using v0.0.2
05 Oct 22
Ihsan48
Outdated
using v0.0.2
05 Oct 22

Reply to review by :

/ 5
Supported API versions
5.0.0
->
5.27.1
Producers §
  • Collaborators:
    • @NhanAZ
License §
Categories:
General

You can leave one review per plugin release, and delete or update your review at any time

/ 5
Loading...