World Primer

World Primer

7M Downloads

Some substitutions not working

Quarris opened this issue ยท 3 comments

commented

I found some of the substitution words to not work, unless I am doing something wrong.

Commands:

S:playerRespawnCommands <
   worldprimer-tracked-command-nth %1 tp {PLAYER_NAME} {PLAYER_BED_X} {PLAYER_BED_Y} {PLAYER_BED_Z}
   worldprimer-tracked-command-nth %1 say The player {PLAYER_NAME} has respawned for the third time at {PLAYER_BED_SPAWN_X} , {PLAYER_BED_SPAWN_Y} , {PLAYER_BED_SPAWN_Z}
>

Log:

[17:12:39] [Server thread/INFO] [worldprimer]: Running a (possibly substituted) command: 'tp Quarris {PLAYER_BED_X} {PLAYER_BED_Y} {PLAYER_BED_Z}' in dimension -29
[17:12:39] [Server thread/INFO] [worldprimer]: '{PLAYER_BED_X}' is not a valid number
[17:12:39] [Server thread/INFO] [worldprimer]: Running a (possibly substituted) command: 'say The player Quarris has respawned for the third time at {PLAYER_BED_SPAWN_X} , {PLAYER_BED_SPAWN_Y} , {PLAYER_BED_SPAWN_Z}' in dimension -29
[17:12:39] [Server thread/INFO] [minecraft/MinecraftServer]: [WorldPrimer] The player Quarris has respawned for the third time at {PLAYER_BED_SPAWN_X} , {PLAYER_BED_SPAWN_Y} , {PLAYER_BED_SPAWN_Z}

Any ideas?

commented

So it does work when slept in bed. Once the bed is destroyed (or probably obstructed) it goes back to the same outcome as mentioned above.
The documentation mentions

# Also {PLAYER_BED_X}, {PLAYER_BED_Y} and {PLAYER_BED_Z} for the last set (bed) spawn point.
# There are also {PLAYER_BED_SPAWN_X}, {PLAYER_BED_SPAWN_Y} and {PLAYER_BED_SPAWN_Z} that also check that the bed exists,
# or otherwise they will revert to the fallback world spawn point.
# Note that these will thus load that one chunk to check for the bed.

and I think that it should fall back to the world spawn point

commented

To add to that I am using worldprimer-1.12.2-0.6.0-dev.20190525.121747.jar with forge-14.23.5.2838

commented

The {PLAYER_BED_X} and {PLAYER_BED_SPAWN_X} etc. substitutions currently only get substituted if the returned position is not null, so if the player actually has slept in a bed, and/or there is a valid respawn location. Otherwise they will be left unsubstituted.

Can you try if it works if you simply sleep in a bed first, unless you had already done that for that test?

Would it perhaps be better to either use the world spawn in such a case, or to not run the command at all if some of the substitutions were not done?