Interop - Implementing custom event & tags
NeumimTo opened this issue · 0 comments
I have a plugin, that I want to make interop with denizen.
After some talks on discord i would like to bring the discussion here. i find discord help chat too hard to navigate thru or use as future reference for others.
The execution flow i want achieve should be as following:
>stuff happens ingame
>my plugins catches the event
>constructs denizen event and fires it
>dsc scripts listens to denizen event
>(optional) result of dsc script is passed back to my plugin which handles it for further processing
After some talks on discord i was told i should not be trying to call the dsc script directly with ScriptUtilities.createAndStartQueue(...), but to use denizen event system
and here am i struggling quite a bit, trying to do simple hello world
test:
type: world
events:
after player casts skill denizet_test:
- narrate format:cchat "It works <character.player.display_name>"
results in
In script 'skills' on line 5!
Error Message: (Initial detection) No tag-base handler for 'character'.
10:42:08 INFO: +> [ScriptEvent] Processed 1 script event paths.
Heres how i do it
Tag registration:
https://github.com/Sponge-RPG-dev/NT-RPG/blob/master/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/bridges/denizen/DenizenHook.java
- im aware matches method is wrong, i just havent got that far yet
Firing of the custom event
https://github.com/Sponge-RPG-dev/NT-RPG/blob/master/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/bridges/denizen/DenizenScriptSkillWrapper.java
The character tag:
https://github.com/Sponge-RPG-dev/NT-RPG/blob/master/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/bridges/denizen/tags/CharacterTag.java