Guest User

Untitled

a guest
Apr 26th, 2025
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.71 KB | None | 0 0
  1. # ZAZNACZANIE PUNKTÓW STICKIEM
  2. # Komenda do ustawiania punktu 1 (kliknięcie prawym przyciskiem myszy z patykiem)
  3. on left click holding stick:
  4. # ustawienie Punktu 1
  5. set {pos1::%uuid of player%} to event-block
  6. send "" to player
  7. send "&aUstawiono Punkt &7(&b1&7)" to player
  8. send "&7Typ&c: &f%type of event-block%" to player
  9. send "&7Świat&c: &r%world of event-block%" to player
  10. if game mode of player is creative:
  11. cancel event
  12. on right click holding stick:
  13. # zapobiegamy niszczeniu bloku w trybie kreatywnym
  14.  
  15. # ustawienie Punktu 2
  16. set {pos2::%uuid of player%} to event-block
  17.  
  18. # jeśli Punkt 1 już jest, opisujemy obszar
  19. if {pos1.%uuid of player%} is set:
  20. # pobranie lokacji
  21. set {_l1} to {pos1::%uuid of player%}
  22. set {_l2} to {pos2::%uuid of player%}
  23. set {_world} to world of {_l1}
  24.  
  25. # wyliczenie granic
  26. set {_minX} to min(x-coordinate of {_l1}, x-coordinate of {_l2})
  27. set {_maxX} to max(x-coordinate of {_l1}, x-coordinate of {_l2})
  28. set {_minY} to min(y-coordinate of {_l1}, y-coordinate of {_l2})
  29. set {_maxY} to max(y-coordinate of {_l1}, y-coordinate of {_l2})
  30. set {_minZ} to min(z-coordinate of {_l1}, z-coordinate of {_l2})
  31. set {_maxZ} to max(z-coordinate of {_l1}, z-coordinate of {_l2})
  32.  
  33. # obliczenie wymiarów i objętości
  34. set {_width} to {_maxX} - {_minX} + 1
  35. set {_height} to {_maxY} - {_minY} + 1
  36. set {_depth} to {_maxZ} - {_minZ} + 1
  37. set {_volume} to {_width} * {_height} * {_depth}
  38.  
  39. # wysłanie opisu
  40. send "" to player
  41. send "&aUstawiono Punkt &7(&b2&7)" to player
  42. send "&7Typ&c: &f%type of event-block%" to player
  43. send "&7Świat&c: &r%world of event-block%" to player
  44. send "&7Początek&c: &7(&b%{_minX}%&7, &b%{_minY}%&7, &b%{_minZ}%&7)" to player
  45. send "&7Koniec&7: &7(&b%{_maxX}%&7, &b%{_maxY}%&7, &b%{_maxZ}%&7)" to player
  46. send "&7Wymiary&c: &rSzerokość &7(&b%{_width}%&7) &rWysokość &7(&b%{_height}%&7) &rGłębokość &7(&b%{_depth}%&7)" to player
  47. send "&7Bloków&c: &7(&b%{_volume}%&7)" to player
  48. command /deletewall <text>:
  49. trigger:
  50. # Sprawdzamy, czy plik istnieje
  51. if file "plugins/YourPlugin/walls/%arg-1%.json" exists: # Sprawdzamy, czy plik istnieje
  52. # Usuwamy plik
  53. delete file "plugins/YourPlugin/walls/%arg-1%.json"
  54. send "&aPlik '%arg-1%' został usunięty!" to player
  55. else:
  56. send "&cPlik '%arg-1%' nie istnieje!" to player
  57. # KOMENDA /SETWALL <nazwa>
  58.  
  59. # KOMENDA /SETWALL <nazwa>
  60.  
  61. import:
  62. java.io.File
  63. org.bukkit.configuration.file.YamlConfiguration
  64. org.bukkit.Bukkit
  65. org.bukkit.block.data.BlockData
  66. org.bukkit.Material
  67.  
  68. command /setwall <text>:
  69. trigger:
  70. set {_name} to arg-1
  71. set {_uuid} to uuid of player
  72.  
  73. if {pos1::%{_uuid}%} is not set:
  74. send "&cMusisz zaznaczyć Punkt 1!" to player
  75. stop
  76. if {pos2::%{_uuid}%} is not set:
  77. send "&cMusisz zaznaczyć Punkt 2!" to player
  78. stop
  79.  
  80. set {_p1} to {pos1::%{_uuid}%}
  81. set {_p2} to {pos2::%{_uuid}%}
  82. set {_w} to world of {_p1}
  83.  
  84. # obliczanie zakresów
  85. set {_minX} to min(x-coordinate of {_p1}, x-coordinate of {_p2})
  86. set {_maxX} to max(x-coordinate of {_p1}, x-coordinate of {_p2})
  87. set {_minY} to min(y-coordinate of {_p1}, y-coordinate of {_p2})
  88. set {_maxY} to max(y-coordinate of {_p1}, y-coordinate of {_p2})
  89. set {_minZ} to min(z-coordinate of {_p1}, z-coordinate of {_p2})
  90. set {_maxZ} to max(z-coordinate of {_p1}, z-coordinate of {_p2})
  91.  
  92. set {_count} to 0
  93. set {_blocksInPart} to 0
  94. set {_part} to 1
  95. set {_config} to new YamlConfiguration()
  96.  
  97. # — pętle X, Y, Z poprawnie wcięte, bez pustych "while:" —
  98. set {_x} to {_minX}
  99. while {_x} <= {_maxX}:
  100. set {_y} to {_minY}
  101. while {_y} <= {_maxY}:
  102. set {_z} to {_minZ}
  103. while {_z} <= {_maxZ}:
  104. set {_loc} to location {_x}, {_y}, {_z} in {_w}
  105. set {_block} to block at {_loc}
  106. set {_type} to type of {_block}
  107. set {_data} to {_block}.getBlockData().getAsString()
  108.  
  109. add 1 to {_count}
  110. add 1 to {_blocksInPart}
  111.  
  112. {_config}.set("blocks.%{_count}%.x", {_x})
  113. {_config}.set("blocks.%{_count}%.y", {_y})
  114. {_config}.set("blocks.%{_count}%.z", {_z})
  115. {_config}.set("blocks.%{_count}%.world", {_w}.getName())
  116. {_config}.set("blocks.%{_count}%.type", {_type}.toString())
  117. {_config}.set("blocks.%{_count}%.data", {_data})
  118.  
  119. if {_blocksInPart} >= 1000:
  120. set {_file} to new File("plugins/YourPlugin/walls/%{_name}%_part%{_part}%.yml")
  121. {_config}.set("size", {_count})
  122. {_config}.save({_file})
  123. send "&7Zapisano &a1000&7 bloków do &e%{_file}.getName()%&7." to player
  124.  
  125. add 1 to {_part}
  126. set {_blocksInPart} to 0
  127. set {_config} to new YamlConfiguration()
  128.  
  129. add 1 to {_z}
  130. add 1 to {_y}
  131. add 1 to {_x}
  132.  
  133. # ostatnia część
  134. if {_blocksInPart} > 0:
  135. set {_file} to new File("plugins/YourPlugin/walls/%{_name}%_part%{_part}%.yml")
  136. {_config}.set("size", {_count})
  137. {_config}.save({_file})
  138. send "&7Zapisano końcową partię do &e%{_file}.getName()%&7." to player
  139.  
  140. send "&aZapisano łącznie %{_count}% bloków w %{_part}% partiach jako &e%{_name}%_partX.yml&a!" to player
  141.  
  142. command /repairwall <text>:
  143. trigger:
  144. set {_name} to arg-1
  145. # Ścieżka do pliku
  146. set {_path} to "plugins/YourPlugin/walls/%{_name}%.yml"
  147. # Sprawdzenie istnienia pliku (korzystając z wbudowanej funkcji Skript)
  148. if file {_path} does not exist:
  149. send "&cPlik '&e%{_name}%&c' nie istnieje!" to player
  150. stop
  151. # Inicjalizacja obiektu File do dalszego wczytania configa
  152. set {_file} to new File({_path})
  153. set {_config} to YamlConfiguration.loadConfiguration({_file})
  154. set {_size} to {_config}.getInt("%{_name}%.size")
  155.  
  156. if {_size} <= 0:
  157. send "&cŚciana '%{_name}%' nie zawiera żadnych bloków!" to player
  158. stop
  159.  
  160. set {_mainWorldName} to {_config}.getString("%{_name}%.blocks.1.world")
  161.  
  162. if {_mainWorldName} is "none":
  163. send "&cNie udało się odczytać świata ze schematu ściany!" to player
  164. stop
  165.  
  166. # Zatrzymujemy przepływ cieczy
  167. set {fluids.disabled::%{_mainWorldName}%} to true
  168. send "&cZatrzymano przepływ cieczy w świecie '&e%{_mainWorldName}%&c' na 10 sekund (regeneracja ściany)..." to player
  169.  
  170. set {_fireTypes::*} to "SOUL_FIRE"
  171.  
  172.  
  173. wait 10 tick
  174. loop {_size} times:
  175. set {_i} to {_size} - loop-number + 1
  176.  
  177. set {_x} to {_config}.getDouble("%{_name}%.blocks.%{_i}%.x")
  178. set {_y} to {_config}.getDouble("%{_name}%.blocks.%{_i}%.y")
  179. set {_z} to {_config}.getDouble("%{_name}%.blocks.%{_i}%.z")
  180. set {_worldName} to {_config}.getString("%{_name}%.blocks.%{_i}%.world")
  181. set {_typeName} to {_config}.getString("%{_name}%.blocks.%{_i}%.type")
  182. set {_dataString} to {_config}.getString("%{_name}%.blocks.%{_i}%.data")
  183.  
  184. set {_world} to Bukkit.getWorld({_worldName})
  185. if {_world} is null:
  186. continue
  187.  
  188. if {_fireTypes::*} does not contain "%{_typeName}%":
  189. set {_blockData} to Bukkit.createBlockData({_dataString})
  190. set {_loc} to location {_x}, {_y}, {_z} in {_world}
  191. set block at {_loc} to {_blockData}
  192.  
  193. add 1 to {_count}
  194. send "&aŚciana '%{_name}%' została naprawiona!" to player
  195. wait 10 seconds
  196. set {fluids.disabled::%{_mainWorldName}%} to false
  197. send "&aPrzywrócono przepływ cieczy w świecie '&f%{_mainWorldName}%&a'." to player
  198. stop
  199.  
  200. on block flow:
  201. if {fluids.disabled::%world of event-block%} is true:
  202. cancel event
  203. on flow:
  204. event-block is water:
  205. loop all blocks in radius 2 around event-block:
  206. loop-block is a obsidian:
  207. set loop-block to lava
  208. loop-block is a stone:
  209. set loop-block to stone
  210.  
  211. on block form:
  212. if {fluids.disabled::%world of event-block%} is true:
  213. cancel event
  214.  
  215. on block physics:
  216. if {fluids.disabled::%world of event-block%} is true:
  217. cancel event
  218.  
Advertisement
Add Comment
Please, Sign In to add comment