Files
plugins
Code
1 297
plugins/Skript/scripts/bounty.sk
# =======================================================
# Infinite Custom Bounty System
# Paper 1.21.11 / Skript
# Place this file in plugins/Skript/scripts/
# Reload with: /sk reload bounty
# =======================================================
options:
prefix: &f[&7ʙᴏᴜɴᴛʏ&f] &r
msg_prefix: &f[&7ʙᴏᴜɴᴛʏ&f] &f
gui_name: &f[&7ʙᴏᴜɴᴛʏ&f] &7ʟɪsᴛ
# -------------------------------------------------------
# Rebuild persistent bossbars after a script reload
# -------------------------------------------------------
on script load:
loop {bounty::*}:
set {_tuuid} to loop-index
set {_target_name} to {bounty_name::%{_tuuid}%}
execute console command "bossbar remove bounty_%{_tuuid}%"
execute console command "bossbar add bounty_%{_tuuid}% {""text"":""⚔ %{_target_name}%"",""color"":""white"",""bold"":false}"
execute console command "bossbar set bounty_%{_tuuid}% color white"
execute console command "bossbar set bounty_%{_tuuid}% style progress"
execute console command "bossbar set bounty_%{_tuuid}% max 100"
execute console command "bossbar set bounty_%{_tuuid}% value 100"
execute console command "bossbar set bounty_%{_tuuid}% players @a"
# -------------------------------------------------------
# Bounty commands
# -------------------------------------------------------
command /bounty [<text>] [<offline player>] [<text>] [<integer>]:
permission: bounty.admin
permission message: {@msg_prefix}&cᴘᴇʀᴍɪssɪᴏɴ ᴅᴇɴɪᴇᴅ.
trigger:
if arg-1 is not set:
send "{@msg_prefix}&f/bounty set <user> <reward> <amount>" to sender
send "{@msg_prefix}&f/bounty remove <user>" to sender
send "{@msg_prefix}&f/bounty list" to sender
stop
if arg-1 is "list":
if sender is console:
send "{@msg_prefix}&cᴏɴʟʏ ᴘʟᴀʏᴇʀs ᴄᴀɴ ᴏᴘᴇɴ ᴛʜᴇ ʙᴏᴜɴᴛʏ ʟɪsᴛ." to sender
stop
set {_gui} to chest inventory with 6 rows named "{@gui_name}"
set {_slot} to 0
loop {bounty::*}:
if {_slot} is less than 54:
set {_tuuid} to loop-index
set {_pname} to {bounty_name::%{_tuuid}%}
set {_item_name} to {bounty_item_name::%{_tuuid}%}
set {_amt} to {bounty_amount::%{_tuuid}%}
set {_offline_target} to {_pname} parsed as offline player
set {_head} to skull of {_offline_target}
set name of {_head} to "&f%{_pname}%"
set lore of {_head} to "&fʀᴇᴡᴀʀᴅ: &7%{_amt}%x %{_item_name}%" and "" and "&7ʟᴇꜰᴛ-ᴄʟɪᴄᴋ ᴛᴏ ᴛᴇʟᴇᴘᴏʀᴛ" and "&7ʀɪɢʜᴛ-ᴄʟɪᴄᴋ ᴛᴏ ᴠɪᴇᴡ ʀᴇᴡᴀʀᴅ"
set slot {_slot} of {_gui} to {_head}
add 1 to {_slot}
if {_slot} is 0:
set slot 22 of {_gui} to paper named "&fɴᴏ ᴀᴄᴛɪᴠᴇ ʙᴏᴜɴᴛɪᴇs" with lore "&7ᴛʜᴇʀᴇ ᴀʀᴇ ɴᴏ ᴀᴄᴛɪᴠᴇ ʙᴏᴜɴᴛɪᴇs."
open {_gui} to player
stop
if arg-1 is "set":
if arg-2 is not set:
send "{@msg_prefix}&cᴜsᴀɢᴇ: &f/bounty set <user> <reward> <amount>" to sender
stop
if arg-3 is not set:
send "{@msg_prefix}&cᴘʟᴇᴀsᴇ sᴘᴇᴄɪꜰʏ ᴀ ʀᴇᴡᴀʀᴅ ɪᴛᴇᴍ. ᴜsᴇ &f_ &cꜰᴏʀ sᴘᴀᴄᴇs." to sender
stop
if arg-4 is not set:
send "{@msg_prefix}&cᴘʟᴇᴀsᴇ sᴘᴇᴄɪꜰʏ ᴀɴ ɪᴛᴇᴍ ᴀᴍᴏᴜɴᴛ." to sender
stop
set {_target_name} to name of arg-2
set {_tuuid} to uuid of arg-2
if {bounty::%{_tuuid}%} is set:
send "{@msg_prefix}&cᴛʜᴇʀᴇ ɪs ᴀʟʀᴇᴀᴅʏ ᴀɴ ᴀᴄᴛɪᴠᴇ ʙᴏᴜɴᴛʏ ᴏɴ &f%{_target_name}%&c." to sender
stop
set {_item_name} to arg-3
replace all "_" with " " in {_item_name}
set {_item} to {_item_name} parsed as item type
if {_item} is not set:
send "{@msg_prefix}&cɪɴᴠᴀʟɪᴅ ɪᴛᴇᴍ ᴛʏᴘᴇ: &f%{_item_name}%" to sender
stop
if {_item} is air:
send "{@msg_prefix}&cᴀɪʀ ᴄᴀɴɴᴏᴛ ʙᴇ ᴜsᴇᴅ ᴀs ᴀ ʀᴇᴡᴀʀᴅ." to sender
stop
set {_amt} to arg-4
if {_amt} <= 0:
send "{@msg_prefix}&cᴛʜᴇ ᴀᴍᴏᴜɴᴛ ᴍᴜsᴛ ʙᴇ ɢʀᴇᴀᴛᴇʀ ᴛʜᴀɴ 0." to sender
stop
set {bounty::%{_tuuid}%} to true
set {bounty_name::%{_tuuid}%} to {_target_name}
set {bounty_item::%{_tuuid}%} to {_item}
set {bounty_item_name::%{_tuuid}%} to {_item_name}
set {bounty_amount::%{_tuuid}%} to {_amt}
execute console command "bossbar remove bounty_%{_tuuid}%"
execute console command "bossbar add bounty_%{_tuuid}% {""text"":""⚔ %{_target_name}%"",""color"":""white"",""bold"":false}"
execute console command "bossbar set bounty_%{_tuuid}% color white"
execute console command "bossbar set bounty_%{_tuuid}% style progress"
execute console command "bossbar set bounty_%{_tuuid}% max 100"
execute console command "bossbar set bounty_%{_tuuid}% value 100"
execute console command "bossbar set bounty_%{_tuuid}% players @a"
set {_target} to {_target_name} parsed as player
if {_target} is online:
apply glowing 1 to {_target} for 999 days
broadcast "{@msg_prefix}%{_target_name}% ʜᴀs ʀᴇᴄᴇɪᴠᴇᴅ ᴀ ʙᴏᴜɴᴛʏ."
broadcast "{@msg_prefix}&7ʀᴇᴡᴀʀᴅ: &f%{_amt}%x %{_item_name}%"
stop
if arg-1 is "remove":
if arg-2 is not set:
send "{@msg_prefix}&cᴜsᴀɢᴇ: &f/bounty remove <user>" to sender
stop
set {_target_name} to name of arg-2
set {_tuuid} to uuid of arg-2
if {bounty::%{_tuuid}%} is not set:
send "{@msg_prefix}&cᴛʜᴇʀᴇ ɪs ɴᴏ ᴀᴄᴛɪᴠᴇ ʙᴏᴜɴᴛʏ ᴏɴ &f%{_target_name}%&c." to sender
stop
delete {bounty::%{_tuuid}%}
delete {bounty_name::%{_tuuid}%}
delete {bounty_item::%{_tuuid}%}
delete {bounty_item_name::%{_tuuid}%}
delete {bounty_amount::%{_tuuid}%}
execute console command "bossbar remove bounty_%{_tuuid}%"
set {_target} to {_target_name} parsed as player
if {_target} is online:
remove glowing from {_target}
broadcast "{@msg_prefix}%{_target_name}% ʜᴀs ʜᴀᴅ ᴛʜᴇɪʀ ʙᴏᴜɴᴛʏ ʀᴇᴍᴏᴠᴇᴅ."
stop
send "{@msg_prefix}&f/bounty set <user> <reward> <amount>" to sender
send "{@msg_prefix}&f/bounty remove <user>" to sender
send "{@msg_prefix}&f/bounty list" to sender
# -------------------------------------------------------
# Re-apply target visibility and broadcast coordinates
# -------------------------------------------------------
every 1 second:
loop {bounty::*}:
set {_tuuid} to loop-index
set {_target_name} to {bounty_name::%{_tuuid}%}
set {_target} to {_target_name} parsed as player
if {_target} is online:
if {_target} does not have glowing:
apply glowing 1 to {_target} for 999 days
every 8 seconds:
loop {bounty::*}:
set {_tuuid} to loop-index
set {_target_name} to {bounty_name::%{_tuuid}%}
set {_target} to {_target_name} parsed as player
if {_target} is online:
if {_target} does not have glowing:
apply glowing 1 to {_target} for 999 days
set {_x} to x-coordinate of {_target}
set {_y} to y-coordinate of {_target}
set {_z} to z-coordinate of {_target}
broadcast "{@msg_prefix}%{_target_name}% ɪs ᴀᴛ %{_x}% %{_y}% %{_z}%"
# -------------------------------------------------------
# Totem protection
# -------------------------------------------------------
on resurrect:
if event-entity is a player:
set {_tuuid} to uuid of event-entity
if {bounty::%{_tuuid}%} is set:
apply glowing 1 to event-entity for 999 days
# -------------------------------------------------------
# Keep active bossbars visible after players join