Files
plugin.sk
Code
1 155
plugin.sk
# Kodari Ritual Carrot
# Skript 2.16.2
# PaperMC 1.21.11
# Requires SkBee 3.25.4
options:
item-name: &5Ritual Carrot &8[5x5]
item-marker: &0kodari_ritual_item
ritual-permission: ritual.giveitem
command /giveitem <player> <text>:
permission: {@ritual-permission}
permission message: "&cYou do not have permission to use this command."
trigger:
if arg-2 is not "carrot_on_a_stick":
send "&cUsage: /giveitem <player> carrot_on_a_stick" to sender
stop
set {_item} to carrot on a stick
set name of {_item} to "{@item-name}"
set lore of {_item} to "&7Shift-right-click a block to awaken the ritual." and "{@item-marker}"
give {_item} to arg-1
send "&aGave the Ritual Carrot to &e%arg-1%&a." to sender
on tab complete:
if event-string is "/giveitem":
set tab completions to "carrot_on_a_stick"
on rightclick:
if clicked block is air:
stop
if player is not sneaking:
stop
if player's tool is not carrot on a stick:
stop
if lore of player's tool does not contain "{@item-marker}":
stop
cancel event
if {ritual.active} is set:
send "&cA ritual is already active." to player
stop
set {ritual.active} to true
delete {ritual.locations::*}
delete {ritual.old::*}
delete {ritual.block::*}
delete {ritual.material::*}
set {_center} to location of event-block
set {_cx} to x-coordinate of {_center}
set {_cy} to y-coordinate of {_center}
set {_cz} to z-coordinate of {_center}
send "&5The ritual is rising from beneath the earth..." to player
execute console command "playsound minecraft:ambient.soul_sand_valley.additions master @a %{_cx}% %{_cy}% %{_cz}% 1.0 1.0"
set {_index} to 0
set {_dx} to -3
loop 5 times:
add 1 to {_dx}
set {_dz} to -3
loop 5 times:
add 1 to {_dz}
add 1 to {_index}
set {_loc} to {_center}
add {_dx} to x-coordinate of {_loc}
add {_dz} to z-coordinate of {_loc}
set {ritual.locations::%{_index}%} to {_loc}
set {ritual.old::%{_index}%} to type of block at {_loc}
set {_material} to "soul_sand"
set {_block} to soul sand
if {_dx} is -2:
set {_material} to "crying_obsidian"
set {_block} to crying obsidian
if {_dx} is 2:
set {_material} to "crying_obsidian"
set {_block} to crying obsidian
if {_dz} is -2:
set {_material} to "crying_obsidian"
set {_block} to crying obsidian
if {_dz} is 2:
set {_material} to "crying_obsidian"
set {_block} to crying obsidian
if {_dx} is 0:
if {_dz} is 0:
set {_material} to "respawn_anchor"
set {_block} to respawn anchor
set {ritual.material::%{_index}%} to {_material}
set {ritual.block::%{_index}%} to {_block}
set {_display-loc} to {_loc}
subtract 5 from y-coordinate of {_display-loc}
set {_display-x} to x-coordinate of {_display-loc}
set {_display-y} to y-coordinate of {_display-loc}
set {_display-z} to z-coordinate of {_display-loc}
execute console command "summon minecraft:block_display %{_display-x}% %{_display-y}% %{_display-z}% {block_state:{Name:minecraft:%{_material}%},Tags:[kodari_ritual]}"
execute console command "playsound minecraft:ambient.warped_forest.mood master @a %{_cx}% %{_cy}% %{_cz}% 1.0 1.0"
loop 5 times:
wait 4 ticks
execute console command "execute as @e[type=minecraft:block_display,tag=kodari_ritual] at @s run tp @s ~ ~1 ~"
execute console command "kill @e[type=minecraft:block_display,tag=kodari_ritual]"
loop {ritual.locations::*}:
set block at loop-value to {ritual.block::%loop-index%}
send "&dThe ritual has risen." to player
wait 10 seconds
execute console command "playsound minecraft:ambient.crimson_forest.mood block @a %{_cx}% %{_cy}% %{_cz}% 1.0 1.0"
loop {ritual.locations::*}:
set block at loop-value to air
set {_display-loc} to loop-value
set {_display-x} to x-coordinate of {_display-loc}
set {_display-y} to y-coordinate of {_display-loc}
set {_display-z} to z-coordinate of {_display-loc}
execute console command "summon minecraft:block_display %{_display-x}% %{_display-y}% %{_display-z}% {block_state:{Name:minecraft:%{ritual.material::%loop-index%}%},Tags:[kodari_ritual]}"
loop 5 times:
wait 4 ticks
execute console command "execute as @e[type=minecraft:block_display,tag=kodari_ritual] at @s run tp @s ~ ~-1 ~"
execute console command "kill @e[type=minecraft:block_display,tag=kodari_ritual]"
loop {ritual.locations::*}:
set block at loop-value to {ritual.old::%loop-index%}
delete {ritual.locations::*}
delete {ritual.old::*}
delete {ritual.block::*}
delete {ritual.material::*}
delete {ritual.active}
if player is online:
send "&7The ritual has returned underground, and the original blocks were restored." to player