Skip to content

Commit

Permalink
Merge pull request #190 from Gunivers/Clean-Code
Browse files Browse the repository at this point in the history
Ficed special items given even when option was disabled
  • Loading branch information
VForiel authored Oct 10, 2023
2 parents fe3abcc + fa05b2f commit 8452b99
Show file tree
Hide file tree
Showing 54 changed files with 255 additions and 255 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ gamerule doTileDrops false
gamerule doTraderSpawning false
gamerule doWeatherCycle false
gamerule drowningDamage true
execute if score FallDamage options matches 0 run gamerule fallDamage false
execute unless score FallDamage options matches 0 run gamerule fallDamage true
execute if score #gameplay.fall_damage.enabled options matches 0 run gamerule fallDamage false
execute unless score #gameplay.fall_damage.enabled options matches 0 run gamerule fallDamage true
gamerule fireDamage true
gamerule forgiveDeadPlayers true
gamerule keepInventory true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ tag @a add player.item.can_have_items

effect give @a minecraft:instant_health 1 100 true
effect give @a minecraft:fire_resistance 20 100 true
execute if score Regen options matches 1 run effect give @s regeneration infinite 0 true
execute if score #gameplay.regeneration.enabled options matches 1 run effect give @s regeneration infinite 0 true
gamemode survival @a[team=!spectator]

# Start message
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
scoreboard players operation @e[type=marker,name="build"] pos.y = #lava.level data
scoreboard players operation @e[type=marker,name="build"] pos.y += BuildHeight options
scoreboard players operation @e[type=marker,name="build"] pos.y += #map.build_height options
execute as @e[type=marker,name="build"] store result entity @s Pos[1] double 1 run scoreboard players get @s pos.y
execute as @e[type=marker,name="build"] at @s run fill ~-90 ~ ~-90 ~90 ~ ~90 minecraft:air replace minecraft:moving_piston
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#move it to the player coordinates and build limit height
tp @e[type=marker,name="build.limit"] ~ ~ ~
scoreboard players operation @e[type=marker,name="build.limit"] pos.y = #lava.level data
scoreboard players operation @e[type=marker,name="build.limit"] pos.y += BuildHeight options
scoreboard players operation @e[type=marker,name="build.limit"] pos.y += #map.build_height options
execute as @e[type=marker,name="build.limit"] store result entity @s Pos[1] double 1 run scoreboard players get @s pos.y

execute as @e[type=marker,name="build.limit"] at @s run fill ~-5 ~1 ~-5 ~5 ~1 ~5 minecraft:moving_piston replace #scaffolding_rush:air
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ effect give @a minecraft:resistance infinite 100 true

effect clear @a
effect give @a minecraft:instant_health 1 100 true
execute if score Regen options matches 1 run effect give @s regeneration infinite 0 true
execute if score #gameplay.regeneration.enabled options matches 1 run effect give @s regeneration infinite 0 true
worldborder center 1000 1000
schedule clear scaffolding_rush:lobby/particles

Expand Down Expand Up @@ -62,7 +62,7 @@ scoreboard players operation #lava.period.tick options *= 20 const
scoreboard players operation #villager.respawn.tick options = #villager.respawn.seconds options
scoreboard players operation #villager.respawn.tick options *= 20 const

scoreboard players operation #respawn.delay.tick options = #respawn.delay.second options
scoreboard players operation #respawn.delay.tick options = #gameplay.respawn.delay.second options
scoreboard players operation #respawn.delay.tick options *= 20 const

#initialize the wordborder start time in tics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ tag @e[type=minecraft:armor_stand,tag=new] add spread
function scaffolding_rush:game/flag/spread_flag_ingame

execute as @e[type=minecraft:armor_stand,tag=new] store result score @s data run data get entity @s UUID[1]
scoreboard players operation @e[type=minecraft:armor_stand,tag=new] data %= BuildHeight options
scoreboard players operation @e[type=minecraft:armor_stand,tag=new] data %= #map.build_height options

execute as @e[type=minecraft:armor_stand,tag=new] at @s run function scaffolding_rush:game/flag/rise

Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ execute if score #performance_mode options matches 1 as @a[gamemode=!spectator]
execute if score #performance_mode options matches 1 as @e[type=villager,tag=respawn_villager] at @s run function scaffolding_rush:game/lava/rise_locally

#rise lasting bases
execute unless score #lasting_base options matches 0 if score #lava timer >= #lava.period.tick options run function scaffolding_rush:team/create_base/rise
execute unless score #gameplay.lasting_base.enabled options matches 0 if score #lava timer >= #lava.period.tick options run function scaffolding_rush:team/create_base/rise

execute if score #lava timer >= #lava.period.tick options as @e[type=marker,name="build"] at @s run function scaffolding_rush:game/air_replace
execute if score #lava timer >= #lava.period.tick options run scoreboard players set #lava timer 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ tag @a remove player.item.can_have_items
tag @a remove player.item.have_egg

effect give @a minecraft:instant_health 1 100 true
execute if score Regen options matches 1 run effect give @s regeneration infinite 0 true
execute if score #gameplay.regeneration.enabled options matches 1 run effect give @s regeneration infinite 0 true

function scaffolding_rush:game/map/reset/__start__

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ item replace entity @a[tag=!flag_carry] weapon.offhand with air
#

# accelerate scaffolding climbing
execute if score FastClimb options matches 1 run function scaffolding_rush:mechanics/fast_climb/main
execute if score #gameplay.fast_climb.enabled options matches 1 run function scaffolding_rush:mechanics/fast_climb/main

# Avoid sand to physically stack (and then forbide creating sand towers)
function scaffolding_rush:mechanics/sand/__main__

# Make scaffolding pillars creating instantly (instead of having to place each block of the pillar and wait them to fall)
execute if score InstantPillar options matches 1 run function scaffolding_rush:mechanics/instant_pillar/__main__
execute if score #gameplay.instant_pillar.enabled options matches 1 run function scaffolding_rush:mechanics/instant_pillar/__main__

# Snowball behavior
execute as @e[type=snowball,tag=!t] at @s run function scaffolding_rush:mechanics/snowball/summon
Expand All @@ -44,7 +44,7 @@ execute if entity @e[tag=ender_pearl] run function scaffolding_rush:mechanics/en
# scaffolding_rush:player/item/replenish/ender_pearl

# Scaffoldings blocks arrows
execute if score ScaffoldingStopsArrow options matches 1 as @e[type=arrow] at @s if block ~ ~ ~ #scaffolding_rush:scaffolding run kill @s
execute if score #gameplay.scaffolding_stop_arrow.enabled options matches 1 as @e[type=arrow] at @s if block ~ ~ ~ #scaffolding_rush:scaffolding run kill @s

# Clear unconsistent villagers
execute as @e[type=villager,nbt=!{Age: 0}] run function utils:clean_kill
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,33 @@ execute unless score #flag.take_over.spawn_interval options matches 0.. run scor

# Gameplay
scoreboard objectives add option.ender_pearl trigger
execute unless score UseEnderPearl options matches 0.. run scoreboard players set UseEnderPearl options 0
execute unless score #player.item.ender_pearl.enabled options matches 0.. run scoreboard players set #player.item.ender_pearl.enabled options 0
scoreboard objectives add option.fall_damage trigger
execute unless score FallDamage options matches 0.. run scoreboard players set FallDamage options 0
execute unless score #gameplay.fall_damage.enabled options matches 0.. run scoreboard players set #gameplay.fall_damage.enabled options 0
scoreboard objectives add option.fast_climb trigger
execute unless score FastClimb options matches 0..1 run scoreboard players set FastClimb options 0
execute unless score #gameplay.fast_climb.enabled options matches 0..1 run scoreboard players set #gameplay.fast_climb.enabled options 0
scoreboard objectives add option.fireball trigger
execute unless score UseFireball options matches 0.. run scoreboard players set UseFireball options 0
execute unless score #player.item.fireball.enabled options matches 0.. run scoreboard players set #player.item.fireball.enabled options 0
scoreboard objectives add option.instant_pil trigger
execute unless score InstantPillar options matches 0.. run scoreboard players set InstantPillar options 0
execute unless score #gameplay.instant_pillar.enabled options matches 0.. run scoreboard players set #gameplay.instant_pillar.enabled options 0
scoreboard objectives add option.lasting_bases trigger
execute unless score #lasting_base options matches 0..1 run scoreboard players set #lasting_base options 0
execute unless score #gameplay.lasting_base.enabled options matches 0..1 run scoreboard players set #gameplay.lasting_base.enabled options 0
scoreboard objectives add option.regen trigger
execute unless score Regen options matches 0.. run scoreboard players set Regen options 1
execute unless score #gameplay.regeneration.enabled options matches 0.. run scoreboard players set #gameplay.regeneration.enabled options 1
scoreboard objectives add option.resp_delay trigger
execute unless score #respawn.delay.second options matches 1.. run scoreboard players set #respawn.delay.second options 3
execute unless score #gameplay.respawn.delay.second options matches 1.. run scoreboard players set #gameplay.respawn.delay.second options 3
scoreboard objectives add option.sand trigger
execute unless score UseSand options matches 0.. run scoreboard players set UseSand options 1
execute unless score #player.item.sand.enabled options matches 0.. run scoreboard players set #player.item.sand.enabled options 1
scoreboard objectives add option.scaff_stops_arrow trigger
execute unless score ScaffoldingStopsArrow options matches 0.. run scoreboard players set ScaffoldingStopsArrow options 0
execute unless score #gameplay.scaffolding_stop_arrow.enabled options matches 0.. run scoreboard players set #gameplay.scaffolding_stop_arrow.enabled options 0
scoreboard objectives add option.bumping_arrow trigger
execute unless score UseSnowball options matches 0.. run scoreboard players set UseSnowball options 0
execute unless score #player.item.bumping_arrow.enabled options matches 0.. run scoreboard players set #player.item.bumping_arrow.enabled options 0

# Map
scoreboard objectives add option.build_height trigger
execute unless score BuildHeight options matches 5.. run scoreboard players set BuildHeight options 20
execute unless score #map.build_height options matches 5.. run scoreboard players set #map.build_height options 20
scoreboard objectives add option.interactible_lobby trigger
execute unless score InteractibleLobby options matches 0..1 run scoreboard players set InteractibleLobby options 1
execute unless score #map.indestructible_lobby options matches 0..1 run scoreboard players set #map.indestructible_lobby options 1
scoreboard objectives add option.lava_speed trigger
execute unless score #lava.period.second options matches 0.. run scoreboard players set #lava.period.second options 20
scoreboard objectives add option.time_limit trigger
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@

execute store success score UseEnderPearl options if score UseEnderPearl options matches 0
execute store success score #player.item.ender_pearl.enabled options if score #player.item.ender_pearl.enabled options matches 0

execute if score UseEnderPearl options matches 0 run tellraw @a[scores={option.language=0}] ["",{"text":"[BS] ","color":"gold"},{"text":"The ender pearl has been ","color":"gray"},{"text":"deactivated","color":"red"}]
execute unless score UseEnderPearl options matches 0 run tellraw @a[scores={option.language=0}] ["",{"text":"[BS] ","color":"gold"},{"text":"The ender pearl has been ","color":"gray"},{"text":"activated","color":"green"}]
execute if score #player.item.ender_pearl.enabled options matches 0 run tellraw @a[scores={option.language=0}] ["",{"text":"[BS] ","color":"gold"},{"text":"The ender pearl has been ","color":"gray"},{"text":"deactivated","color":"red"}]
execute unless score #player.item.ender_pearl.enabled options matches 0 run tellraw @a[scores={option.language=0}] ["",{"text":"[BS] ","color":"gold"},{"text":"The ender pearl has been ","color":"gray"},{"text":"activated","color":"green"}]

execute if score UseEnderPearl options matches 0 run tellraw @a[scores={option.language=1}] ["",{"text":"[BS] ","color":"gold"},{"text":"La perle de l'Ender ","color":"gray"},{"text":"désactivée","color":"red"}]
execute unless score UseEnderPearl options matches 0 run tellraw @a[scores={option.language=1}] ["",{"text":"[BS] ","color":"gold"},{"text":"La perle de l'Ender ","color":"gray"},{"text":"activée","color":"green"}]

execute if score UseEnderPearl options matches 0 run scoreboard players set @a[tag=player.item.can_have_items] player.item.ender_pearl.count 0
execute unless score UseEnderPearl options matches 0 run scoreboard players set @a[tag=player.item.can_have_items] player.item.ender_pearl.count 1
execute if score #player.item.ender_pearl.enabled options matches 0 run tellraw @a[scores={option.language=1}] ["",{"text":"[BS] ","color":"gold"},{"text":"La perle de l'Ender ","color":"gray"},{"text":"désactivée","color":"red"}]
execute unless score #player.item.ender_pearl.enabled options matches 0 run tellraw @a[scores={option.language=1}] ["",{"text":"[BS] ","color":"gold"},{"text":"La perle de l'Ender ","color":"gray"},{"text":"activée","color":"green"}]

scoreboard players set @s option.ender_pearl 0
scoreboard players enable @s option.ender_pearl
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

execute store success score FallDamage options if score FallDamage options matches 0
execute store success score #gameplay.fall_damage.enabled options if score #gameplay.fall_damage.enabled options matches 0

execute if score FallDamage options matches 0 run tellraw @a[scores={option.language=0}] ["",{"text":"[BS] ","color":"gold"},{"text":"Fall damage has been ","color":"gray"},{"text":"deactivated","color":"red"}]
execute unless score FallDamage options matches 0 run tellraw @a[scores={option.language=0}] ["",{"text":"[BS] ","color":"gold"},{"text":"Fall damage has been ","color":"gray"},{"text":"activated","color":"green"}]
execute if score #gameplay.fall_damage.enabled options matches 0 run tellraw @a[scores={option.language=0}] ["",{"text":"[BS] ","color":"gold"},{"text":"Fall damage has been ","color":"gray"},{"text":"deactivated","color":"red"}]
execute unless score #gameplay.fall_damage.enabled options matches 0 run tellraw @a[scores={option.language=0}] ["",{"text":"[BS] ","color":"gold"},{"text":"Fall damage has been ","color":"gray"},{"text":"activated","color":"green"}]

execute if score FallDamage options matches 0 run tellraw @a[scores={option.language=1}] ["",{"text":"[BS] ","color":"gold"},{"text":"Les dégats de chutes ont été ","color":"gray"},{"text":"désactivés","color":"red"}]
execute unless score FallDamage options matches 0 run tellraw @a[scores={option.language=1}] ["",{"text":"[BS] ","color":"gold"},{"text":"Les dégats de chutes ont été ","color":"gray"},{"text":"activés","color":"green"}]
execute if score #gameplay.fall_damage.enabled options matches 0 run tellraw @a[scores={option.language=1}] ["",{"text":"[BS] ","color":"gold"},{"text":"Les dégats de chutes ont été ","color":"gray"},{"text":"désactivés","color":"red"}]
execute unless score #gameplay.fall_damage.enabled options matches 0 run tellraw @a[scores={option.language=1}] ["",{"text":"[BS] ","color":"gold"},{"text":"Les dégats de chutes ont été ","color":"gray"},{"text":"activés","color":"green"}]

execute if score FallDamage options matches 0 run gamerule fallDamage false
execute unless score FallDamage options matches 0 run gamerule fallDamage true
execute if score #gameplay.fall_damage.enabled options matches 0 run gamerule fallDamage false
execute unless score #gameplay.fall_damage.enabled options matches 0 run gamerule fallDamage true

scoreboard players set @s option.fall_damage 0
scoreboard players enable @s option.fall_damage
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@

#generated option function

execute store success score FastClimb options if score FastClimb options matches 0
execute store success score #gameplay.fast_climb.enabled options if score #gameplay.fast_climb.enabled options matches 0

execute if score FastClimb options matches 0 run tellraw @a[scores={option.language=0}] ["",{"text":"[BS] ","color":"gold"},{"text":"Fast climb has been ","color":"gray"},{"text":"deactivated","color":"red"}]
execute unless score FastClimb options matches 0 run tellraw @a[scores={option.language=0}] ["",{"text":"[BS] ","color":"gold"},{"text":"Fast climb has been ","color":"gray"},{"text":"activated","color":"green"}]
execute if score #gameplay.fast_climb.enabled options matches 0 run tellraw @a[scores={option.language=0}] ["",{"text":"[BS] ","color":"gold"},{"text":"Fast climb has been ","color":"gray"},{"text":"deactivated","color":"red"}]
execute unless score #gameplay.fast_climb.enabled options matches 0 run tellraw @a[scores={option.language=0}] ["",{"text":"[BS] ","color":"gold"},{"text":"Fast climb has been ","color":"gray"},{"text":"activated","color":"green"}]

execute if score FastClimb options matches 0 run tellraw @a[scores={option.language=1}] ["",{"text":"[BS] ","color":"gold"},{"text":"La Monté rapide a été ","color":"gray"},{"text":"désactivée","color":"red"}]
execute unless score FastClimb options matches 0 run tellraw @a[scores={option.language=1}] ["",{"text":"[BS] ","color":"gold"},{"text":"La Monté rapide a été ","color":"gray"},{"text":"activée","color":"green"}]
execute if score #gameplay.fast_climb.enabled options matches 0 run tellraw @a[scores={option.language=1}] ["",{"text":"[BS] ","color":"gold"},{"text":"La Monté rapide a été ","color":"gray"},{"text":"désactivée","color":"red"}]
execute unless score #gameplay.fast_climb.enabled options matches 0 run tellraw @a[scores={option.language=1}] ["",{"text":"[BS] ","color":"gold"},{"text":"La Monté rapide a été ","color":"gray"},{"text":"activée","color":"green"}]

scoreboard players set @s option.fast_climb 0
scoreboard players enable @s option.fast_climb
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@

execute store success score UseFireball options if score UseFireball options matches 0
execute store success score #player.item.fireball.enabled options if score #player.item.fireball.enabled options matches 0

execute if score UseFireball options matches 0 run tellraw @a[scores={option.language=0}] ["",{"text":"[BS] ","color":"gold"},{"text":"Fireball has been ","color":"gray"},{"text":"deactivated","color":"red"}]
execute unless score UseFireball options matches 0 run tellraw @a[scores={option.language=0}] ["",{"text":"[BS] ","color":"gold"},{"text":"Fireball has been ","color":"gray"},{"text":"activated","color":"green"}]
execute if score #player.item.fireball.enabled options matches 0 run tellraw @a[scores={option.language=0}] ["",{"text":"[BS] ","color":"gold"},{"text":"Fireball has been ","color":"gray"},{"text":"deactivated","color":"red"}]
execute unless score #player.item.fireball.enabled options matches 0 run tellraw @a[scores={option.language=0}] ["",{"text":"[BS] ","color":"gold"},{"text":"Fireball has been ","color":"gray"},{"text":"activated","color":"green"}]

execute if score UseFireball options matches 0 run tellraw @a[scores={option.language=1}] ["",{"text":"[BS] ","color":"gold"},{"text":"La boule de feu ","color":"gray"},{"text":"désactivée","color":"red"}]
execute unless score UseFireball options matches 0 run tellraw @a[scores={option.language=1}] ["",{"text":"[BS] ","color":"gold"},{"text":"La boule de feu ","color":"gray"},{"text":"activée","color":"green"}]

execute if score UseFireball options matches 0 run scoreboard players set @a[tag=player.item.can_have_items] player.item.fireball.count 0
execute unless score UseFireball options matches 0 run scoreboard players set @a[tag=player.item.can_have_items] player.item.fireball.count 1
execute if score #player.item.fireball.enabled options matches 0 run tellraw @a[scores={option.language=1}] ["",{"text":"[BS] ","color":"gold"},{"text":"La boule de feu ","color":"gray"},{"text":"désactivée","color":"red"}]
execute unless score #player.item.fireball.enabled options matches 0 run tellraw @a[scores={option.language=1}] ["",{"text":"[BS] ","color":"gold"},{"text":"La boule de feu ","color":"gray"},{"text":"activée","color":"green"}]

scoreboard players set @s option.fireball 0
scoreboard players enable @s option.fireball
Expand Down
Loading

0 comments on commit 8452b99

Please sign in to comment.