#Reload commandRegistry events with `/kubejs reload server_scripts`

19 messages · Page 1 of 1 (latest)

bold crest
#

As I noticed, ServerEvents.commandRegistry is only reloaded on a full /reload but not on /kubejs reload server_scripts. But /reload also reloads all client resources, so it causes a lag spike for all clients on the server, which is undesirable for a simple command reloading

Is there anything I can use to reload commands more lightly?

unborn garnetBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

valid remnant
#

by it's very nature /kubejs reload does not trigger any events, just reloads the scripts.

split badge
#

you shouldnt be making scripts on a server, this being one of the many reasons..

valid remnant
#

one of the best things you can do is trigger functions outside the event, those can be reloaded

#

so your command executes a function, instead of everything happening inside the command definition

#

.execute(ctx => someFunction(ctx))

bold crest
valid remnant
#

because commandRegistry is an event

#

events do not trigger on kjs reloads

bold crest
#

hmm

#

So can I register commands elsewhere but not in commandRegistry?

#

Or I maybe I have to manually trigger the event?

valid remnant
#

datapack with mccommands.... guess what, those also require /reload

#

reload is the only trigger

bold crest
#

Ok, thank you

#

But maybe there is a way to reload everything on the server but not on clients? This lag spike is pretty annoying, considering I didn't change anything client-side

valid remnant
#

part of the process since it's reloading resources is syncing those resources to the client (like recipes)

bold crest
#

And there is no way to reload only server resources?