I want to make it that a certain block can only be under a certain parent.
The problem is that when there is another block with a statement input (like in the picture) the .getParent() function returns the "parent inside the child (?)".
I was thinking to use loops to fix it, but is there a better solution for that? I'm worried about performance.
Also, another big problem, is that I was thinking about using extensions to do these checks, but I noticed that they get triggered only when the block gets detached and not reattached. This means that the .getParent() function will always return null.
How can I fix all of this?