1

No Conventional Multiplayer Sleep

1 emeralds7 replies75 views
joakox98 started 06/18/2020 7:55 pm
One_Nose replied 06/20/2020 11:05 pm
I need some help, im working in a datapack which bring some difficulty to a SMP. One of the changes is the sleep multiplayer. I was working in this for the last 2 days... and seems to work... in singleplayer. I was testing in a server, and the server and client dont go welll, the client its cool, and let you move, but you cant place blocks, for the server, you are nearby the bed. And i dont know why, or how to fix it

The enable function:

scoreboard objectives add SleepSystem dummy
scoreboard players add SleepDays SleepSystem 1
scoreboard players set SleepPlayers SleepSystem 0
scoreboard players set RemTags SleepSystem 0
scoreboard objectives add SleepTrigger minecraft.custom:minecraft.sleep_in_bed

The tick function:

execute if score RemTags SleepSystem matches -1.. run scoreboard players remove RemTags SleepSystem 1

execute if score RemTags SleepSystem matches 0 run tag @a remove adding_zzz
execute if score RemTags SleepSystem matches 0 run tag @a remove sleeped

execute if score RemTags SleepSystem matches 0 run scoreboard players set @a SleepTrigger 0
execute if score RemTags SleepSystem matches 0 run scoreboard players set SleepPlayers SleepSystem 0

#1 Player sleep
execute if score SleepDays SleepSystem matches 1 if score @r SleepTrigger matches 1 run time set 0

execute if score SleepDays SleepSystem matches 1 if score @r SleepTrigger matches 1 run scoreboard players set @a SleepTrigger 0

# 4 Players

execute if score SleepDays SleepSystem matches 2 run tag @r[tag=!adding_zzz,tag=!sleeped,scores={SleepTrigger=1}] add adding_zzz

execute as @r[tag=adding_zzz,tag=!sleeped] run scoreboard players add SleepPlayers SleepSystem 1
execute as @r[tag=adding_zzz,tag=!sleeped] run tag @s add sleeped

execute if score SleepDays SleepSystem matches 2 run scoreboard players set @r[scores={SleepTrigger=2..}] SleepTrigger 1

execute as @e[type=minecraft:player,tag=sleeped,scores={SleepTrigger=1}] at @s run tp ~ ~ ~

execute if score SleepPlayers SleepSystem matches 2.. run time set 0

execute if score SleepPlayers SleepSystem matches 2.. run scoreboard players set RemTags SleepSystem 12000

execute if score SleepPlayers SleepSystem matches 2.. run tag @a remove adding_zzz

execute if score SleepPlayers SleepSystem matches 2.. run tag @a remove sleeped

execute if score SleepPlayers SleepSystem matches 2.. run scoreboard players set @a SleepTrigger 0

execute if score SleepPlayers SleepSystem matches 2.. run scoreboard players set SleepPlayers SleepSystem 0

if any have ideas, pls tell me
Posted by avatar
joakox98
Level 27 : Expert Miner
16

comment Login or register to post a reply.

7 replies

3
06/18/2020 11:29 pmhistory
Level 28 : Expert Theorist
One_Nose
I don't think the code is actually doing what you think it does. I can explain what's wrong, but only if you explain me what the first line in the tick function should do.

What it currrently does: The syntax you use is:
execute if score <target> <targetObjective> matches <range> run scoreboard players remove <target> <targetObjective> <amount><target> is the player you want to check his scores/remove scores from. What the first line actually does is:
Check the player named "RemTags"'s scores. If in the objective "SleepSystem" he has -1 or more, remove from "RemTags" (which is actually him) 1 point of "SleepSystem".
1
06/19/2020 9:39 am
Level 27 : Expert Miner
joakox98
yeah... about that, i put a system that deletes the tags if you doesnt pass the night

so a made a clock for... all the night, that also a "problem" but i dont see how to fix it.

Yeah i see other multiplayers datapacks... but its too basic or to complex xd
2
06/19/2020 9:57 am
Level 28 : Expert Theorist
One_Nose
But what exactly the data pack should do?
1
06/19/2020 6:48 pm
Level 27 : Expert Miner
joakox98
if sleep days are 1 automatic sleep pass, that work
if sleep days are 2, only if 4 player are sleepong, should be passing the nighr
2
06/20/2020 2:04 pm
Level 28 : Expert Theorist
One_Nose
What SleepDays, SleepPlayers and RemTags should do? It looks a lot more complicated than it should be.
1
06/20/2020 7:45 pm
Level 27 : Expert Miner
joakox98
maybe
Planet Minecraft Logo

Website

© 2010 - 2020
www.planetminecraft.com

Welcome