16 lines
1.1 KiB
MCFunction
16 lines
1.1 KiB
MCFunction
# Lobby effects
|
|
# Logic:
|
|
# - Effect lobby diberikan hanya 1x saat player masuk lobby.
|
|
# - Durasi dibuat sangat panjang supaya icon effect tidak refresh/berkedip terus.
|
|
# - Saat player keluar lobby, effect lobby dibersihkan 1x lalu tag dihapus.
|
|
|
|
# Player baru masuk lobby: beri semua effect lobby sekali saja.
|
|
execute as @a[tag=!lobby_effects] at @s if predicate lobby:allowed_dimension run effect give @s minecraft:saturation infinite 2 true
|
|
execute as @a[tag=!lobby_effects] at @s if predicate lobby:allowed_dimension run effect give @a minecraft:instant_health infinite 2 true
|
|
execute as @a[tag=!lobby_effects] at @s if predicate lobby:allowed_dimension run tag @s add lobby_effects
|
|
|
|
# Saat player sudah bukan di lobby, bersihkan effect lobby sekali lalu hapus tag.
|
|
execute as @a[tag=lobby_effects] at @s unless predicate lobby:allowed_dimension run effect clear @s minecraft:saturation
|
|
execute as @a[tag=lobby_effects] at @s unless predicate lobby:allowed_dimension run effect clear @s minecraft:instant_health
|
|
execute as @a[tag=lobby_effects] at @s unless predicate lobby:allowed_dimension run tag @s remove lobby_effects
|