-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
52 additions
and
33 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
fabric/src/main/java/com/lx862/jcm/mod/api/scripting/ScriptingAPI.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.lx862.jcm.mod.api.scripting; | ||
|
||
import org.apache.logging.log4j.util.TriConsumer; | ||
import vendor.com.lx862.jcm.org.mozilla.javascript.Context; | ||
import vendor.com.lx862.jcm.org.mozilla.javascript.Scriptable; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* This class contains the event to hook into scripting, i.e. add new property and objects | ||
*/ | ||
public class ScriptingAPI { | ||
private static final List<TriConsumer<String, Context, Scriptable>> onParseScriptCallback = new ArrayList<>(); | ||
|
||
public static void onParseScript(TriConsumer<String, Context, Scriptable> callback) { | ||
onParseScriptCallback.add(callback); | ||
} | ||
|
||
public static void callOnParseScriptCallback(String contextName, Context context, Scriptable scriptable) { | ||
for(TriConsumer<String, Context, Scriptable> entry : onParseScriptCallback) { | ||
entry.accept(contextName, context, scriptable); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...lx862/jcm/mod/scripting/util/MTRUtil.java → ...mod/data/pids/scripting/util/MTRUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters