File tree Expand file tree Collapse file tree 5 files changed +11
-12
lines changed
src/main/java/ch/njol/skript Expand file tree Collapse file tree 5 files changed +11
-12
lines changed Original file line number Diff line number Diff line change 66import ch .njol .skript .lang .ExpressionInfo ;
77import ch .njol .skript .lang .SkriptEventInfo ;
88import ch .njol .skript .lang .SyntaxElementInfo ;
9- import org .skriptlang .skript .common .function .DefaultFunction ;
109import ch .njol .skript .lang .function .Functions ;
11- import ch .njol .skript .lang .function .JavaFunction ;
1210import ch .njol .skript .lang .function .Parameter ;
1311import ch .njol .skript .registrations .Classes ;
1412import ch .njol .skript .util .Utils ;
@@ -153,7 +151,7 @@ private static void asSql(final PrintWriter pw) {
153151 "examples VARCHAR(2000) NOT NULL," +
154152 "since VARCHAR(100) NOT NULL" +
155153 ");" );
156- for (ch .njol .skript .lang .function .Function <?> func : Functions .getDefaultFunctions ()) {
154+ for (ch .njol .skript .lang .function .Function <?> func : Functions .getFunctions ()) {
157155 assert func != null ;
158156 insertFunction (pw , func );
159157 }
Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ public static <T> String getId(SyntaxInfo<? extends T> syntaxInfo) {
103103 * @return the documentation ID of the function
104104 */
105105 public static String getId (Function <?> function ) {
106- int collisionCount = calculateCollisionCount (Functions .getJavaFunctions ().iterator (),
106+ int collisionCount = calculateCollisionCount (Functions .getFunctions ().iterator (),
107107 javaFunction -> function .getName ().equals (javaFunction .getName ()),
108108 javaFunction -> javaFunction == function );
109109 return addCollisionSuffix (function .getName (), collisionCount );
Original file line number Diff line number Diff line change 66import ch .njol .skript .lang .*;
77import ch .njol .skript .lang .function .Function ;
88import ch .njol .skript .lang .function .Functions ;
9- import ch .njol .skript .lang .function .JavaFunction ;
109import ch .njol .skript .registrations .Classes ;
1110import com .google .common .base .Joiner ;
1211import com .google .common .collect .Lists ;
1817import org .jetbrains .annotations .Nullable ;
1918import org .skriptlang .skript .lang .entry .EntryData ;
2019import org .skriptlang .skript .lang .entry .EntryValidator ;
21- import org .skriptlang .skript .common .function .DefaultFunction ;
2220import org .skriptlang .skript .lang .structure .StructureInfo ;
2321
2422import java .io .File ;
@@ -333,7 +331,7 @@ else if (!filesInside.getName().matches("(?i)(.*)\\.(html?|js|css|json)")) {
333331 }
334332 }
335333 if (genType .equals ("functions" ) || isDocsPage ) {
336- List <Function <?>> functions = new ArrayList <>(Functions .getDefaultFunctions ());
334+ List <Function <?>> functions = new ArrayList <>(Functions .getFunctions ());
337335 functions .sort (functionComparator );
338336 for (Function <?> info : functions ) {
339337 assert info != null ;
Original file line number Diff line number Diff line change @@ -503,7 +503,7 @@ public void generate(@NotNull Path path) throws IOException {
503503 jsonDocs .add ("structures" , generateStructureElementArray (source .syntaxRegistry ().syntaxes (SyntaxRegistry .STRUCTURE )));
504504 jsonDocs .add ("sections" , generateSyntaxElementArray (source .syntaxRegistry ().syntaxes (SyntaxRegistry .SECTION )));
505505 jsonDocs .add ("types" , generateClassInfoArray (Classes .getClassInfos ().iterator ()));
506- jsonDocs .add ("functions" , generateFunctionArray (Functions .getDefaultFunctions ().iterator ()));
506+ jsonDocs .add ("functions" , generateFunctionArray (Functions .getFunctions ().iterator ()));
507507
508508 try {
509509 Files .writeString (path , GSON .toJson (jsonDocs ));
Original file line number Diff line number Diff line change 1616import org .skriptlang .skript .lang .script .Script ;
1717
1818import java .util .*;
19+ import java .util .stream .Collectors ;
1920
2021/**
2122 * Static methods to work with functions.
@@ -445,21 +446,23 @@ public static void clearFunctions() {
445446 }
446447
447448 /**
448- * @deprecated Use {@link #getDefaultFunctions ()} instead.
449+ * @deprecated Use {@link #getFunctions ()} instead.
449450 */
450- @ SuppressWarnings ({"unchecked" })
451451 @ Deprecated (forRemoval = true , since = "INSERT VERSION" )
452452 public static Collection <JavaFunction <?>> getJavaFunctions () {
453453 // We know there are only Java functions in that namespace
454- return (Collection <JavaFunction <?>>) (Object ) javaNamespace .getFunctions ();
454+ return javaNamespace .getFunctions ().stream ()
455+ .filter (it -> it instanceof JavaFunction <?>)
456+ .map (it -> (JavaFunction <?>) it )
457+ .collect (Collectors .toSet ());
455458 }
456459
457460 /**
458461 * Returns all functions registered using Java.
459462 *
460463 * @return All {@link JavaFunction} or {@link DefaultFunction} functions.
461464 */
462- public static Collection <Function <?>> getDefaultFunctions () {
465+ public static Collection <Function <?>> getFunctions () {
463466 return javaNamespace .getFunctions ();
464467 }
465468
You can’t perform that action at this time.
0 commit comments