Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ZAZNACZANIE PUNKTÓW STICKIEM
- # Komenda do ustawiania punktu 1 (kliknięcie prawym przyciskiem myszy z patykiem)
- on left click holding stick:
- # ustawienie Punktu 1
- set {pos1::%uuid of player%} to event-block
- send "" to player
- send "&aUstawiono Punkt &7(&b1&7)" to player
- send "&7Typ&c: &f%type of event-block%" to player
- send "&7Świat&c: &r%world of event-block%" to player
- if game mode of player is creative:
- cancel event
- on right click holding stick:
- # zapobiegamy niszczeniu bloku w trybie kreatywnym
- # ustawienie Punktu 2
- set {pos2::%uuid of player%} to event-block
- # jeśli Punkt 1 już jest, opisujemy obszar
- if {pos1.%uuid of player%} is set:
- # pobranie lokacji
- set {_l1} to {pos1::%uuid of player%}
- set {_l2} to {pos2::%uuid of player%}
- set {_world} to world of {_l1}
- # wyliczenie granic
- set {_minX} to min(x-coordinate of {_l1}, x-coordinate of {_l2})
- set {_maxX} to max(x-coordinate of {_l1}, x-coordinate of {_l2})
- set {_minY} to min(y-coordinate of {_l1}, y-coordinate of {_l2})
- set {_maxY} to max(y-coordinate of {_l1}, y-coordinate of {_l2})
- set {_minZ} to min(z-coordinate of {_l1}, z-coordinate of {_l2})
- set {_maxZ} to max(z-coordinate of {_l1}, z-coordinate of {_l2})
- # obliczenie wymiarów i objętości
- set {_width} to {_maxX} - {_minX} + 1
- set {_height} to {_maxY} - {_minY} + 1
- set {_depth} to {_maxZ} - {_minZ} + 1
- set {_volume} to {_width} * {_height} * {_depth}
- # wysłanie opisu
- send "" to player
- send "&aUstawiono Punkt &7(&b2&7)" to player
- send "&7Typ&c: &f%type of event-block%" to player
- send "&7Świat&c: &r%world of event-block%" to player
- send "&7Początek&c: &7(&b%{_minX}%&7, &b%{_minY}%&7, &b%{_minZ}%&7)" to player
- send "&7Koniec&7: &7(&b%{_maxX}%&7, &b%{_maxY}%&7, &b%{_maxZ}%&7)" to player
- send "&7Wymiary&c: &rSzerokość &7(&b%{_width}%&7) &rWysokość &7(&b%{_height}%&7) &rGłębokość &7(&b%{_depth}%&7)" to player
- send "&7Bloków&c: &7(&b%{_volume}%&7)" to player
- command /deletewall <text>:
- trigger:
- # Sprawdzamy, czy plik istnieje
- if file "plugins/YourPlugin/walls/%arg-1%.json" exists: # Sprawdzamy, czy plik istnieje
- # Usuwamy plik
- delete file "plugins/YourPlugin/walls/%arg-1%.json"
- send "&aPlik '%arg-1%' został usunięty!" to player
- else:
- send "&cPlik '%arg-1%' nie istnieje!" to player
- # KOMENDA /SETWALL <nazwa>
- # KOMENDA /SETWALL <nazwa>
- import:
- java.io.File
- org.bukkit.configuration.file.YamlConfiguration
- org.bukkit.Bukkit
- org.bukkit.block.data.BlockData
- org.bukkit.Material
- command /setwall <text>:
- trigger:
- set {_name} to arg-1
- set {_uuid} to uuid of player
- if {pos1::%{_uuid}%} is not set:
- send "&cMusisz zaznaczyć Punkt 1!" to player
- stop
- if {pos2::%{_uuid}%} is not set:
- send "&cMusisz zaznaczyć Punkt 2!" to player
- stop
- set {_p1} to {pos1::%{_uuid}%}
- set {_p2} to {pos2::%{_uuid}%}
- set {_w} to world of {_p1}
- # obliczanie zakresów
- set {_minX} to min(x-coordinate of {_p1}, x-coordinate of {_p2})
- set {_maxX} to max(x-coordinate of {_p1}, x-coordinate of {_p2})
- set {_minY} to min(y-coordinate of {_p1}, y-coordinate of {_p2})
- set {_maxY} to max(y-coordinate of {_p1}, y-coordinate of {_p2})
- set {_minZ} to min(z-coordinate of {_p1}, z-coordinate of {_p2})
- set {_maxZ} to max(z-coordinate of {_p1}, z-coordinate of {_p2})
- set {_count} to 0
- set {_blocksInPart} to 0
- set {_part} to 1
- set {_config} to new YamlConfiguration()
- # — pętle X, Y, Z poprawnie wcięte, bez pustych "while:" —
- set {_x} to {_minX}
- while {_x} <= {_maxX}:
- set {_y} to {_minY}
- while {_y} <= {_maxY}:
- set {_z} to {_minZ}
- while {_z} <= {_maxZ}:
- set {_loc} to location {_x}, {_y}, {_z} in {_w}
- set {_block} to block at {_loc}
- set {_type} to type of {_block}
- set {_data} to {_block}.getBlockData().getAsString()
- add 1 to {_count}
- add 1 to {_blocksInPart}
- {_config}.set("blocks.%{_count}%.x", {_x})
- {_config}.set("blocks.%{_count}%.y", {_y})
- {_config}.set("blocks.%{_count}%.z", {_z})
- {_config}.set("blocks.%{_count}%.world", {_w}.getName())
- {_config}.set("blocks.%{_count}%.type", {_type}.toString())
- {_config}.set("blocks.%{_count}%.data", {_data})
- if {_blocksInPart} >= 1000:
- set {_file} to new File("plugins/YourPlugin/walls/%{_name}%_part%{_part}%.yml")
- {_config}.set("size", {_count})
- {_config}.save({_file})
- send "&7Zapisano &a1000&7 bloków do &e%{_file}.getName()%&7." to player
- add 1 to {_part}
- set {_blocksInPart} to 0
- set {_config} to new YamlConfiguration()
- add 1 to {_z}
- add 1 to {_y}
- add 1 to {_x}
- # ostatnia część
- if {_blocksInPart} > 0:
- set {_file} to new File("plugins/YourPlugin/walls/%{_name}%_part%{_part}%.yml")
- {_config}.set("size", {_count})
- {_config}.save({_file})
- send "&7Zapisano końcową partię do &e%{_file}.getName()%&7." to player
- send "&aZapisano łącznie %{_count}% bloków w %{_part}% partiach jako &e%{_name}%_partX.yml&a!" to player
- command /repairwall <text>:
- trigger:
- set {_name} to arg-1
- # Ścieżka do pliku
- set {_path} to "plugins/YourPlugin/walls/%{_name}%.yml"
- # Sprawdzenie istnienia pliku (korzystając z wbudowanej funkcji Skript)
- if file {_path} does not exist:
- send "&cPlik '&e%{_name}%&c' nie istnieje!" to player
- stop
- # Inicjalizacja obiektu File do dalszego wczytania configa
- set {_file} to new File({_path})
- set {_config} to YamlConfiguration.loadConfiguration({_file})
- set {_size} to {_config}.getInt("%{_name}%.size")
- if {_size} <= 0:
- send "&cŚciana '%{_name}%' nie zawiera żadnych bloków!" to player
- stop
- set {_mainWorldName} to {_config}.getString("%{_name}%.blocks.1.world")
- if {_mainWorldName} is "none":
- send "&cNie udało się odczytać świata ze schematu ściany!" to player
- stop
- # Zatrzymujemy przepływ cieczy
- set {fluids.disabled::%{_mainWorldName}%} to true
- send "&cZatrzymano przepływ cieczy w świecie '&e%{_mainWorldName}%&c' na 10 sekund (regeneracja ściany)..." to player
- set {_fireTypes::*} to "SOUL_FIRE"
- wait 10 tick
- loop {_size} times:
- set {_i} to {_size} - loop-number + 1
- set {_x} to {_config}.getDouble("%{_name}%.blocks.%{_i}%.x")
- set {_y} to {_config}.getDouble("%{_name}%.blocks.%{_i}%.y")
- set {_z} to {_config}.getDouble("%{_name}%.blocks.%{_i}%.z")
- set {_worldName} to {_config}.getString("%{_name}%.blocks.%{_i}%.world")
- set {_typeName} to {_config}.getString("%{_name}%.blocks.%{_i}%.type")
- set {_dataString} to {_config}.getString("%{_name}%.blocks.%{_i}%.data")
- set {_world} to Bukkit.getWorld({_worldName})
- if {_world} is null:
- continue
- if {_fireTypes::*} does not contain "%{_typeName}%":
- set {_blockData} to Bukkit.createBlockData({_dataString})
- set {_loc} to location {_x}, {_y}, {_z} in {_world}
- set block at {_loc} to {_blockData}
- add 1 to {_count}
- send "&aŚciana '%{_name}%' została naprawiona!" to player
- wait 10 seconds
- set {fluids.disabled::%{_mainWorldName}%} to false
- send "&aPrzywrócono przepływ cieczy w świecie '&f%{_mainWorldName}%&a'." to player
- stop
- on block flow:
- if {fluids.disabled::%world of event-block%} is true:
- cancel event
- on flow:
- event-block is water:
- loop all blocks in radius 2 around event-block:
- loop-block is a obsidian:
- set loop-block to lava
- loop-block is a stone:
- set loop-block to stone
- on block form:
- if {fluids.disabled::%world of event-block%} is true:
- cancel event
- on block physics:
- if {fluids.disabled::%world of event-block%} is true:
- cancel event
Advertisement
Add Comment
Please, Sign In to add comment