I am working on a game that uses commands in such a way that players disconnecting then reconnecting could break the commands. I was wondering if there is a way to detect when players join the game in 1.13.2 and run a command to give them an item. When I researched this, I found solutions for older versions using /testfor or stat.leaveGame, but those seem to be outdated in 1.13. If someone could show me the commands to use as well as the layout for command blocks/redstone that would be great. It can be for the second time they join only, or for all times that they do. Thanks
-
Questions on Stack Exchange should not be re-asked just because the current answers are outdated. – pppery Aug 19 '19 at 17:38
the way you're looking for that involved testfor
and stat.leavegame
would now be best suited by using execute
and minecraft.custom:minecraft.leave_game
. essentially, you would do all the same things you would with testfor
, except no redstone is needed now. when you use execute
, you can tell the game to run it if they have a leave game score of 0 (or whatever you need to do for it) by doing something like below;
/execute at @a as @s if score @s <scoreName> matches 0 run <command>
you could also do a different one, with this technique, for a command you want to run if their leave game score is a certain about (or higher than a certain amount);
/execute at @a as @s if score @s <scoreName> matches <value> run <command>
for <value>
, to make it run for everything up to that value or everything that value and greater, use ..<value>
or <value>..
, respectively.
-
2
-