Files
dragzone_scoreboard.sk
summoning_eye.sk
Code
2 441
summoning_eye.sk
import:
org.bukkit.Bukkit
org.bukkit.boss.BarColor
org.bukkit.boss.BarStyle
options:
eye-name: &5Summoning Eye
on right click on end portal frame:
if name of player's tool is "{@eye-name}":
cancel event
set {_data} to event-block.getBlockData()
if {_data}.hasEye() is true:
stop
set {_world} to world of event-block
set {_frames::1} to location at -669, 9, -277 in {_world}
set {_frames::2} to location at -670, 9, -278 in {_world}
set {_frames::3} to location at -672, 9, -278 in {_world}
set {_frames::4} to location at -673, 9, -277 in {_world}
set {_frames::5} to location at -673, 9, -275 in {_world}
set {_frames::6} to location at -672, 9, -274 in {_world}
set {_frames::7} to location at -670, 9, -274 in {_world}
set {_frames::8} to location at -669, 9, -275 in {_world}
set {_isSummoningFrame} to false
set {_eyes} to 0
loop {_frames::*}:
set {_frame} to block at loop-value
if {_frame} is event-block:
set {_isSummoningFrame} to true
if {_frame} is an end portal frame:
set {_frameData} to {_frame}.getBlockData()
if {_frameData}.hasEye() is true:
add 1 to {_eyes}
if {_isSummoningFrame} is true:
if {summoning-dragon::%{_world}%} is set:
send "&cA dragon is active or the altar is cooling down." to player
stop
{_data}.setEye(true)
event-block.setBlockData({_data})
remove 1 of player's tool from player's inventory
play sound "block.end_portal_frame.fill" at location of event-block
if {_isSummoningFrame} is false:
stop
add 1 to {_eyes}
if {_eyes} is 8:
broadcast "&7%player% &dplaced a Summoning Eye! &7(&a8/8&7)"
if {summoning-dragon::%{_world}%} is not set:
spawnSummoningDragon({_world})
else:
send "&cA summoning dragon is already active in this world." to player
else:
broadcast "&7%player% &dplaced a Summoning Eye! &7(&e%{_eyes}%&7/&a8&7)"
command /testdrag:
permission: summoningdragon.test
executable by: players
trigger:
set {_world} to world of player
if {summoning-dragon::%{_world}%} is set:
send "&cA summoning dragon is already active in this world." to player
stop
spawnSummoningDragon({_world})
command /savedrop <text> <number> <text> [<text>]:
permission: summoningdragon.savedrop
executable by: players
trigger:
set {_type} to argument 1
set {_type} to lowercase {_type}
if {_type} is not "superior", "strong", "young", "unstable", "wise", "old" or "protector":
send "&cDragon type must be superior, strong, young, unstable, wise, old, or protector."
stop
if argument 2 < 0.000001 or argument 2 > 100:
send "&cChance must be between 0.000001 and 100 percent."
stop
if player's tool is air:
send "&cHold the item you want to save."
stop
set {_broadcast} to false
if argument 4 is set:
set {_option} to argument 4
if {_option}.equalsIgnoreCase("on") is true:
set {_broadcast} to true
else:
if {_option}.equalsIgnoreCase("off") is false:
send "&cThe broadcast option must be on or off."
stop
add 1 to {summoning-drop-next-id}
set {_id} to {summoning-drop-next-id}
set {summoning-drops::%{_type}%::%{_id}%::item} to player's tool
set {summoning-drops::%{_type}%::%{_id}%::chance} to argument 2
set {_message} to argument 3
set {summoning-drops::%{_type}%::%{_id}%::message} to colored {_message}
set {summoning-drops::%{_type}%::%{_id}%::broadcast} to {_broadcast}
send "&aSaved drop #%{_id}% for %{_type}% dragons at %argument 2%%% chance."
command /removedrop <text>:
permission: summoningdragon.savedrop
executable by: players
trigger:
set {_type} to lowercase arg-1
if {_type} is not "superior", "strong", "young", "unstable", "wise", "old" or "protector":
send "&cDragon type must be superior, strong, young, unstable, wise, old, or protector."
stop
if player's tool is air:
send "&cHold the item you want to remove."
stop
set {_count} to 0
loop indices of {summoning-drops::%{_type}%::*}:
set {_key} to "%loop-value%"
if {_key}.endsWith("::item") is true:
set {_parts::*} to {_key} split at "::"
set {_id} to {_parts::1}
set {_item} to {summoning-drops::%{_type}%::%{_id}%::item}
if {_item}.isSimilar(player's tool) is true:
delete {summoning-drops::%{_type}%::%{_id}%::*}
add 1 to {_count}
send "&aRemoved %{_count}% matching drop(s) for %{_type}% dragons."
command /listdrops <text>:
permission: summoningdragon.savedrop
executable by: players
trigger:
set {_type} to lowercase arg-1
if {_type} is not "superior", "strong", "young", "unstable", "wise", "old" or "protector":
send "&cDragon type must be superior, strong, young, unstable, wise, old, or protector."
stop
send "&6Drops for %{_type}% dragons:"
set {_count} to 0
loop indices of {summoning-drops::%{_type}%::*}:
set {_key} to "%loop-value%"
if {_key}.endsWith("::item") is true:
set {_parts::*} to {_key} split at "::"
set {_id} to {_parts::1}
set {_item} to {summoning-drops::%{_type}%::%{_id}%::item}
add 1 to {_count}
set {_label} to name of {_item}
if {_label} is not set:
set {_label} to "%type of {_item}%"
set {_chance} to {summoning-drops::%{_type}%::%{_id}%::chance}
send "&7#%{_id}% &r%{_label}% &7- &e%{_chance}%%%"
if {_count} is 0:
send "&7No drops saved."
function spawnSummoningDragon(world: world):
set {summoning-dragon::%{_world}%} to true
loop all players in {_world}:
play sound "entity.ender_dragon.growl" with volume 10 and pitch 1 to loop-player
spawn an ender dragon at location at -671, 48, -276 in {_world}
set {_dragon} to last spawned entity
set {summoning-dragon-uuid::%{_world}%} to uuid of {_dragon}
set {_type} to random element out of "Superior", "Strong", "Young", "Unstable", "Wise", "Old" and "Protector"
set {summoning-dragon-type::%uuid of {_dragon}%} to {_type}
set {_maxHealth} to 18000000
set {_speed} to 1
if {_type} is "Superior":
set {_maxHealth} to 24000000
set {_speed} to 1.1
else if {_type} is "Young":
set {_maxHealth} to 10000000
set {_speed} to 1.2
else if {_type} is "Old":
set {_maxHealth} to 30000000
{_dragon}.setMaxHealth({_maxHealth})
{_dragon}.setHealth({_dragon}.getMaxHealth())
set name of {_dragon} to "&c%{_type}% Dragon"
set {_nativeBar} to {_dragon}.getBossBar()
if {_nativeBar} is set:
{_nativeBar}.setVisible(false)
set {_bar} to Bukkit.createBossBar("&c%{_type}% Dragon", BarColor.PURPLE, BarStyle.SOLID)
set {summoning-dragon-bar::%{_world}%} to {_bar}
broadcast "&d&lThe &c&l%{_type}% Dragon &d&lHas Spawned!"
set {_tick} to 0
set {_nextBarUpdate} to 1
set {_angle} to 0
set {_lightningUsed} to false
while {_dragon} is alive:
add 1 to {_tick}
{_bar}.setProgress({_dragon}.getHealth() / {_dragon}.getMaxHealth())
if {_tick} >= {_nextBarUpdate}:
add 20 to {_nextBarUpdate}
{_bar}.removeAll()
loop all players in {_world}:
{_bar}.addPlayer(loop-player)
add (1.7 + 0.3 * cos({_tick} * 0.35)) * {_speed} to {_angle}
set {_radius} to 20 + 4 * sin({_tick} * 0.22)
if {_tick} < 60:
set {_radius} to {_radius} * {_tick} / 60
set {_x} to -671 + {_radius} * cos({_angle})
set {_z} to -276 + {_radius} * sin({_angle})
# Combined slow waves give the flight varied, gradual swoops.
set {_y} to 48 - 11 * (1 - cos({_tick} * 0.36)) / 2 + 2 * sin({_tick} * 0.13)
set {_target} to location at {_x}, {_y}, {_z} in {_world}
set yaw of {_target} to {_angle} + 180
teleport {_dragon} to {_target}
if {_type} is "Superior":
if {_lightningUsed} is false:
if {_dragon}.getHealth() <= {_dragon}.getMaxHealth() / 2:
set {_lightningUsed} to true
