Skip to content

Commit c6fca05

Browse files
committed
Fixed function aliases registration to the DSL
1 parent 750c281 commit c6fca05

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

api/src/main/java/fr/jamailun/ultimatespellsystem/api/providers/JavaFunctionProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public void registerFunction(@NotNull RunnableJavaFunction newFunction, String @
3030
@Override
3131
protected void postRegister(@NotNull String key, @NotNull RunnableJavaFunction function) {
3232
// Also register to the DSL.
33-
FunctionDefinitionsRegistry.register(function.getDslDefinition());
33+
FunctionDefinitionsRegistry.register(key, function.getDslDefinition());
3434
}
3535

3636
}

dsl/src/main/java/fr/jamailun/ultimatespellsystem/dsl/registries/FunctionDefinitionsRegistry.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ public static void register(@NotNull FunctionDefinition functionDefinition) {
2323
REGISTRY.put(functionDefinition.id(), functionDefinition);
2424
}
2525

26+
/**
27+
* Register a new function definition, with a specific ID.
28+
* @param key key to register.
29+
* @param functionDefinition the non-null function definition to register
30+
*/
31+
public static void register(@NotNull String key, @NotNull FunctionDefinition functionDefinition) {
32+
REGISTRY.put(key, functionDefinition);
33+
}
34+
2635
/**
2736
* Test if a function exist.
2837
* @param functionId the function ID to test.

0 commit comments

Comments
 (0)