Zeldaboy111

Falling Blocks ]|[ Skript #456

Oct 3rd, 2021
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.48 KB | None | 0 0
  1. options:
  2. prefix: &6Mines&8:&7
  3.  
  4. on quit:
  5. delete {mine.user.%uuid of player%.isConfirmingMine}
  6. delete {mine.user.%uuid of player%.isShowingMine}
  7. loop {mine.user.%uuid of player%.fallingBlocks::*}:
  8. kill loop-value
  9.  
  10. on disable:
  11. loop all players:
  12. delete {mine.user.%uuid of loop-player%.isConfirmingMine}
  13. delete {mine.user.%uuid of loop-player%.isShowingMine}
  14. loop {mine.user.%uuid of loop-player%.fallingBlocks::*}:
  15. kill loop-value-2
  16.  
  17.  
  18. command /mine [<text>] [<text>] [<text>] [<text>] [<text>]:
  19. aliases: /mines
  20. trigger:
  21. if executor is not a player:
  22. send "{@prefix} This command can only be executed by a player."
  23. else if arg-1 is "create":
  24. if arg-2 is not set:
  25. send "{@prefix} Invalid Usage! &e/mine create <id> <length> <depth> <width>&7."
  26. else if {mine.list::*} contains arg-2 in lower case:
  27. send "{@prefix} A mine with the id &e%arg-2 in lower case% &7already exists."
  28. else if {mine.user.%uuid of player%.isConfirmingMine} is true:
  29. send "{@prefix} You are already creating a mine. Either cancel or confirm the mine first."
  30. else if isNotANumber(player, arg-3, "<length>", "<depth>", "<width>"), isNotANumber(player, arg-4, arg-3, "<depth>", "<width>") or isNotANumber(player, arg-5, arg-3, arg-4, "<width>") is false:
  31. stop
  32. else:
  33. set {mine.user.%uuid of player%.isConfirmingMine} to true
  34. set {mine.user.%uuid of player%.location} to location of block at location of player
  35. set {mine.user.%uuid of player%.id} to arg-2 in lower case
  36. set {mine.user.%uuid of player%.length} to arg-3 parsed as an integer
  37. set {mine.user.%uuid of player%.depth} to arg-4 parsed as an integer
  38. set {mine.user.%uuid of player%.width} to arg-5 parsed as an integer
  39. showMineToConfirm(player)
  40. send "{@prefix} Please confirm you want to create a mine with as parameters &e%arg-3% &e%arg-4% &e%arg-5%&7."
  41. send "{@prefix} To confirm, please type &e/mine <confirm | cancel>&7."
  42.  
  43. else if arg-1 is "delete":
  44. # Delete a mine
  45. else if arg-1 is "confirm":
  46. if {mine.user.%uuid of player%.isConfirmingMine} is not true:
  47. send "{@prefix} Invalid Usage! &e/mine <create | delete> <id> <length> <depth> <width>&7."
  48. else:
  49. if {mine.list::*} contains {mine.user.%uuid of player%.id}:
  50. send "{@prefix} A mine with the id &e%arg-2 in lower case% &7already exists."
  51. delete {mine.user.%uuid of player%.isConfirmingMine}
  52. delete {mine.user.%uuid of player%.isShowingMine}
  53. else:
  54.  
  55. loop {mine.user.%uuid of player%.fallingBlocks::*}:
  56. set health of loop-value to 0
  57. # Confirm creating a mine
  58. else if arg-1 is "cancel":
  59. if {mine.user.%uuid of player%.isConfirmingMine} is not true:
  60. send "{@prefix} Invalid Usage! &e/mine <create | delete> <id> <length> <depth> <width>&7."
  61. else:
  62. delete {mine.user.%uuid of player%.isConfirmingMine}
  63. delete {mine.user.%uuid of player%.isShowingMine}
  64. send "{@prefix} You have cancelled creating the mine."
  65. loop {mine.user.%uuid of player%.fallingBlocks::*}:
  66. kill loop-value
  67. else:
  68. send "{@prefix} Invalid Usage! &e/mine <create | delete> <id> <length> <depth> <width>&7."
  69.  
  70. function isNotANumber(player: Player, input: String, length: String, depth: String, width: String) :: Boolean:
  71. if {_input} parsed as an integer is not set:
  72. send "{@prefix} Invalid Usage! &e/mine create <id> %{_length}% &e%{_depth}% &e%{_width}%&7." to {_player}
  73. return false
  74. return true
  75.  
  76. function showMineToConfirm(player: Player):
  77. set {_uuid} to uuid of {_player}
  78. if {mine.user.%{_uuid}%.isShowingMine} is true:
  79. stop
  80. set {mine.user.%{_uuid}%.isShowingMine} to true
  81. set {_locationOffsetNorth::*} to 0, 0, {mine.user.%{_uuid}%.length} and {mine.user.%{_uuid}%.length}
  82. set {_locationOffsetEast::*} to 0, {mine.user.%{_uuid}%.width}, {mine.user.%{_uuid}%.width} and 0
  83. loop 8 times:
  84. if loop-value < 5:
  85. spawn falling sea lantern at location {_locationOffsetNorth::%loop-value%} meters north, {_locationOffsetEast::%loop-value%} meters east of {mine.user.%{_uuid}%.location}
  86. else:
  87. spawn falling sea lantern at location {mine.user.%{_uuid}%.depth} meters below, {_locationOffsetNorth::%loop-value - 4%} meters north, {_locationOffsetEast::%loop-value - 4%} meters east of {mine.user.%{_uuid}%.location}
  88.  
  89. set {_entity} to spawned entity
  90. hide {_entity} for all players
  91. show {_entity} to {_player}
  92. add {_entity} to {mine.user.%{_uuid}%.fallingBlocks::*}
  93. add "{NoGravity:1b,Invulnerable:1b}" to nbt of {_entity}
  94. # Blocks pop??????
  95.  
  96.  
  97.  
  98.  
  99.  
Advertisement
Add Comment
Please, Sign In to add comment