Skript

Skript

743k Downloads

Unprivate Arithmetics#exactOperationExists method

Fusezion opened this issue ยท 3 comments

commented

Suggestion

Unprivate the exactOperationExists method on the Arithmetics class

Why?

Currently addons have no real way of checking if operations for arithmetic are currently registered making usage of the register unsafe

Other

Step to fix

private static boolean exactOperationExists(Operator operator, Class<?> leftClass, Class<?> rightClass) {
for (OperationInfo<?, ?, ?> info : getOperations_i(operator)) {
if (info.getLeft() == leftClass && info.getRight() == rightClass)
return true;
}
return false;
}

- private static boolean exactOperationExists(Operator operator, Class<?> leftClass, Class<?> rightClass) {
+ public static boolean exactOperationExists(Operator operator, Class<?> leftClass, Class<?> rightClass) {

Agreement

  • I have read the guidelines above and affirm I am following them with this suggestion.
commented

Currently addons have no real way of checking if operations for arithmetic are currently registered making usage of the register unsafe

you can catch the skriptapiexception

commented

I feel that's more of a workaround rather than an actual solution

commented

I feel that's more of a workaround rather than an actual solution

hows that?