Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function removePrefix(str1: string, str2: string) :: string:
- first length of {_str2} characters of {_str1} is {_str2}
- return last length of {_str1} - length of {_str2} characters of {_str1}
- function getLivingEntityFromUUID(uuid: string) :: living entity:
- loop all entities:
- UUID of loop-entity is {_uuid}
- return loop-entity
- stop loop
- function getTagValues(e: entity) :: strings:
- set {_tagnbt} to "%tag ""Tags"" of nbt of {_e}%"
- replace "[""" and """]" in {_tagnbt} with ""
- return split {_tagnbt} by ""","""
- command /customdrop [<text>] [<text>] [<text>]:
- permission: skript.admin
- permission message: &cYou do not permission to use this command.
- trigger:
- if arg-1 is not set:
- send "&cUsage: /customdrop <add|remove|give> <dropname> OR /customdrop drops"
- else if arg-1 is not "add" or "remove" or "give" or "drops":
- send "&cUsage: /customdrop <add|remove|give> <dropname> OR /customdrop drops"
- else if arg-1 is "add" or "remove" or "give":
- if arg-2 is not set:
- send "&cUsage: /customdrop %arg-1% <dropname>"
- else if arg-3 is set:
- send "&cドロップアイテム名に空白は使用できません"
- else if arg-1 is set:
- if arg-1 is "add":
- if {customdrops::%arg-2%} is set:
- send "&cドロップアイテム%arg-2%は既に存在しています"
- else if player's tool is air:
- send "&cメインハンドに追加したいアイテムを持ってください"
- else if player's tool is not air:
- set {customdrops::%arg-2%} to player's tool
- send "&e新しいドロップアイテム%arg-2%を追加しました"
- else if arg-1 is "remove":
- if {customdrops::%arg-2%} is not set:
- send "&cドロップアイテム%arg-2%は存在しません"
- else if {customdrops::%arg-2%} is set:
- delete {customdrops::%arg-2%}
- send "&eドロップアイテム%arg-2%を消去しました"
- else if arg-1 is "drops":
- if {customdrops::*} is not set:
- send "&c登録されているドロップアイテムはありません"
- else if {customdrops::*} is set:
- loop {customdrops::*}:
- set {_dropnames::%loop-index%} to loop-index
- send "%{_dropnames::*}%" to console
- set {_dropstext} to join {_dropnames::*} by "&f, &e"
- send "&7CustomDrops (%size of {customdrops::*}%): &e%{_dropstext}%"
- on death:
- victim is a living entity
- victim is not a player
- victim is not armor stand
- set {_tags::*} to getTagValues(victim)
- if {_tags::*} contain "CustomDropOnly":
- clear drops
- loop {_tags::*}:
- set {_dropoptions::*} to loop-value split by ";"
- loop {_dropoptions::*}:
- if removePrefix(loop-value-2, "Drop:") is set:
- set {_customdropname} to removePrefix(loop-value-2, "Drop:")
- if removePrefix(loop-value-2, "DropChance:") is set:
- set {_dropchance} to removePrefix(loop-value-2, "DropChance:") parsed as number
- if removePrefix(loop-value-2, "MinAmount:") is set:
- set {_minamount} to removePrefix(loop-value-2, "MinAmount:") parsed as integer
- if removePrefix(loop-value-2, "MaxAmount:") is set:
- set {_maxamount} to removePrefix(loop-value-2, "MaxAmount:") parsed as integer
- if removePrefix(loop-value-2, "RareDrop:") is set:
- set {_raredrop} to removePrefix(loop-value-2, "RareDrop:") parsed as boolean
- {_customdropname} is set
- {_dropchance} is set
- {_minamount} is set
- {_maxamount} is set
- {_raredrop} is set
- if {_raredrop} is true:
- attacker is a player
- chance of {_dropchance}%:
- loop random integer between {_minamount} and {_maxamount} times:
- if {customdrops::%{_customdropname}%} is set:
- add {customdrops::%{_customdropname}%} to drops
- else if {customdrops::%{_customdropname}%} is not set:
- set {_dropitem} to {_customdropname} parsed as item
- {_dropitem} is set
- add {_dropitem} to drops
- else if {_raredrop} is false:
- chance of {_dropchance}%:
- loop random integer between {_minamount} and {_maxamount} times:
- if {customdrops::%{_customdropname}%} is set:
- add {customdrops::%{_customdropname}%} to drops
- else if {customdrops::%{_customdropname}%} is not set:
- set {_dropitem} to {_customdropname} parsed as item
- {_dropitem} is set
- add {_dropitem} to drops
- delete {_dropoptions::*}
- delete {_customdropname}
- delete {_dropchance}
- delete {_minamount}
- delete {_maxamount}
- delete {_raredrop}
- delete {_dropitem}
- function deleteBossBar(bossbar: string):
- evaluate "remove all players from bar %{_bossbar}%"
- evaluate "delete %{_bossbar}%"
- every tick:
- loop {bossbar::*}:
- getLivingEntityFromUUID(loop-index) is not set
- deleteBossBar("{bossbar::%loop-index%}")
- loop all entities:
- loop-entity is a living entity
- loop-entity is not a player
- set {_tags::*} to getTagValues(loop-entity)
- loop {_tags::*}:
- set {_bossbaroptions::*} to loop-value-2 split by ";"
- loop {_bossbaroptions::*}:
- if removePrefix(loop-value-3, "BarColor:") is set:
- set {_barcolor} to removePrefix(loop-value-3, "BarColor:")
- if removePrefix(loop-value-3, "BarStyle:") is set:
- set {_barstyle} to removePrefix(loop-value-3, "BarStyle:")
- if removePrefix(loop-value-3, "BarRange:") is set:
- set {_barrange} to removePrefix(loop-value-3, "BarRange:") parsed as number
- {_barcolor} is set
- {_barstyle} is set
- {_barrange} is set
- if {bossbar::%UUID of loop-entity%} is not set:
- set {bossbar::%UUID of loop-entity%} to new bossbar
- set color of bar {bossbar::%UUID of loop-entity%} to PINK
- set style of bar {bossbar::%UUID of loop-entity%} to SOLID
- evaluate "set color of bar {bossbar::%UUID of loop-entity%} to %{_barcolor} in upper case%"
- evaluate "set style of bar {bossbar::%UUID of loop-entity%} to %{_barstyle} in upper case%"
- if name of loop-entity is set:
- set name of bar {bossbar::%UUID of loop-entity%} to name of loop-entity
- else:
- set name of bar {bossbar::%UUID of loop-entity%} to "%loop-entity%"
- set progress of bar {bossbar::%UUID of loop-entity%} to health of loop-entity/max health of loop-entity
- loop all players:
- if distance between loop-entity-1 and loop-player-1 <= {_barrange}:
- add loop-player-1 to bar {bossbar::%UUID of loop-entity-1%}
- else:
- remove loop-player-1 from bar {bossbar::%UUID of loop-entity-1%}
- delete {_tags::*}
- delete {_bossbaroptions::*}
- delete {_barcolor}
- delete {_barstyle}
- delete {_barrange}
Advertisement
Add Comment
Please, Sign In to add comment