Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
MythicMobs MythicMobs
  • Project overview
    • Project overview
    • Details
    • Activity
  • Issues 132
    • Issues 132
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Operations
    • Operations
    • Incidents
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • MythicCraft
  • MythicMobsMythicMobs
  • Issues
  • #923

Closed
Open
Created Sep 15, 2022 by Adam Parry@aparry91

[Feature Request] New greater than or equal to operator

Summary

I would like to be able to check a placeholder variable, for example an McMMO level, is greater than or equal to a certain amount to conditionally allow for new skills to be used.

Usage

Players should be able to conditionally check if an integer checked via variable placeholders is greater than or equal to a certain value to determine whether or not additional skills can be used.

Value

More flexibility

Priority

High, great feature

Implementation

As suggested on the operator page, I should raise a new issue:

exp4j Built in operators Example 9 Create a custom operator logical operator that returns 1 if the first argument is greater or equals than the second argument, and otherwise it returns 0.

`@Test public void testOperators3() throws Exception { Operator gteq = new Operator(">=", 2, true, Operator.PRECEDENCE_ADDITION - 1) {

    @Override
    public double apply(double[] values) {
        if (values[0] >= values[1]) {
            return 1d;
        } else {
            return 0d;
        }
    }
};

Expression e = new ExpressionBuilder("1>=2").operator(gteq)
        .build();
assertTrue(0d == e.evaluate());
e = new ExpressionBuilder("2>=1").operator(gteq)
        .build();
assertTrue(1d == e.evaluate());`
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking