From 1c477c4816bdd75bb1750a24332cabb0fdaa232e Mon Sep 17 00:00:00 2001 From: HeroChris Date: Wed, 4 Dec 2024 13:52:42 +0100 Subject: [PATCH] Warp functionality --- data/herohost/function/core/initialize.mcfunction | 9 +++++++-- data/herohost/function/core/reconnect.mcfunction | 9 +++++++-- data/herohost/function/init.mcfunction | 7 ++++--- data/herohost/function/main.mcfunction | 6 ++++-- data/herohost/function/misc/warp.mcfunction | 12 ++++++++++++ 5 files changed, 34 insertions(+), 9 deletions(-) create mode 100644 data/herohost/function/misc/warp.mcfunction diff --git a/data/herohost/function/core/initialize.mcfunction b/data/herohost/function/core/initialize.mcfunction index cfb5a5a..4873427 100644 --- a/data/herohost/function/core/initialize.mcfunction +++ b/data/herohost/function/core/initialize.mcfunction @@ -2,9 +2,14 @@ tellraw @s [{"text":"» ","color":"gray"},{"translate":"hhost.minigame.welcome","fallback":"Welcome %s to the %s server!","with":[{"selector":"@s","color":"yellow"},{"text":"H","color":"#fa6a52","extra":[{"text":"e","color":"#fc7551"},{"text":"r","color":"#fd8051"},{"text":"o","color":"#fe8a52"},{"text":"H","color":"#ff9454"},{"text":"o","color":"#ff9e56"},{"text":"s","color":"#ffa85a"},{"text":"t","color":"#ffb15e"}]}],"color":"white"}] tellraw @a[tag=hc.initialized] [{"text":"» ","color":"gray"},{"translate":"hhost.minigame.wish_welcome","fallback":"Everyone, give %s a warm welcome!","with":[{"selector":"@s","color":"yellow"}],"color":"white"}] -execute at @s run playsound minecraft:block.amethyst_block.step master @s ~ ~ ~ 0.7 0.7 +execute at @s run playsound minecraft:block.amethyst_block.step record @s ~ ~ ~ 0.7 0.7 -# tp player +# reset player + clear @s[tag=!hc.debug] + execute in herohost:world run tp @s[tag=!hc.debug] 5 109 50 -90 0 + +# misc + scoreboard players enable @s +hc.warp # initialize player tag @s add hc.initialized \ No newline at end of file diff --git a/data/herohost/function/core/reconnect.mcfunction b/data/herohost/function/core/reconnect.mcfunction index 8a66a23..eea1cb2 100644 --- a/data/herohost/function/core/reconnect.mcfunction +++ b/data/herohost/function/core/reconnect.mcfunction @@ -2,9 +2,14 @@ tellraw @s [{"text":"» ","color":"gray"},{"translate":"hhost.minigame.welcome_back","fallback":"Welcome back %s to the %s server!","with":[{"selector":"@s","color":"yellow"},{"text":"H","color":"#fa6a52","extra":[{"text":"e","color":"#fc7551"},{"text":"r","color":"#fd8051"},{"text":"o","color":"#fe8a52"},{"text":"H","color":"#ff9454"},{"text":"o","color":"#ff9e56"},{"text":"s","color":"#ffa85a"},{"text":"t","color":"#ffb15e"}]}],"color":"white"}] tellraw @s[tag=hc.debug] [{"text":"» ","color":"red"},{"translate":"hhost.minigame.debug_warning","fallback":"You are still in debug mode, click %s to disable it.","with":[{"translate":"hhost.minigame.here","fallback":"here","color":"red","clickEvent":{"action":"run_command","value":"/tag @s remove hc.debug"},"hoverEvent":{"action":"show_text","contents":[{"translate":"hhost.minigame.operator_warning","fallback":"You need to be an operator to use this.","color":"red"}]}}],"color":"white"}] -execute at @s run playsound minecraft:block.amethyst_block.step master @s ~ ~ ~ 0.7 0.7 +execute at @s run playsound minecraft:block.amethyst_block.step record @s ~ ~ ~ 0.7 0.7 -# tp player +# reset player + clear @s[tag=!hc.debug] + execute in herohost:world run tp @s[tag=!hc.debug] 5 109 50 -90 0 + +# misc + scoreboard players enable @s +hc.warp # reset player score scoreboard players reset @s +hc.disconnect \ No newline at end of file diff --git a/data/herohost/function/init.mcfunction b/data/herohost/function/init.mcfunction index c392439..10a7651 100644 --- a/data/herohost/function/init.mcfunction +++ b/data/herohost/function/init.mcfunction @@ -7,8 +7,9 @@ tellraw @a[tag=hc.debug] [{"text":"» ","color":"gray"},{"translate":"hhost.mini scoreboard objectives add +hc.core dummy scoreboard objectives add +hc.disconnect minecraft.custom:minecraft.leave_game scoreboard objectives add +hc.locked dummy - # scoreboard objectives add +hc.currency dummy - # scoreboard objectives add +hc.currency.add dummy - # scoreboard objectives add +hc.currency.remove dummy + scoreboard objectives add +hc.warp trigger + # [ WIP ] scoreboard objectives add +hc.currency dummy + # [ WIP ] scoreboard objectives add +hc.currency.add dummy + # [ WIP ] scoreboard objectives add +hc.currency.remove dummy # remove depricated scoreboard objectives diff --git a/data/herohost/function/main.mcfunction b/data/herohost/function/main.mcfunction index 02d013c..4057975 100644 --- a/data/herohost/function/main.mcfunction +++ b/data/herohost/function/main.mcfunction @@ -5,11 +5,13 @@ execute as @a[scores={+hc.disconnect=1..}] run function herohost:core/reconnect # protection - #kill @e[type=item,tag=!persistent] + kill @e[type=item,tag=!persistent] gamemode adventure @a[tag=!hc.debug] # hc.debug +# misc + execute as @a[scores={+hc.warp=1..}] run function herohost:misc/warp # games - # execute in herohost:world if entity @p[x=-125,y=50,z=-376,dx=250,dy=100,dz=250] run function herohost:tnt/core \ No newline at end of file + # [ WIP ] execute in herohost:world if entity @p[x=-125,y=50,z=-376,dx=250,dy=100,dz=250] run function herohost:tnt/core \ No newline at end of file diff --git a/data/herohost/function/misc/warp.mcfunction b/data/herohost/function/misc/warp.mcfunction new file mode 100644 index 0000000..799ab24 --- /dev/null +++ b/data/herohost/function/misc/warp.mcfunction @@ -0,0 +1,12 @@ +# --- HeroGames - Copyright (c) HeroHost team (code provided by HeroChris). --- + +execute if score @s +hc.warp matches 1 in herohost:world run tp @s 5 109 50 -90 0 +execute if score @s +hc.warp matches 2 in herohost:world run tp @s 50 125 -15 -118 0 + +# effects + execute at @s run playsound minecraft:block.amethyst_block.step record @s ~ ~ ~ 0.7 0.7 + # [ WIP ] execute as @s at @s run particle minecraft:reverse_portal ~ ~1 ~ 0.5 0.5 0.5 0.1 20 + +# reset + scoreboard players set @s +hc.warp 0 + scoreboard players enable @s +hc.warp \ No newline at end of file