11package com .btk5h .skriptmirror ;
22
33import ch .njol .skript .Skript ;
4- import ch .njol .skript .lang .function .Function ;
5- import ch .njol .skript .lang .function .FunctionEvent ;
6- import ch .njol .skript .lang .function .Functions ;
7- import ch .njol .skript .lang .function .Parameter ;
4+ import ch .njol .skript .lang .function .*;
85import ch .njol .skript .registrations .Classes ;
6+ import org .eclipse .jdt .annotation .Nullable ;
97
108public class FunctionWrapper {
9+
10+ private static final Function <?> NO_OP_FUNCTION ;
11+
12+ static {
13+ NO_OP_FUNCTION = new JavaFunction <Object >("$noop" , new Parameter [0 ], Classes .getExactClassInfo (Object .class ),
14+ true ) {
15+ @ Nullable
16+ @ Override
17+ public Object [] execute (FunctionEvent e , Object [][] params ) {
18+ return null ;
19+ }
20+ };
21+ }
22+
1123 private final String name ;
1224 private final Object [] arguments ;
1325
@@ -24,31 +36,14 @@ public Object[] getArguments() {
2436 return arguments ;
2537 }
2638
27- public Function getFunction () {
39+ public Function <?> getFunction () {
2840 Function <?> function = Functions .getFunction (name );
2941 if (function == null ) {
3042 Skript .warning (String .format ("The function '%s' could not be resolved." , name ));
31- return NoOpFunction . INSTANCE ;
43+ return NO_OP_FUNCTION ;
3244 }
3345 return function ;
3446 }
3547
36- private static class NoOpFunction extends Function <Object > {
37- private static NoOpFunction INSTANCE = new NoOpFunction ();
38-
39- private NoOpFunction () {
40- super ("$noop" , new Parameter [0 ], Classes .getExactClassInfo (Object .class ), true );
41- }
42-
43- @ Override
44- public Object [] execute (FunctionEvent e , Object [][] params ) {
45- return null ;
46- }
47-
48- @ Override
49- public boolean resetReturnValue () {
50- return false ;
51- }
52- }
5348}
5449
0 commit comments