#CommandRegistry help, getting unexpected error

19 messages · Page 1 of 1 (latest)

finite echo
#
ServerEvents.commandRegistry((event) => {
  const { commands: Commands, arguments: Arguments } = event;

  event.register(
    Commands.literal("bounty").executes((c) => c.server.tell("Test Message")),
  );
});```

Im getting 

"An unexpected error ...." when running /bounty

What's the right way for this?
flat cargoBOT
#

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

echo phoenixBOT
#

You can find your KubeJS server log in /minecraft/logs/kubejs/server.log.
If you are on 1.18 or below it will be called server.txt.
Please send it if asked, as it contains helpful information.

finite echo
#

Fixed the message by doing

ServerEvents.commandRegistry((event) => {
  const { commands: Commands, arguments: Arguments } = event;

  event.register(
    Commands.literal("bounty")
      .executes((c) => c.source.getPlayer().tell("§e!bounty")),
  );
});

However the error persists.

finite echo
#

Minecraft log

05:22:49.760
game
[05:22:49] [Render thread/INFO] [minecraft/ChatComponent]: [System] [CHAT] !bounty
05:22:49.760
game
[05:22:49] [Render thread/INFO] [minecraft/ChatComponent]: [System] [CHAT] An unexpected error occurred trying to execute that command

My server.log is empty

#

its weird its not giving anything

#
[05:21:36] [INIT] KubeJS 2001.6.4-build.133; MC 2001 forge
[05:21:36] [INIT] Loaded plugins:
[05:21:36] [INIT] - dev.latvian.mods.kubejs.forge.BuiltinKubeJSForgePlugin
[05:21:36] [INIT] - dev.latvian.mods.kubejs.forge.BuiltinKubeJSForgeClientPlugin
[05:21:36] [INIT] - com.almostreliable.lootjs.kube.LootJSPlugin
[05:21:36] [INFO] Loaded script server_scripts:bounty.js in 0.001 s
[05:21:36] [INFO] Loaded script server_scripts:crafting.js in 0.0 s
[05:21:36] [INFO] example.js#5: Hello, World! (Loaded server scripts)
[05:21:36] [INFO] Loaded script server_scripts:example.js in 0.0 s
[05:21:36] [INFO] Loaded script server_scripts:loot.js in 0.0 s
[05:21:36] [INFO] Loaded script server_scripts:motd.js in 0.0 s
[05:21:36] [INFO] Loaded 5/5 KubeJS server scripts in 0.004 s with 0 errors and 0 warnings
[05:21:36] [INFO] Scripts loaded
[05:21:37] [INFO] Server resource reload complete!

server.log

cobalt hill
finite echo
#

do i have to close for the server.log to save?

cobalt hill
finite echo
#

blank

#

it paused cause i alt tabbed to take a screenshot

#

i cleared logs

#

then ran command

#

this is what i get

#

server.log is empty

#

Figured it out, you have to return 1 to the callbacks