akon1248

Untitled

Mar 8th, 2019
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.70 KB | None | 0 0
  1. function getTagValues(e: entity) :: strings:
  2. set {_tagnbt} to "%tag ""Tags"" of nbt of {_e}%"
  3. replace "[""" and """]" in {_tagnbt} with ""
  4. return split {_tagnbt} by ""","""
  5.  
  6. function getLivingEntityFromUUID(uuid: text) :: living entity:
  7. loop all entities:
  8. if UUID of loop-entity is "%{_uuid}%":
  9. return loop-entity
  10. stop loop
  11.  
  12. function deleteBossBar(bossbar: string):
  13. evaluate "remove all players from bar %{_bossbar}%"
  14. evaluate "delete %{_bossbar}%"
  15.  
  16. function removePrefix(str1: string, str2: string) :: string:
  17. first length of {_str2} characters of {_str1} is {_str2}
  18. return last length of {_str1} - length of {_str2} characters of {_str1}
  19.  
  20. every tick:
  21. loop {bossbar::*}:
  22. getLivingEntityFromUUID(loop-index) is not set
  23. deleteBossBar("{bossbar::%loop-index%}")
  24. loop all entities:
  25. loop-entity is a living entity
  26. loop-entity is not a player
  27. set {_tags::*} to getTagValues(loop-entity)
  28. loop {_tags::*}:
  29. set {_bossbaroptions::*} to loop-value-2 split by ";"
  30. loop {_bossbaroptions::*}:
  31. if removePrefix(loop-value-3, "BarColor:") is set:
  32. set {_barcolor} to removePrefix(loop-value-3, "BarColor:")
  33. if removePrefix(loop-value-3, "BarStyle:") is set:
  34. set {_barstyle} to removePrefix(loop-value-3, "BarStyle:")
  35. if removePrefix(loop-value-3, "BarRange:") is set:
  36. set {_barrange} to removePrefix(loop-value-3, "BarRange:") parsed as number
  37. {_barcolor} is set
  38. {_barstyle} is set
  39. {_barrange} is set
  40. if {bossbar::%UUID of loop-entity%} is not set:
  41. set {bossbar::%UUID of loop-entity%} to new bossbar
  42. set color of bar {bossbar::%UUID of loop-entity%} to PINK
  43. set style of bar {bossbar::%UUID of loop-entity%} to SOLID
  44. evaluate "set color of bar {bossbar::%UUID of loop-entity%} to %{_barcolor} in upper case%"
  45. evaluate "set style of bar {bossbar::%UUID of loop-entity%} to %{_barstyle} in upper case%"
  46. if name of loop-entity is set:
  47. set name of bar {bossbar::%UUID of loop-entity%} to name of loop-entity
  48. else:
  49. set name of bar {bossbar::%UUID of loop-entity%} to "%loop-entity%"
  50. set progress of bar {bossbar::%UUID of loop-entity%} to health of loop-entity/max health of loop-entity
  51. loop all players:
  52. if distance between loop-entity-1 and loop-player-1 <= {_barrange}:
  53. add loop-player-1 to bar {bossbar::%UUID of loop-entity-1%}
  54. if distance between loop-entity-1 and loop-player-1 > {_barrange}:
  55. remove loop-player-1 from bar {bossbar::%UUID of loop-entity-1%}
  56. delete {_bossbaroptions::*}
  57. delete {_barcolor}
  58. delete {_barstyle}
  59. delete {_barrange}
  60.  
  61. command /customdrop [<text>] [<text>] [<text>]:
  62. permission: acd.admin
  63. permission message: &cYou do not permission to use this command.
  64. trigger:
  65. if arg-1 is not set:
  66. send "&cUsage: /customdrop <add|remove|give> <dropname> OR /customdrop drops"
  67. else if arg-1 is not "add" or "remove" or "give" or "drops":
  68. send "&cUsage: /customdrop <add|remove|give> <dropname> OR /customdrop drops"
  69. else if arg-1 is "add" or "remove" or "give":
  70. if arg-2 is not set:
  71. send "&cUsage: /customdrop %arg-1% <dropname>"
  72. else if arg-3 is set:
  73. send "&cドロップアイテム名に空白は使用できません"
  74. else if arg-1 is set:
  75. if arg-1 is "add":
  76. if {customdrops::%arg-2%} is set:
  77. send "&cドロップアイテム%arg-2%は既に存在しています"
  78. else if player's tool is air:
  79. send "&cメインハンドに追加したいアイテムを持ってください"
  80. else if player's tool is not air:
  81. set {customdrops::%arg-2%} to player's tool
  82. send "&e新しいドロップアイテム%arg-2%を追加しました"
  83. else if arg-1 is "remove":
  84. if {customdrops::%arg-2%} is not set:
  85. send "&cドロップアイテム%arg-2%は存在しません"
  86. else if {customdrops::%arg-2%} is set:
  87. delete {customdrops::%arg-2%}
  88. send "&eドロップアイテム%arg-2%を消去しました"
  89. else if arg-1 is "give":
  90. if {customdrops::%arg-2%} is not set:
  91. send "&cドロップアイテム%arg-2%は存在しません"
  92. else if {customdrops::%arg-2%} is set:
  93. give player {customdrops::%arg-2%}
  94. else if arg-1 is "drops":
  95. if {customdrops::*} is not set:
  96. send "&c登録されているドロップアイテムはありません"
  97. else if {customdrops::*} is set:
  98. loop {customdrops::*}:
  99. set {_dropstext} to "&e%loop-index%"
  100. set {_loopnumber} to 0
  101. loop {customdrops::*}:
  102. add 1 to {_loopnumber}
  103. {_loopnumber} >= 2
  104. set {_dropstext} to "%{_dropstext}%&f, &e%loop-index%"
  105. send "&7CustomDrops (%size of {customdrops::*}%): %{_dropstext}%"
  106. on death:
  107. victim is a living entity
  108. victim is not a player
  109. victim is not armor stand
  110. set {_tags::*} to getTagValues(victim)
  111. if {_tags::*} contain "CustomDropOnly":
  112. clear drops
  113. loop {_tags::*}:
  114. set {_dropoptions::*} to loop-value split by ";"
  115. loop {_dropoptions::*}:
  116. if removePrefix(loop-value-2, "Drop:") is set:
  117. set {_customdropname} to removePrefix(loop-value-2, "Drop:")
  118. if removePrefix(loop-value-2, "DropChance:") is set:
  119. set {_dropchance} to removePrefix(loop-value-2, "DropChance:") parsed as number
  120. if removePrefix(loop-value-2, "MinAmount:") is set:
  121. set {_minamount} to removePrefix(loop-value-2, "MinAmount:") parsed as integer
  122. if removePrefix(loop-value-2, "MaxAmount:") is set:
  123. set {_maxamount} to removePrefix(loop-value-2, "MaxAmount:") parsed as integer
  124. if removePrefix(loop-value-2, "RareDrop:") is set:
  125. set {_raredrop} to removePrefix(loop-value-2, "RareDrop:") parsed as boolean
  126. {_customdropname} is set
  127. {_dropchance} is set
  128. {_minamount} is set
  129. {_maxamount} is set
  130. {_raredrop} is set
  131. if {_raredrop} is true:
  132. attacker is a player
  133. chance of {_dropchance}%:
  134. loop random integer between {_maxamount} and {_minamount} times:
  135. if {customdrops::%{_customdropname}%} is set:
  136. drop {customdrops::%{_customdropname}%} at victim
  137. else if {customdrops::%{_customdropname}%} is not set:
  138. set {_dropitem} to {_customdropname} parsed as itemtype
  139. {_dropitem} is set
  140. drop {_dropitem} at victim
  141. else if {_raredrop} is false:
  142. chance of {_dropchance}%:
  143. loop random integer between {_maxamount} and {_minamount} times:
  144. if {customdrops::%{_customdropname}%} is set:
  145. drop {customdrops::%{_customdropname}%} at victim
  146. else if {customdrops::%{_customdropname}%} is not set:
  147. set {_dropitem} to {_customdropname} parsed as itemtype
  148. {_dropitem} is set
  149. drop {_dropitem} at victim
  150. delete {_dropoptions::*}
  151. delete {_customdropname}
  152. delete {_dropchance}
  153. delete {_minamount}
  154. delete {_maxamount}
  155. delete {_raredrop}
  156. delete {_dropitem}
Advertisement
Add Comment
Please, Sign In to add comment