KubeJS (Old)

KubeJS (Old)

3M Downloads

Method not found error when setting stages via PlayerEvents.loggedIn()

antiphysika opened this issue · 2 comments

commented

Minecraft Version

1.20.1

KubeJS Version

2001.6.5-build.7

Rhino Version

2.2-build.18

Architectury Version

9.2.14

Forge/Fabric Version

NeoForge-47.1.106

Describe your issue

Pretty sure I'm not doing anything cursed but bracing for a reality check just in case 😛

With the following script:

PlayerEvents.loggedIn(event =>
{
  let clear_player_inventory = (player) =>
  {
    let inventory = player.inventory
    inventory.clear()
  }

  const { player } = event

  if (player.stages.has('cleared_initial_inventory'))
    return

  console.log(`New player logging in: ${player.name}`)

  clear_player_inventory(player)
  player.stages.set('cleared_initial_inventory')

})

I'm getting a strange method-not-found error when setting the cleared_initial_inventory player stage:

07Jun2024 19:57:06.784] [Server thread/INFO] [KubeJS Server/]: events/player/clear_initial_inventory.js#17: New player logging in: literal{antiphysika}
[07Jun2024 19:57:06.795] [Server thread/ERROR] [KubeJS Server/]: events/player/clear_initial_inventory.js#20: Error in 'PlayerEvents.loggedIn': Can't find method dev.latvian.mods.kubejs.stages.Stages.set(string).
[07Jun2024 19:57:06.796] [Server thread/ERROR] [KubeJS Server/]: …rhino.EvaluatorException: Can't find method …kubejs.stages.Stages.set(string). (server_scripts:events/player/clear_initial_inventory.js#20)
[07Jun2024 19:57:06.796] [Server thread/ERROR] [KubeJS Server/]:   at …rhino.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:67)
[...]

Logs:

Crash report/logs

No response

commented

stages.set requires a string and a boolean,
image

commented

Gahhh. What a numpty. I must've cack-handidly deleted that at some point.

Thank you! And sorry for the noise