EndstoneMC / endstone

Endstone - High-level Plugin API for Modding Bedrock Dedicated Servers (BDS), in both Python and C++.
http://endstone.dev/
Apache License 2.0
226 stars 21 forks source link

[feature] Add possibility to perform `/scriptevent` command. #64

Open m0lc14kk opened 23 hours ago

m0lc14kk commented 23 hours ago

Is your feature request related to an issue? Please describe. The last update broke my IPC for member players as it is no longer possible to execute the scriptevent command via the Endstone API to connect to my add-on script.

Describe the solution you are interested in My idea is to create a new method for the Player class: Player.perform_script_event(header: str, body: str) that would behave like the default /scriptevent command in the game.

Describe alternatives you have considered The only solution to this problem is to set the player permissions to the operator, then execute the command using the Player.perform_command method and capture the operator back at the end of the task, but this would cause exploits and is not safe.

Additional Context I prefer to use add-ons rather than plugins and that's why I suggest this. This API isn't ready yet, but it already has some features that add-ons don't support, so we can use IPC with the add-on and Endstone to do even better things. 🚀

tutinoko2048 commented 21 hours ago

scriptevent is broadcasted in the world so I do not think it should be a method of Player. I suggest implementing it in other classes or the class actual native method is implemented.

m0lc14kk commented 20 hours ago

It's not only broadcasted in the world. You can perform a scriptevent as an Entity instance or World (in scripting API and Endstone API). I think the best option should be a native method for Entity and Server instances.

By the way, I forgot to attach documentation of a ScriptEvent event in scripting API for add-ons.

m0lc14kk commented 14 hours ago

Small update to my suggestion: it's possible to perform a /scriptevent command via server, but in my opinion it should be possible aswell via some Entity or Server metbod too.