I am trying to set a gamerule on server start, because some mod is constantly resetting it, and I have failed to find out which one it is.
I reloaded the scripts, and no errors were found.
This is all on a server-only KubeJS instance, running on Forge 1.20.1. All of those files are in server_scripts.
This is my current code, and it looks like it does not run at all.
event.server.runCommand('gamerule naturalRegeneration true');
});```
I have two other scripts as well:
This one is supposed to repeat a message every second, but alas it does not run as well.
``` ServerEvents.loaded(event => {
interval = 20;
event.server.scheduleRepeatingInTicks(interval, cb => {
event.server.runCommand('say t');
})
});```
This one is supposed to keep track of the seconds passed on my server, but it also does not run.
``` ServerEvents.loaded(event => {
let persistentData = c.source.server.persistentData
// first init
if (!persistentData.seconds) persistentData.seconds = 0
event.server.scheduleRepeatingInTicks(20, cb => {
persistentData.seconds = persistentData.seconds + 1
event.server.runCommand('say '+persistantData.seconds);
})
});```