0

I'm trying to sort out a command which forces players to return to the nether after night comes in the overword.

For example, at night all players in the overworld will be struck with the hunger effect. once they've returned to the nether, they will be cleared of the effect.

1
  • 2
    Hello, welcome to Arqade! Can you show what you have tried, like previous attempts of your command and your setup? We can help sort out the problems you have encountered.
    – 54D
    Commented Feb 28, 2020 at 11:05

2 Answers 2

2

you can use the output of a daylight detector to determine if it is nighttime. Connecting the redstone to a commandblock, which is set to "needs redstone" and "repeat". This creats a commandblock that executes the same command over and over at night.

with the command:

/effect @a[nbt={Dimension:1}] minecraft:hunger 2 2

this will cause everyone to get the hunger debuff as long as they don't return to the nether

NOTE: If you want this to work all the time you need to place this in the spawn chunk

1
  • 1
    Alternatively, /forceload the chunk the command block is in with another command block.
    – Corsaka
    Commented Feb 28, 2020 at 10:51
1

First of all you'd want to set up a scoreboard to hold the time of day:

/scoreboard objectives add time dummy

Then you'd want to have each player store the time of day in the objective created previously:

(Repeating command): /execute as @a[nbt={Dimension:0}] store result score @s time run time query daytime

Then run your command to damage players:

(Repeating command): /effect give @a[scores={time=12000..24000},nbt={Dimension:0}] wither 1 1 true

Hope this helps.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .