WingedSeal / jmc

A compiler for JMC (JavaScript-like Minecraft Function), a mcfunction extension language for making Minecraft Datapack
https://jmc.wingedseal.com
MIT License
64 stars 8 forks source link

Using return command inside the Player.join makes it constantly run the given function. #114

Closed OguzhanUmutlu closed 1 month ago

OguzhanUmutlu commented 1 month ago

When this is inputted:

Player.join(() => {
 say "hi";
 return 0;
});

In the private function normally it should put the scoreboard players operation @s 000bi5iy7_p_join = $__global__ 000bi5iy7_p_join line in the beginning, but it puts it in the last line causing the loop since the return happens before the last line.

Private function looks like this:

say hi
return 0
scoreboard players operation @s 000bi5iy7_p_join = $__global__ 000bi5iy7_p_join
OguzhanUmutlu commented 1 month ago

A quick note: In other events the scoreboard line is in the beginning so it works fine on them.

WingedSeal commented 1 month ago

I'm not sure if there's a possibility of updating the scoreboard in the function. I'll accept this it for now, reminds me later if this break anything lol.