Ajneb97 / ConditionalEvents

MIT License
22 stars 12 forks source link

[Feature Request] plugin_reload event #78

Open Clexus opened 1 month ago

Clexus commented 1 month ago

I have some events that set variable to true and "wait" and set to false. But when the plugin reloaded, wait actions will stop, and the variables keep the true value. I need a plugin_reload event, it's a player event

Ajneb97 commented 1 month ago

Could you provide me with an event example? Wait actions tasks are not managed at all, so they never should stop.

Clexus commented 1 month ago

reload event example or wait event example?

syqx:
    type: call
    conditions:
    - '%mycommand_playerdata_tiaozhaning% != yes'
    actions:
      default:
      - 'player_command_as_op: setplayerdata %player% tiaozhaning yes'
      - 'player_command_as_op: setplayerdata %player% tiaozhan.syqx.wh 0'
      - 'player_command_as_op: setplayerdata %player% tiaozhan.syqx.slss 0'
      - 'wait: 300'
      - 'call_event: syqx2'
  syqx2:
    type: call
    conditions:
    - '%mycommand_playerdata_tiaozhaning% == yes'
    - '%mycommand_playerdata_tiaozhan.syqx.wh% < 100 or %mycommand_playerdata_tiaozhan.syqx.wh% < 100 execute fail'
    - '%mycommand_playerdata_tiaozhan.syqx.wh% >= 100 and %mycommand_playerdata_tiaozhan.syqx.wh% >= 100 execute suc'
    actions:
      fail:
      - 'message: &c&l挑战失败...你只杀了&4&l%mycommand_playerdata_tiaozhan.syqx.wh%&c&l个亡魂和&4&l%mycommand_playerdata_tiaozhan.syqx.slss%&c&l个死灵术师'
      - 'player_command_as_op: setplayerdata %player% tiaozhaning no'
      - 'player_command_as_op: addplayerdata %player% tiaozhan.fail.all 1'
      - 'player_command_as_op: addplayerdata %player% tiaozhan.fail.syqx 1'
      suc:
      - 'message: &e&l挑战成功!你杀了&4&l%mycommand_playerdata_tiaozhan.syqx.wh%&e&l个亡魂和&4&l%mycommand_playerdata_tiaozhan.syqx.slss%&e&l个死灵术师!'
      - 'player_command_as_op: setplayerdata %player% tiaozhaning no'
      - 'player_command_as_op: addplayerdata %player% tiaozhan.suc.all 1'
      - 'player_command_as_op: addplayerdata %player% tiaozhan.suc.syqx 1'
      - 'console_command: eco give %player% 12000'
      - 'console_command: p give %player% 200'

In the events above, players are doing challenges, they need to kill 100 A mob and B mob in 5 minutes. So there's "wait:300" When I reload plugin, wait action in "syqx" will stop, and tiaozhaning variable keep the "yes" value Players should rejoin to set them to false automatically

Ajneb97 commented 1 month ago

But what does "setplayerdata" have anything to do with ConditionalEvents? If you want the variable to be reset when you use /ce reload, then you must use a player_command or console_command event and reset the variables manually.

Clexus commented 1 month ago

But what does "setplayerdata" have anything to do with ConditionalEvents? If you want the variable to be reset when you use /ce reload, then you must use a player_command or console_command event and reset the variables manually.

The problem is wait action, not my commands, if wait actions won't stop after reloading, the datas will finally set to false

Ajneb97 commented 1 month ago

That's why I meant by my initial response: "Wait actions tasks are not managed at all, so they never should stop."

For that I need to create an interrupt manager to stop wait actions.