variables: {dzialki::%player%::*} = 0 # ------------------------------------------------------------- # ------------------------------------------------------------- # ------------------------------------------------------------- # Region Tools by RezzedUp # v 1.0 # --- # REQUIRES: # - Skript 2.2 # - SkQuery # FUNCTION: regionGetFlagsRaw() # PURPOSE: Return the flags of a region formatted in such a way that splitting will have less errors. # ARGUMENTS: ("", "") # RETURNS: text # EXAMPLE: # set {_flags} to regionGetFlagsRaw("myWorld", "mySetRegion") # broadcast {_flags} # EXAMPLE RESULTS: # mob-spawning::deny||mob-damage::deny||greeting::Welcome to my region! function regionGetFlagsRaw(world: text, region: text) :: text: set {_flags::*} to yaml nodes "regions.%{_region}%.flags" from "../../WorldGuard/worlds/%{_world}%/regions.yml" if {_flags::*} is set: loop {_flags::*}: set {_flag} to yaml value "regions.%{_region}%.flags.%loop-value%" from "../../WorldGuard/worlds/%{_world}%/regions.yml" if {_flags} is not set: set {_flags} to "%loop-value%::%{_flag}%" else: set {_flags} to "%{_flags}%||%loop-value%::%{_flag}%" return "%{_flags}%" else: return "null" # FUNCTION: regionGetFlags() # PURPOSE: Return the flags of a region formatted in such a way that it's easier to read. # ARGUMENTS: ("", "") # RETURNS: text # EXAMPLE: # set {_flags} to regionGetFlags("myWorld", "mySetRegion") # broadcast {_flags} # EXAMPLE RESULTS: # mob-spawning: deny, mob-damage: deny, greeting: Welcome to my region! function regionGetFlags(world: text, region: text) :: text: set {_flags} to regionGetFlagsRaw({_world}, {_region}) if {_flags} is not "null": replace "::" in {_flags} with ": " replace "||" in {_flags} with ", " return {_flags} # FUNCTION: regionHasFlag() # PURPOSE: Discover whether or not a region has a flag set. # ARGUMENTS: ("", "", "") # RETURNS: boolean # EXAMPLE: # set {_result} to regionHasFlag("myWorld", "mySetRegion", "mob-damage") # broadcast "%{_result}%" # EXAMPLE RESULTS: # true function regionHasFlag(world: text, region: text, flag: text) :: boolean: set {_flags} to regionGetFlagsRaw({_world}, {_region}) if {_flags} is not "null": set {_flags::*} to {_flags} split at "||" loop {_flags::*}: set {_current::*} to loop-value split at "::" add {_current::1} to {_flag::*} loop {_flag::*}: if loop-value is {_flag}: return true stop return false # FUNCTION: regionGetFlagValue() # PURPOSE: Get the value of a flag from a region. # ARGUMENTS: ("", "", "") # RETURNS: text # EXAMPLE: # set {_value} to regionGetFlagValue("myWorld", "mySetRegion", "mob-damage") # broadcast {_result} # EXAMPLE RESULTS: # deny function regionGetFlagValue(world: text, region: text, flag: text) :: text: if regionHasFlag({_world}, {_region}, {_flag}): set {_flags} to regionGetFlagsRaw({_world}, {_region}) set {_flags::*} to {_flags} split at "||" loop {_flags::*}: set {_current::*} to loop-value split at "::" set {_values::%{_current::1}%} to {_current::2} if {_values::%{_flag}%} is set: return {_values::%{_flag}%} stop return "null" # ------------------------------------------------------------- # ------------------------------------------------------------- # ------------------------------------------------------------- on script load: if file "plugins/Skript/scripts/Cuboidy/config.yml" doesn't exists: create file "plugins/Skript/scripts/Cuboidy/config.yml" set "Ustawienia.numer" to "0" in yaml file "plugins/Skript/scripts/Cuboidy/config.yml" set {cub::numer} to single value "Ustawienia.numer" get of "plugins/Skript/scripts/Cuboidy/config.yml" parsed as integer set {cubradius} to 49 command /cuboid [] []: trigger: {_region} = "%region at player%" if arg 1 is not set: message "komendy" stop if arg 1 is "tp": open chest with 1 rows named "&lWybierz dzialke - Teleportacja" to player wait a tick format slot 1 of player with 1 of green glass pane named "&a&lBlisko" with lore "&6&lOdleglosc: &c&o%{odl::blisko::min}% - %{odl::blisko::max}% &ekratek" to close then run [make console execute command "zrob %player% /rtp blisko"] format slot 4 of player with 1 of yellow glass pane named "&e&lNormalnie" with lore "&6&lOdleglosc: &c&o%{odl::normalnie::min}% - %{odl::normalnie::max}% &ekratek" to close then run [make console execute command "zrob %player% /rtp normalnie"] format slot 7 of player with 1 of red glass pane named "&c&lDaleko" with lore "&6&lOdleglosc: &c&o%{odl::daleko::min}% - %{odl::daleko::max}% &ekratek" to close then run [make console execute command "zrob %player% /rtp daleko"] if arg 1 is "flags": if player isn't the owner of region at player: message "Nie jestes wlascicielem cuboida!" stop {_tabela.fire-spread} = "deny" {_tabela.lava-fire} = "deny" {_tabela.fire-spread} = "deny" {_tabela.chest-access} = "deny" {_tabela.use} = "deny" {_tabela.snow-fall} = "deny" {_tabela.ice-form} = "deny" {_tabela.ice-melt} = "deny" {_tabela.mushroom-growth} = "deny" {_tabela.leaf-decay} = "deny" {_tabela.grass-growth} = "deny" {_tabela.mycelium-spread} = "deny" {_tabela.vine-growth} = "deny" loop {_tabela::*}: if regionHasFlag("world", "%{_region}%", "%loop-value%"): set {_tabela.%loop-value%} to regionGetFlagValue("world", "%{_region}%", "%loop-value%") if regionGetFlagValue("world", "%{_region}%", "%loop-value%") is "allow": set {_przeciwny} to "deny" else: set {_przeciwny} to "allow" open chest with 2 rows named "Menu - Poradnik" to player wait 1 tick format slot 0 of player with 1 of head named "%player%" with lore "Flag fire-spread %{_tabela.fire-spread}%" to run "region flag %{_region}% fire-spread %{_przeciwny}% -w world" format slot 1 of player with 1 of head named "%player%" with lore "Flag lava-fire %{_tabela.lava-fire}%" to run "region flag %{_region}% lava-fire %{_przeciwny}% -w world" format slot 2 of player with 1 of head named "%player%" with lore "Flag chest-access %{_tabela.chest-access}%" to run "region flag %{_region}% chest-access %{_przeciwny}% -w world" format slot 3 of player with 1 of head named "%player%" with lore "Flag use %{_tabela.use}%" to run "region flag %{_region}% use %{_przeciwny}% -w world" format slot 4 of player with 1 of head named "%player%" with lore "Flag snow-fall %{_tabela.snow-fall}%" to run "region flag %{_region}% snow-fall %{_przeciwny}% -w world" format slot 5 of player with 1 of head named "%player%" with lore "Flag ice-form %{_tabela.ice-form}%" to run "region flag %{_region}% ice-form %{_przeciwny}% -w world" format slot 6 of player with 1 of head named "%player%" with lore "Flag ice-melt %{_tabela.ice-melt}%" to run "region flag %{_region}% ice-melt %{_przeciwny}% -w world" format slot 7 of player with 1 of head named "%player%" with lore "Flag mushroom-growth %{_tabela.mushroom-growth}%" to run "region flag %{_region}% mushroom-growth %{_przeciwny}% -w world" format slot 8 of player with 1 of head named "%player%" with lore "Flag leaf-decay %{_tabela.leaf-decay}%" to run "region flag %{_region}% leaf-decay %{_przeciwny}% -w world" format slot 9 of player with 1 of head named "%player%" with lore "Flag grass-growth %{_tabela.grass-growth}%" to run "region flag %{_region}% grass-growth %{_przeciwny}% -w world" format slot 9 of player with 1 of head named "%player%" with lore "Flag mycelium-spread %{_tabela.mycelium-spread}%" to run "region flag %{_region}% mycelium-spread %{_przeciwny}% -w world" format slot 10 of player with 1 of head named "%player%" with lore "Flag vine-growth %{_tabela.vine-growth}%" to run "region flag %{_region}% vine-growth %{_przeciwny}% -w world" format slot 11 of player with 1 of head named "%player%" with lore "Zamknij" to close if arg 1 is "dodaj": if player isn't the owner of region at player: message "Nie jestes wlascicielem cuboida!" stop if arg 2 is not set: message "Nie podales nicku gracza!" stop else: execute console command "/region addmember %{_region}% %arg-2% -w world" message "Dodano gracza" #remove member arg-2 from wg region {_region} in world "%world of player%" stop if arg 1 is "usun": if player isn't the owner of region at player: message "Nie jestes wlascicielem cuboida!" stop if arg 2 is not set: message "Nie podales nicku gracza!" stop else: execute console command "/region removemember %{_region}% %arg-2% -w world" message "Usunieto gracza" #remove member arg-2 from wg region {_region} in world "%world of player%" stop on place of jukebox: #dodac permisje wordedit i guard loop blocks in radius {cubradius} of event-block: set {_lok2} to location of loop-block if "%region at loop-block%" does not contain "none": message "Jestes zbyt blisko innego cuboida" stop set {_lok} to location of event-block set {_ylok} to y coordinate of event-block subtract 0.5 from x-coord of {_lok} subtract 0.5 from y-coord of {_lok} subtract 0.5 from z-coord of {_lok} set {skRegions::pos1::%player%} to {_lok} set {skRegions::worldPos1::%player%} to world of event-block set {skRegions::pos2::%player%} to {_lok} set {skRegions::worldPos2::%player%} to world of event-block set y coordinate of {skRegions::pos1::%player%} to 0 set y coordinate of {skRegions::pos2::%player%} to 255 add {cubradius} to x-coord of {skRegions::pos1::%player%} subtract {cubradius} from z-coord of {skRegions::pos1::%player%} add {cubradius} to z-coord of {skRegions::pos2::%player%} subtract {cubradius} from x-coord of {skRegions::pos2::%player%} message "Tworzymy cuboid!" set we pos 1 of player to {skRegions::pos1::%player%} set we pos 2 of player to {skRegions::pos2::%player%} set {cub} to {cub}+1 create wg region "%{cub}%" between {skRegions::pos1::%player%} and {skRegions::pos2::%player%} in world {skRegions::worldPos1::%player%} set "Ustawienia.numer" to "%{cub}%" in yaml file "plugins/Skript/scripts/Cuboidy/config.yml" set y coordinate of {skRegions::pos1::%player%} to {_ylok}-2 set y coordinate of {skRegions::pos2::%player%} to {_ylok}-2 set we pos 1 of player to {skRegions::pos1::%player%} set we pos 2 of player to {skRegions::pos2::%player%} execute console command "/region addowner %{cub}% %player% -w world" execute console command "/region flag %{cub}% greeting Weszles na cuboid %{cub}%(%player%) -w world" execute console command "/region flag %{cub}% farewell Wyszedles z %{cub}% -w world" execute player command "//walls 1" delete {skRegions::pos1::%player%} delete {skRegions::pos2::%player%} delete {skRegions::worldPos1::%player%} delete {skRegions::worldPos2::%player%} on break of jukebox: {_region} = "%region at player%" if player isn't the owner of region at player: message "Nie jestes wlascicielem dzialki!" cancel event stop else: message "Usunieto twoja dzialke!" delete wg region {_region} in "world" command /regi: permission: op trigger: message "%region at player%"