If you're trying to make a mod that will work for anyone playing in your sever, you will need to have functions that are triggered by events (block break, player chat, player interact, etc.).
The most common way to use an event trigger is like this:
This code will simply send a "You broke a block" message whenever you break a block. But if other players in the server break a block they won't receive it.
First we have to look at the JS:
In order to make the event work for everyone we need to add an extra parameter at the end of the event trigger, it would look something like this:
- events.when("block.BlockBreakEvent",on_break, me, false);
The false at the end indicates, that anyone in the server can trigger it. This line of code should be placed in a JS block, and it would replace the event block:
Now, we need to change one more thing. If we leave the code like that, every time a player breaks a block you (or the person who ran the mod) will receive the message; not the player who destroyed the block. So, instead of sending the message to "me" we have to send it to the "info's player"; meaning the person who destroyed the block:
To summarize: when you run the mod, anytime a player in the server breaks a block, they will get a message saying "You broke a block".