SkriptLang / Skript

Skript is a Spigot plugin which allows server admins to customize their server easily, but without the hassle of programming a plugin or asking/paying someone to program a plugin for them.
https://docs.skriptlang.org
GNU General Public License v3.0
1.08k stars 370 forks source link

Unprivate Arithmetics#exactOperationExists method #7206

Open Fusezion opened 2 weeks ago

Fusezion commented 2 weeks ago

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 https://github.com/SkriptLang/Skript/blob/d82667540e5b8381456d87df0a6485c03517bddf/src/main/java/org/skriptlang/skript/lang/arithmetic/Arithmetics.java#L75-L81

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

Agreement

Pikachu920 commented 2 weeks ago

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

UnderscoreTud commented 2 weeks ago

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

Pikachu920 commented 2 weeks ago

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

hows that?