Skip to content

Commit

Permalink
Add scorebaord do2.utility.onInstance, and run most actions on it rat…
Browse files Browse the repository at this point in the history
…her than onServer (0.13.17)
  • Loading branch information
Bavadin authored Dec 20, 2024
1 parent a092398 commit 0f45de2
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 57 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
log-event exit-button-pressed 1

execute if score $dungeon do2.utility.onServer matches 1 run kick @a[tag=!do2.staff]
execute if score $dungeon do2.utility.onServer matches 1 run tellraw @s ["",{"text":"[§9B§r]: You have the tag [§bdo2.staff§r], and this has stopped:\n - §5/kick "},{"selector":"@s","color":"dark_purple"},{"text":"\n§f[§9B§r]: Click "},{"text":"§b[here]","clickEvent":{"action":"run_command","value":"/kick @s"}},{"text":" to run the command anyway."}]
execute if score $dungeon do2.utility.onInstance matches 1 run kick @a[tag=!do2.staff]
execute if score $dungeon do2.utility.onInstance matches 1 run tellraw @s ["",{"text":"[§9B§r]: You have the tag [§bdo2.staff§r], and this has stopped:\n - §5/kick "},{"selector":"@s","color":"dark_purple"},{"text":"\n§f[§9B§r]: Click "},{"text":"§b[here]","clickEvent":{"action":"run_command","value":"/kick @s"}},{"text":" to run the command anyway."}]


execute if score $dungeon do2.utility.onServer matches 1 unless entity @a[tag=do2.staff] run stop
execute if score $dungeon do2.utility.onServer matches 1 as @a[tag=do2.staff] run tellraw @s ["",{"text":"[§9B§r]: You have the tag [§bdo2.staff§r], and this has stopped:\n - §5/stop\n§f[§9B§r]: Click "},{"text":"§b[here]","clickEvent":{"action":"run_command","value":"/stop"}},{"text":" to run the command anyway."}]
execute if score $dungeon do2.utility.onInstance matches 1 unless entity @a[tag=do2.staff] run stop
execute if score $dungeon do2.utility.onInstance matches 1 as @a[tag=do2.staff] run tellraw @s ["",{"text":"[§9B§r]: You have the tag [§bdo2.staff§r], and this has stopped:\n - §5/stop\n§f[§9B§r]: Click "},{"text":"§b[here]","clickEvent":{"action":"run_command","value":"/stop"}},{"text":" to run the command anyway."}]
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

# This command will NEVER run, player's aren't bees :P
# But, since the command "is-dungeon-instance" is part of the wordage, this file will fail to load if NOT on an instance.
execute as @p if entity @s[type=bee] run is-dungeon-instance

scoreboard players set $dungeon do2.utility.onInstance 1
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
execute as @a[scores={do2.logs.datapack_setup=1..}] run tellraw @s "§f[§9B§r]: Datapack loaded."
# - End Log -

# Check if I'm on the server or not.
# Check where I'm running.
scoreboard objectives add do2.utility.onServer dummy "Checking if this Brilliance is loaded on the server"
execute unless score $dungeon do2.utility.onServer matches 0.. run scoreboard players set $dungeon do2.utility.onServer 0
function do2:agronet/test_for_agronet
scoreboard objectives add do2.utility.onInstance dummy "Checking if this Brilliance is loaded on an instance"
execute unless score $dungeon do2.utility.onInstance matches 0.. run scoreboard players set $dungeon do2.utility.onInstance 0
function do2:agronet/test_for_instance

# Setup scoreboard
function do2:scoreboard/setup/all
# Setup stats room
Expand Down Expand Up @@ -35,52 +39,52 @@ time set noon
weather clear


# If server has agronet, than set worldspawn to be the deck area.
# If server has is-dungeon-instance, than set worldspawn to be the deck area.
# Otherwise set worldspawn to be the portal
execute if score $dungeon do2.utility.onServer matches 0 run setworldspawn -524 103 2167
execute if score $dungeon do2.utility.onServer matches 1 run setworldspawn -547 115 1980

# If server has agronet, unlock the iron door. NOTE: If it's on the server, only one use
execute if score $dungeon do2.utility.onServer matches 1 run setblock -551 119 1977 minecraft:redstone_block
execute if score $dungeon do2.utility.onServer matches 0 run setblock -551 119 1977 air

# If server does not have agronet, remove the fall chamber.
execute if score $dungeon do2.utility.onServer matches 0 run fill -548 111 1980 -548 73 1980 air
execute if score $dungeon do2.utility.onServer matches 0 run fill -547 111 1981 -547 73 1981 air
execute if score $dungeon do2.utility.onServer matches 0 run fill -546 109 1980 -546 73 1980 air
execute if score $dungeon do2.utility.onServer matches 0 run fill -547 111 1979 -547 73 1979 air
execute if score $dungeon do2.utility.onServer matches 0 run fill -547 111 1980 -547 110 1980 air
execute if score $dungeon do2.utility.onServer matches 0 run fill -549 72 1978 -546 70 1982 air

# If server has agronet, create card selection station.
execute if score $dungeon do2.utility.onServer matches 1 run setblock -551 115 1982 minecraft:warped_wall_sign[facing=north,waterlogged=false]{back_text:{color:"black",has_glowing_text:0b,messages:['{"text":""}','{"text":""}','{"text":""}','{"text":""}']},front_text:{color:"light_gray",has_glowing_text:1b,messages:['{"text":"Card selection"}','{"text":"station. Push"}','{"text":"button to get"}','{"text":"the shulker back."}']},is_waxed:0b}
execute if score $dungeon do2.utility.onServer matches 1 run setblock -551 114 1982 minecraft:warped_button[face=wall,facing=north,powered=false]
execute if score $dungeon do2.utility.onServer matches 1 run setblock -551 112 1982 minecraft:tinted_glass
execute if score $dungeon do2.utility.onServer matches 1 run setblock -551 111 1982 minecraft:redstone_lamp[lit=true]
execute if score $dungeon do2.utility.onServer matches 1 run setblock -551 111 1981 minecraft:redstone_block
execute if score $dungeon do2.utility.onServer matches 1 run setblock -552 112 1982 minecraft:deepslate_tiles
execute if score $dungeon do2.utility.onServer matches 1 run setblock -551 112 1983 minecraft:deepslate_tiles
execute if score $dungeon do2.utility.onServer matches 1 run setblock -551 112 1984 minecraft:deepslate_tiles
execute if score $dungeon do2.utility.onServer matches 1 run setblock -552 113 1983 minecraft:deepslate_tiles
execute if score $dungeon do2.utility.onServer matches 1 run setblock -552 113 1984 minecraft:deepslate_tiles
execute if score $dungeon do2.utility.onServer matches 1 run setblock -551 115 1984 minecraft:deepslate_tiles
execute if score $dungeon do2.utility.onServer matches 1 run setblock -551 114 1984 minecraft:note_block[instrument=harp,note=0,powered=false]
execute if score $dungeon do2.utility.onServer matches 1 run setblock -551 113 1984 minecraft:sticky_piston[extended=false,facing=north]
execute if score $dungeon do2.utility.onServer matches 0 run setblock -551 115 1982 air
execute if score $dungeon do2.utility.onServer matches 0 run setblock -551 114 1982 air
execute if score $dungeon do2.utility.onServer matches 0 run setblock -551 112 1982 minecraft:polished_basalt[axis=x]
execute if score $dungeon do2.utility.onServer matches 0 run setblock -551 111 1982 air
execute if score $dungeon do2.utility.onServer matches 0 run setblock -551 111 1981 air
execute if score $dungeon do2.utility.onServer matches 0 run setblock -552 112 1982 air
execute if score $dungeon do2.utility.onServer matches 0 run setblock -551 112 1983 air
execute if score $dungeon do2.utility.onServer matches 0 run setblock -551 112 1984 air
execute if score $dungeon do2.utility.onServer matches 0 run setblock -552 113 1983 air
execute if score $dungeon do2.utility.onServer matches 0 run setblock -552 113 1984 air
execute if score $dungeon do2.utility.onServer matches 0 run setblock -551 115 1984 air
execute if score $dungeon do2.utility.onServer matches 0 run setblock -551 114 1984 air
execute if score $dungeon do2.utility.onServer matches 0 run setblock -551 113 1984 air

# If server has agronet, create manual shulker breaker.
execute if score $dungeon do2.utility.onInstance matches 0 run setworldspawn -524 103 2167
execute if score $dungeon do2.utility.onInstance matches 1 run setworldspawn -547 115 1980

# If server has is-dungeon-instance, unlock the iron door. NOTE: If it's on the server, only one use
execute if score $dungeon do2.utility.onInstance matches 1 run setblock -551 119 1977 minecraft:redstone_block
execute if score $dungeon do2.utility.onInstance matches 0 run setblock -551 119 1977 air

# If server does not have is-dungeon-instance, remove the fall chamber.
execute if score $dungeon do2.utility.onInstance matches 0 run fill -548 111 1980 -548 73 1980 air
execute if score $dungeon do2.utility.onInstance matches 0 run fill -547 111 1981 -547 73 1981 air
execute if score $dungeon do2.utility.onInstance matches 0 run fill -546 109 1980 -546 73 1980 air
execute if score $dungeon do2.utility.onInstance matches 0 run fill -547 111 1979 -547 73 1979 air
execute if score $dungeon do2.utility.onInstance matches 0 run fill -547 111 1980 -547 110 1980 air
execute if score $dungeon do2.utility.onInstance matches 0 run fill -549 72 1978 -546 70 1982 air

# If server has is-dungeon-instance, create card selection station.
execute if score $dungeon do2.utility.onInstance matches 1 run setblock -551 115 1982 minecraft:warped_wall_sign[facing=north,waterlogged=false]{back_text:{color:"black",has_glowing_text:0b,messages:['{"text":""}','{"text":""}','{"text":""}','{"text":""}']},front_text:{color:"light_gray",has_glowing_text:1b,messages:['{"text":"Card selection"}','{"text":"station. Push"}','{"text":"button to get"}','{"text":"the shulker back."}']},is_waxed:0b}
execute if score $dungeon do2.utility.onInstance matches 1 run setblock -551 114 1982 minecraft:warped_button[face=wall,facing=north,powered=false]
execute if score $dungeon do2.utility.onInstance matches 1 run setblock -551 112 1982 minecraft:tinted_glass
execute if score $dungeon do2.utility.onInstance matches 1 run setblock -551 111 1982 minecraft:redstone_lamp[lit=true]
execute if score $dungeon do2.utility.onInstance matches 1 run setblock -551 111 1981 minecraft:redstone_block
execute if score $dungeon do2.utility.onInstance matches 1 run setblock -552 112 1982 minecraft:deepslate_tiles
execute if score $dungeon do2.utility.onInstance matches 1 run setblock -551 112 1983 minecraft:deepslate_tiles
execute if score $dungeon do2.utility.onInstance matches 1 run setblock -551 112 1984 minecraft:deepslate_tiles
execute if score $dungeon do2.utility.onInstance matches 1 run setblock -552 113 1983 minecraft:deepslate_tiles
execute if score $dungeon do2.utility.onInstance matches 1 run setblock -552 113 1984 minecraft:deepslate_tiles
execute if score $dungeon do2.utility.onInstance matches 1 run setblock -551 115 1984 minecraft:deepslate_tiles
execute if score $dungeon do2.utility.onInstance matches 1 run setblock -551 114 1984 minecraft:note_block[instrument=harp,note=0,powered=false]
execute if score $dungeon do2.utility.onInstance matches 1 run setblock -551 113 1984 minecraft:sticky_piston[extended=false,facing=north]
execute if score $dungeon do2.utility.onInstance matches 0 run setblock -551 115 1982 air
execute if score $dungeon do2.utility.onInstance matches 0 run setblock -551 114 1982 air
execute if score $dungeon do2.utility.onInstance matches 0 run setblock -551 112 1982 minecraft:polished_basalt[axis=x]
execute if score $dungeon do2.utility.onInstance matches 0 run setblock -551 111 1982 air
execute if score $dungeon do2.utility.onInstance matches 0 run setblock -551 111 1981 air
execute if score $dungeon do2.utility.onInstance matches 0 run setblock -552 112 1982 air
execute if score $dungeon do2.utility.onInstance matches 0 run setblock -551 112 1983 air
execute if score $dungeon do2.utility.onInstance matches 0 run setblock -551 112 1984 air
execute if score $dungeon do2.utility.onInstance matches 0 run setblock -552 113 1983 air
execute if score $dungeon do2.utility.onInstance matches 0 run setblock -552 113 1984 air
execute if score $dungeon do2.utility.onInstance matches 0 run setblock -551 115 1984 air
execute if score $dungeon do2.utility.onInstance matches 0 run setblock -551 114 1984 air
execute if score $dungeon do2.utility.onInstance matches 0 run setblock -551 113 1984 air

# If server has is-dungeon-instance, create manual shulker breaker.
execute if score $dungeon do2.utility.onServer matches 1 run setblock -562 116 1982 minecraft:warped_wall_sign[facing=east,waterlogged=false]{back_text:{color:"black",has_glowing_text:0b,messages:['{"text":""}','{"text":""}','{"text":""}','{"text":""}']},front_text:{color:"white",has_glowing_text:1b,messages:['{"text":"<-- Press button"}','{"text":"if in adventure"}','{"text":"mode and can\'t"}','{"text":"break shulker"}']},is_waxed:0b}
execute if score $dungeon do2.utility.onServer matches 1 run setblock -562 116 1983 minecraft:warped_button[face=wall,facing=east,powered=false]
execute if score $dungeon do2.utility.onServer matches 1 run setblock -564 116 1983 minecraft:redstone_wire[east=side,north=none,power=0,south=none,west=side]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ execute if score $dungeon do2.config.vexTracking matches 1 run function do2:forc
execute if score $dungeon do2.config.forceGamemode matches 1 as @a[team=do2.ghosts] at @s if entity @s[gamemode=spectator] unless entity @s[tag=do2.staff] unless entity @s[name=TangoCam] unless entity @s[name=tangocam] run spectate @p[team=do2.players] @s
execute if score $dungeon do2.config.forceGamemode matches 1 as @a[team=do2.spectators] at @s if entity @s[gamemode=spectator] unless entity @s[tag=do2.staff] unless entity @s[name=TangoCam] unless entity @s[name=tangocam] run spectate @p[team=do2.players] @s

# If we're on the server, game isn't active. Enforce spectators to stay in lobby.
execute unless entity @e[team=do2.players] if score $dungeon do2.utility.onServer matches 1 as @a[gamemode=spectator,name=!tangocam,name=!TangoCam] at @s run function do2:ensure_spectator_location
# If we're on an instance, game isn't active. Enforce spectators to stay in lobby.
execute unless entity @e[team=do2.players] if score $dungeon do2.utility.onInstance matches 1 as @a[gamemode=spectator,name=!tangocam,name=!TangoCam] at @s run function do2:ensure_spectator_location

# Force player's food.
execute if score $dungeon do2.config.forceFood matches 1 as @a[scores={do2.utility.shouldForceFood=1}] run function do2:dungeon_setup/control_player_saturation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ execute positioned -547 113 1980 if entity @s[distance=..5] at @s run tp @s ~ ~
execute positioned -524 103 2167 if entity @s[distance=..10] at @s run tp @s ~ ~ ~ 180 -20

# If game hasn't started. Swap the difficulty, to the user's last used difficulty.
execute if score $dungeon do2.utility.onServer matches 1 unless score $dungeon do2.run.active matches 1.. as @p[tag=do2.received_shulker] run function do2:dungeon_setup/preset_difficulty
execute if score $dungeon do2.utility.onInstance matches 1 unless score $dungeon do2.run.active matches 1.. as @p[tag=do2.received_shulker] run function do2:dungeon_setup/preset_difficulty

# Give playsound tag according to player Voice Chat status
schedule function do2:voice_chat/set 5t append
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ execute if score $dungeon do2.config.forceGamemode matches 1 unless entity @s[ga
execute if score $dungeon do2.config.forceGamemode matches 1 unless entity @s[gamemode=creative] if entity @s[tag=do2.staff] if score @s do2.utility.oldGamemode matches 2 run tellraw @s ["",{"text":"§f[§9B§r]: You have the tag [§bdo2.staff§r], and this has stopped:\n - §5gamemode creative "},{"selector":"@s","color":"dark_purple"},{"text":"\n§f[§9B§r]: Click "},{"text":"§b[here]","clickEvent":{"action":"run_command","value":"/gamemode creative @s"}},{"text":" to run the command anyway."}]
execute if score $dungeon do2.config.forceGamemode matches 1 unless entity @s[gamemode=spectator] if entity @s[tag=do2.staff] if score @s do2.utility.oldGamemode matches 3 run tellraw @s ["",{"text":"§f[§9B§r]: You have the tag [§bdo2.staff§r], and this has stopped:\n - §5gamemode spectator "},{"selector":"@s","color":"dark_purple"},{"text":"\n§f[§9B§r]: Click "},{"text":"§b[here]","clickEvent":{"action":"run_command","value":"/gamemode spectator @s"}},{"text":" to run the command anyway."}]

# If player is spectator AND we're on a server. Leave them on spectator mode.
execute if entity @s[team=do2.spectators] if score $dungeon do2.utility.onServer matches 1 unless entity @s[tag=do2.staff] run gamemode spectator @s
# If player is spectator AND we're on an instance. Leave them on spectator mode.
execute if entity @s[team=do2.spectators] if score $dungeon do2.utility.onInstance matches 1 unless entity @s[tag=do2.staff] run gamemode spectator @s

# Reset Team & Tags
team leave @s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ scoreboard objectives add do2.utility.receivedJackpot dummy "Used to count the k
scoreboard objectives add do2.utility.playersExperience dummy "Used to count how much experience players have."
scoreboard objectives add do2.utility.onServer dummy "Checking if this Brilliance is loaded on the server"
execute unless score $dungeon do2.utility.onServer matches 0.. run scoreboard players set $dungeon do2.utility.onServer 0
scoreboard objectives add do2.utility.onInstance dummy "Checking if this Brilliance is loaded on an instance"
execute unless score $dungeon do2.utility.onInstance matches 0.. run scoreboard players set $dungeon do2.utility.onInstance 0


# - Mob Controller - (mob_controller)
scoreboard objectives add do2.utility.mc.mobCountCounterTest dummy "Used to count the how many mobs are in a barrel"
Expand Down
4 changes: 2 additions & 2 deletions Brilliance Datapack/data/do2/functions/version.mcfunction
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# DATAPACK VERSION NUMBER: 0.13.16
# DATAPACK VERSION NUMBER: 0.13.17

tellraw @s ["",{"text":"The §o§n§aBrilliance Datapack§r's version is: [§b0.13.16§r] Check latest version "},{"text":"§o§b§nhere§r","clickEvent":{"action":"open_url","value":"https://github.com/trackedout/Brilliance/blob/main/Brilliance%20Datapack/data/do2/functions/version.mcfunction"}},{"text":"."}]
tellraw @s ["",{"text":"The §o§n§aBrilliance Datapack§r's version is: [§b0.13.17§r] Check latest version "},{"text":"§o§b§nhere§r","clickEvent":{"action":"open_url","value":"https://github.com/trackedout/Brilliance/blob/main/Brilliance%20Datapack/data/do2/functions/version.mcfunction"}},{"text":"."}]
6 changes: 6 additions & 0 deletions JSON/scoreboards.json
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,12 @@
"category": "utility",
"description": "Whether Brilliance can detect Agronet."
},
"do2.utility.onInstance": {
"auto": 1,
"target": "$dungeon",
"category": "utility",
"description": "Whether Brilliance can detect 'is-dungeon-instance'."
},
"do2.utility.embersToGive": {
"auto": 1,
"target": "runners",
Expand Down
1 change: 1 addition & 0 deletions docs/scoreboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,7 @@ The name immediately after the `do2.` will generally be describing it's category
|| 🟢 | do2.utility.old_position.y | utility | Used to store player's old Y location before teleporting them. |
|| 🟢 | do2.utility.old_position.z | utility | Used to store player's old Z location before teleporting them. |
|| 🔴 | do2.utility.onServer | utility | Whether Brilliance can detect Agronet. |
|| 🔴 | do2.utility.onInstance | utility | Whether Brilliance can detect 'is-dungeon-instance'. |
|| 🔴 | do2.utility.playerCount | utility | Used to count how many players are on the server at a time. |
|| 🔴 | do2.utility.playersExperience | utility | Used to check player's exp in order to give them 1 level if they dont have one. |
|| 🟢 | do2.utility.playersFood | utility | Player's food level |
Expand Down

0 comments on commit 0f45de2

Please sign in to comment.