friendlyhj/ZenUtils

Catenations not working (need more info)

Closed this issue · 1 comments

(This is unfinished issue, im still investigating it)

I have code that prevent players to visit Nether if they have lower than 30 HP.
https://github.com/Krutoy242/Enigmatica2Expert-Extended/blob/master/scripts/category/dimensions.zs

Problem is that players doesnt receive message.

This would work:

player.sendRichTextMessage(...);

This won't:

player.world.catenation().sleep(1).then(function(world, ctx) {
	player.sendRichTextMessage(...);
}).start();

Interesting note, is that this code worked fine on older (several month - year old) versions.

Still investigating issue.

I have a function:

function showWithDelay(player as IPlayer, lang as string) {
  print("~~~ Entering showWithDelay");
  player.world.catenation().sleep(20 * 10).then(function(world, ctx) {
    print("~~~ Inside Catenation");
    player.sendRichTextMessage(crafttweaker.text.ITextComponent.fromTranslation(lang));
    print("~~~ End of Catenation");
  }).start();
  print("~~~ Exiting showWithDelay");
}

When this function called "naturally" on some events like onPlayerLoggedIn, its not working. Only what i see in crafttweaker.log is

~~~ Entering showWithDelay
~~~ Exiting showWithDelay

Catenation not working there https://github.com/Krutoy242/Enigmatica2Expert-Extended/blob/a3e5203f44a2ce656216d3dfa0b2f9b49c6b8467/scripts/skyblock/onPlayerLoggedIn.zs#L25-L26

But then, when i add another hook for events, for example, onPlayerLeftClickBlock, and call /ct reload, catenations working again.