options: #Don't touch cw: "plugins/OX/config.yml" cs: "../../OX/config.yml" mw: "plugins/OX/messages.yml" ms: "../../OX/messages.yml" on script load: if file {@cw} is not exists: set yaml value "minPlayers" from {@cs} to 2 set yaml value "reward" from {@cs} to "diamond" set yaml value "amountOfQuestion" from {@cs} to "MAX" add "16:00" to yaml list "godziny" from {@cs} add "19:00" to yaml list "godziny" from {@cs} add "21:00" to yaml list "godziny" from {@cs} add "Czy 'przytulenie' kaktusa zadaje obrazenia?" to yaml list "pytanie.tak" from {@cs} add "Czy ruda lazurytu jest mozliwa do wydobycia przy uzyciu kamiennego kilofa?" to yaml list "pytanie.tak" from {@cs} add "Czy creeper'y uciekaja przed ocelot'ami?" to yaml list "pytanie.tak" from {@cs} add "Czy kaktus jest odporny na dzialanie ognia?" to yaml list "pytanie.tak" from {@cs} add "Czy glowstone mozna zdobyc poza nether'em?" to yaml list "pytanie.tak" from {@cs} add "Czy bieganie/skakanie po brodawkach je niszczy?" to yaml list "pytanie.nie" from {@cs} add "Czy Ocelot naturalnie spawnuje sie poza biomem dzunglowym?" to yaml list "pytanie.nie" from {@cs} add "Czy siodla mozna uzywac na krowie?" to yaml list "pytanie.nie" from {@cs} add "Czy slime wystepuja naturalnie na bagnach?" to yaml list "pytanie.nie" from {@cs} set yaml value "minYtoLose" from {@cs} to 60 set yaml value "map" from {@cs} to "oxMap" set {OX::conf::godz::*} to yaml list "godziny" from {@cs} set {OX::conf::godz} to size of {OX::conf::godz::*} if file {@mw} is not exists: set yaml value "recordsStart" from {@ms} to "&c* &6Zapisy na event OX sie rozpoczely.%nl%&c* &7Wpisz &c/ox&7, aby sie zapisac." set yaml value "recordsStop" from {@ms} to "&c* &6Zapisy na event OX sie zakonczyly." set yaml value "gameNoStarted" from {@ms} to "&c* &6Event OX nie wystartowal. Za malo graczy sie zapisalo." set yaml value "gameNoStartedNoQuestion" from {@ms} to "&c* &6Event OX nie wystartowal. Brak pytan w puli." set yaml value "gameStarted" from {@ms} to "&c* &6Event OX rozpoczal sie." set yaml value "gameStopedByOneWin" from {@ms} to "&c* &7Event OX zakonczyl sie. Zwyciezyl gracz &3{PLAYER}" set yaml value "gameStopedByNoWin" from {@ms} to "&c* &7Event OX zakonczyl sie. Nikt nie wygral." set yaml value "gameStopedByMoreWin" from {@ms} to "&c* &7Event OX zakonczyl sie. Wygralo {AMOUNT} graczy." set yaml value "gameStopedByAdmin" from {@ms} to "&c* &7Event OX zakonczyl sie. Zostal zatrzymany przez admina." set yaml value "gameSendQuestion" from {@ms} to "%nl%&c* &7Pytanie:%nl%&c* &6{QUESTION}&r%nl%" set yaml value "gameWait3" from {@ms} to "&e{TIME}" set yaml value "gameWait2" from {@ms} to "&6{TIME}" set yaml value "gameWait1" from {@ms} to "&4{TIME}" set yaml value "gamePlayerLeft" from {@ms} to "&c* &7Pozostalo graczy: {AMOUNT}" set yaml value "gamePlayerOut" from {@ms} to "&c* &6Spadles!" set yaml value "cmdOxAdminNoArgs" from {@ms} to "&a/ox &8- &7dolaczasz do OX.%nl%&a/ox start &8- &7startujesz OX.%nl%&a/ox godziny &8- &7godziny aktywowania eventu OX%nl%&a/ox ustaw &8- &7ustawiasz polozenie podlog%nl%&a/ox ustaw &8- &7Ustawia lokacje teleportacji" set yaml value "cmdOxAdminStartAbort" from {@ms} to "&7Juz jest aktywowane rozpoczecie OX." set yaml value "cmdOxAdminStart" from {@ms} to "&c* &7Za niecala minute rozpoczna sie zapisy na OX!" set yaml value "cmdOxInGame" from {@ms} to "&6Juz jestes zapisany na OX!" set yaml value "cmdOxToGame" from {@ms} to "&7Zapisales sie na OX!" set yaml value "cmdOxHours" from {@ms} to "&c* &7Godziny aktywowania zapisow:" set yaml value "cmdGiveRedPlatform" from {@ms} to "&6Wybierz tym patykiem polozenie czerwonej platformy" set yaml value "cmdGiveWhitePlatform" from {@ms} to "&6Wybierz tym patykiem polozenie bialej platformy" set yaml value "cmdGiveGreenPlatform" from {@ms} to "&6Wybierz tym patykiem polozenie zielonej platformy" set yaml value "cmdSetUnknownArg" from {@ms} to "&6Poprawne uzycie: &7/ox ustaw " set yaml value "cmdIsStandardMap" from {@ms} to "&c* &7Nie mozesz tego uzyc, poniewaz uzywasz standardowej mapy." set yaml value "cmdSetInGame" from {@ms} to "&c* &7Pomyslnie ustawiles lokacje do gry." set yaml value "cmdSetLobby" from {@ms} to "&c* &7Pomyslnie ustawiles lokacje poczekalni." set yaml value "clickWithStick" from {@ms} to "&6Wybrano." set yaml value "saveCoordinates" from {@ms} to "&6Zapisano platformÄ™: {PLATFORM}" set yaml value "succesfulSaveCoordinates" from {@ms} to "&c* &7Pomyslnie zapisales wszystkie platformy! Juz mozesz korzystac z eventow." set {OX::map} to "%yaml value ""map"" from "{@cs}"%" parsed as world if yaml value "map" from {@cs} is "oxMap": set {OX::game::inGame} to location at 0.5, 65.5, 0.5 of the world {OX::map} set {OX::game::lobby} to location at 0.5, 82.5, 0.5 of the world {OX::map} set {_i} to 1 loop 5 times: loop 11 times: set {OX::game::white::%{_i}%} to location at 3.5 - loop-number-1, 64.5, 6.5 - loop-number-2 in world {OX::map} add 1 to {_i} set {_i} to 1 loop 3 times: loop 11 times: set {OX::game::red::%{_i}%} to location at 6.5 - loop-number-1, 64.5, 6.5 - loop-number-2 in world {OX::map} add 1 to {_i} set {_i} to 1 loop 3 times: loop 11 times: set {OX::game::green::%{_i}%} to location at -1.5 - loop-number-1, 64.5, 6.5 - loop-number-2 in world {OX::map} add 1 to {_i} else: if {OX::game::area} is not set: clear {OX::game::white::*} clear {OX::game::red::*} clear {OX::game::green::*} clear {OX::map::red::*} clear {OX::map::white::*} clear {OX::map::green::*} clear {OX::game::inGame} clear {OX::game::lobby} stop if size of {OX::game::white::*} is not larger than 0: set {OX::game::error} to true if size of {OX::game::red::*} is not larger than 0: set {OX::game::error} to true if size of {OX::game::green::*} is not larger than 0: set {OX::game::error} to true if {OX::game::inGame} is not set: set {OX::game::error} to true if {OX::game::lobby} is not set: set {OX::game::error} to true #---Functions--- function stickCheckPlatforms(p: player): if name of {_p}' tool is "&c&lRED": clear {OX::game::red::*} loop blocks within {OX::map::red::1} to {OX::map::red::2}: add location of loop-block to {OX::game::red::*} if name of {_p}' tool is "&f&lWHITE": clear {OX::game::white::*} loop blocks within {OX::map::white::1} to {OX::map::white::2}: add location of loop-block to {OX::game::white::*} if name of {_p}' tool is "&a&lGREEN": clear {OX::game::green::*} loop blocks within {OX::map::green::1} to {OX::map::green::2}: add location of loop-block to {OX::game::green::*} if size of {OX::game::red::*} is smaller than or equal to 0: stop if size of {OX::game::white::*} is smaller than or equal to 0: stop if size of {OX::game::green::*} is smaller than or equal to 0: stop if {OX::game::inGame} is not set: send "Nie zapisales jeszcze lokacji teleportowania do gry." to {_p} stop if {OX::game::lobby} is not set: send "Nie zapisales jeszcze lokacji lobby." to {_p} stop clear {OX::game::error} clear {OX::map::red::1} clear {OX::map::red::2} clear {OX::map::white::1} clear {OX::map::white::2} clear {OX::map::green::1} clear {OX::map::green::2} set {OX::game::area} to true send coloured "%yaml value ""succesfulSaveCoordinates"" from "{@ms}"%" to {_p} setFloor("red") setFloor("white") setFloor("green") stop function clearFloor(floor: text): if {_floor} is "white" or "red" or "green": loop {OX::game::%{_floor}%::*}: set block at loop-value to air stop function setFloor(floor: text): if {_floor} is "white" or "red" or "green": if {_floor} is "green": set {_block} to "light_green_wool_block" else: set {_block} to "%{_floor}%_wool_block" loop {OX::game::%{_floor}%::*}: set {_block} to "%{_block}%" parsed as material set block at loop-value to {_block} function tpOXInGame(): loop {OX::game::players::*}: teleport loop-value to {OX::game::inGame} function sendOxQuestion(quest: text): set {_qM} to yaml value "gameSendQuestion" from {@ms} replace all "{QUESTION}" with "%{_quest}%" in {_qM} broadcast coloured "%{_qM}%" to {OX::map} function sendOxWait(time: integer): set {_tM} to yaml value "gameWait%{_time}%" from {@ms} replace all "{TIME}" with "%{_time}%" in {_tM} broadcast coloured "%{_tM}%" to {OX::map} function stopOX(): if size of {OX::game::players::*} is larger than 0: loop {OX::game::players::*}: set {_p} to "%loop-value%" parsed as offlineplayer teleport {_p} to {OX::game::lobby} clear {OX::game::players::*} clear {OX::game::records} broadcast coloured "%yaml value ""gameStopedByAdmin"" from "{@ms}"%" function startOxGame(): set {_qY::*} to yaml list "pytanie.tak" from {@cs} set {_qN::*} to yaml list "pytanie.nie" from {@cs} set {_qS} to size of {_qY::*} + size of {_qN::*} if {_qS} is smaller than 1: broadcast coloured "%yaml value ""gameNoStartedNoQuestion"" from "{@ms}"%" stop if "%yaml value ""amountOfQuestion"" from "{@cs}"%" is not "MAX": set {_qS} to yaml value "amountOfQuestion" from {@cs} set {_qS} to {_qS} parsed as integer if {_qS} is not integer: send "&c* &7Blad configu 'amountOfQuestion': %nl%&c%last parse error%" to console set {_qS} to size of {_qY::*} + size of {_qN::*} tpOXInGame() set {_reward} to "%yaml value ""reward"" from "{@cs}"%" set {_reward} to {_reward} parsed as item type if {_reward} is not item type: send "&c* &7Blad configu 'reward':%nl%%last parse error%" to console loop {_qS} times: clear {_q} clear {_q.a} if {_q} is not set: loop 100 times: if {_q} is set: exit loop chance of 50%: set {_q} to random text out of {_qY::*} set {_q.a} to "y" remove {_q} from {_qY::*} exit loop set {_q} to random text out of {_qN::*} set {_q.a} to "n" remove {_q} from {_qN::*} exit loop sendOxQuestion({_q}) wait 7 second loop 3 times: sendOxWait(3-(loop-number-2)+1) wait 1 second clearFloor("white") wait 3 second if {_q.a} is "y": clearFloor("red") if {_q.a} is "n": clearFloor("green") wait 2 second setFloor("red") setFloor("white") setFloor("green") tpOXInGame() if size of {OX::game::players::*} is smaller than 1: broadcast coloured "%yaml value ""gameStopedByNoWin"" from "{@ms}"%" delete {OX::game::players::*} stop if size of {OX::game::players::*} is 1: loop {OX::game::players::*}: set {_p} to "%loop-value-2%" parsed as offlineplayer teleport {_p} to {OX::game::lobby} give {_reward} to {_p} exit loop set {_geop} to yaml value "gameStopedByOneWin" from {@ms} replace all "{PLAYER}" with "%{_p}%" in {_geop} broadcast coloured "%{_geop}%" delete {OX::game::players::*} stop tpOXInGame() set {_gpl} to yaml value "gamePlayerLeft" from {@ms} replace all "{AMOUNT}" with "%size of {OX::game::players::*}%" in {_gpl} broadcast coloured "%{_gpl}%" to {OX::map} set {_ge} to yaml value "gameStopedByMoreWin" from {@ms} replace all "{AMOUNT}" with "%size of {OX::game::players::*}%" in {_ge} broadcast coloured "%{_ge}%" loop {OX::game::players::*}: set {_p} to "%loop-value%" parsed as offlineplayer teleport {_p} to {OX::game::lobby} give {_reward} to {_p} delete {OX::game::players::*} stop every 1 second: #broadcast "%hour% %minutes% %seconds%" loop {OX::conf::godz::*}: set {_lv} to "%loop-value%" set {_i} to 0 loop 10 times: replace all "0%{_i}%" with "%{_i}%" in {_lv} add 1 to {_i} if "%{_lv}%:0" is "%hour%:%minutes%:%seconds%": if {OX::game::error} is set: send "&7Arena jest zle skonfigurowana, brak ustawionych wszystkich podlog" to all ops and console stop set {_i} to size of {OX::conf::godz::*} if {OX::conf::godz} is smaller than {_i}: delete {OX::conf::godz::%{_i}%} set {OX::game::records} to true broadcast coloured "%yaml value ""recordsStart"" from "{@ms}"%" wait 30 seconds broadcast coloured "%yaml value ""recordsStop"" from "{@ms}"%" clear {OX::game::records} if size of {OX::game::players::*} is smaller than "%yaml value ""minPlayers"" from "{@cs}"%" parsed as integer: broadcast coloured "%yaml value ""gameNoStarted"" from "{@ms}"%" loop {OX::game::players::*}: execute console command "spawn %loop-value-2%" clear {OX::game::players::*} stop startOxGame() stop command /ox [] []: trigger: if {OX::game::records} is set: loop {OX::game::players::*}: if "%loop-value%" is "%player%": send coloured "%yaml value ""cmdOxInGame"" from "{@ms}"%" stop add player to {OX::game::players::*} teleport player to {OX::game::lobby} send coloured "%yaml value ""cmdOxToGame"" from "{@ms}"%" stop if player has permission "ox.admin": if arg 1 is not set: send coloured "%yaml value ""cmdOxAdminNoArgs"" from "{@ms}"%" stop if arg 1 is "start": set {_t} to "%hour%:%minutes+1%" loop {OX::conf::godz::*}: if "%loop-value%" is "%{_t}%": send coloured "%yaml value ""cmdOxAdminStartAbort"" from "{@ms}"%" stop add {_t} to {OX::conf::godz::*} broadcast coloured "%yaml value ""cmdOxAdminStart"" from "{@ms}"%" stop if arg 1 is "godziny": send coloured "%yaml value ""cmdOxHours"" from "{@ms}"%" loop {OX::conf::godz::*}: send coloured "&a%loop-value%" stop if arg 1 is "ustaw": if yaml value "map" from {@cs} is not "oxMap": if arg 2 is "red": give stick named "&c&lRED" with lore "&6Wybierz przekatne dla twojej platformy na NIE||&7(PPM - jeden rog, LPM - drugi rog)" to player send coloured "%yaml value ""cmdGiveRedPlatform"" from "{@ms}"%" stop if arg 2 is "white": give stick named "&f&lWHITE" with lore "&6Wybierz przekatne dla twojej platformy na NEUTRAl||&7(PPM - jeden rog, LPM - drugi rog)" to player send "%yaml value ""cmdGiveWhitePlatform"" from "{@ms}"%" stop if arg 2 is "green": give stick named "&a&lGREEN" with lore "&6Wybierz przekatne dla twojej platformy na TAK||&7(PPM - jeden rog, LPM - drugi rog)" to player send coloured "%yaml value ""cmdGiveGreenPlatform"" from "{@ms}"%" stop if arg 2 is "ingame": set {OX::game::ingame} to location of player send coloured "%yaml value ""cmdSetInGame"" from "{@ms}"%" stickCheckPlatforms(player) stop if arg 2 is "lobby": set {OX::game::lobby} to location of player send coloured "%yaml value ""cmdSetLobby"" from "{@ms}"%" stickCheckPlatforms(player) stop send coloured "%yaml value ""cmdSetUnknownArg"" from "{@ms}"%" stop send coloured "%yaml value ""cmdIsStandardMap"" from "{@ms}"%" stop send coloured "%yaml value ""cmdOxHours"" from "{@ms}"%" loop {OX::conf::godz::*}: send coloured "&a%loop-value%" stop on rightclick with stick: if yaml value "map" from {@cs} is not "oxMap": if "%player's world%" is "%yaml value ""map"" from "{@cs}"%": if targeted block is air: stop cancel event if name of player's tool is "&c&lRED": set {OX::map::red::2} to location of targeted block if {OX::map::red::1} is set: stickCheckPlatforms(player) set player's tool to air set {_string} to yaml value "saveCoordinates" from {@ms} replace all "{PLATFORM}" with "czerwona" in {_string} send coloured "%{_string}%" stop send coloured "%yaml value ""clickWithStick"" from "{@ms}"%" stop if name of player's tool is "&f&lWHITE": set {OX::map::white::2} to location of targeted block if {OX::map::white::1} is set: stickCheckPlatforms(player) set player's tool to air set {_string} to yaml value "saveCoordinates" from {@ms} replace all "{PLATFORM}" with "biala" in {_string} send coloured "%{_string}%" stop send coloured "%yaml value ""clickWithStick"" from "{@ms}"%" stop if name of player's tool is "&a&lGREEN": set {OX::map::green::2} to location of targeted block if {OX::map::green::1} is set: stickCheckPlatforms(player) set player's tool to air set {_string} to yaml value "saveCoordinates" from {@ms} replace all "{PLATFORM}" with "zielona" in {_string} send coloured "%{_string}%" stop send coloured "%yaml value ""clickWithStick"" from "{@ms}"%" stop stop on leftclick with stick: if yaml value "map" from {@cs} is not "oxMap": if "%player's world%" is "%yaml value ""map"" from "{@cs}"%": if "%targeted block%" is "air" or "": stop cancel event if name of player's tool is "&c&lRED": set {OX::map::red::1} to location of targeted block if {OX::map::red::2} is set: stickCheckPlatforms(player) set player's tool to air set {_string} to yaml value "saveCoordinates" from {@ms} replace all "{PLATFORM}" with "czerwona" in {_string} send coloured "%{_string}%" stop send coloured "%yaml value ""clickWithStick"" from "{@ms}"%" stop if name of player's tool is "&f&lWHITE": set {OX::map::white::1} to location of targeted block if {OX::map::white::2} is set: stickCheckPlatforms(player) set player's tool to air set {_string} to yaml value "saveCoordinates" from {@ms} replace all "{PLATFORM}" with "biala" in {_string} send coloured "%{_string}%" stop send coloured "%yaml value ""clickWithStick"" from "{@ms}"%" stop if name of player's tool is "&a&lGREEN": set {OX::map::green::1} to location of targeted block if {OX::map::green::2} is set: stickCheckPlatforms(player) set player's tool to air set {_string} to yaml value "saveCoordinates" from {@ms} replace all "{PLATFORM}" with "zielona" in {_string} send coloured "%{_string}%" stop send coloured "%yaml value ""clickWithStick"" from "{@ms}"%" stop stop on damage: if victim's world is {OX::map}: loop {OX::game::players::*}: if "%loop-value%" is "%player%": set {_x} to true exit loop if {_x} is set: cancel event on break: if player is op: stop if player's world is {OX::map}: loop {OX::game::players::*}: if "%loop-value%" is "%player%": set {_x} to true exit loop if {_x} is set: cancel event on place: if player is op: stop if player's world is {OX::map}: loop {OX::game::players::*}: if "%loop-value%" is "%player%": set {_x} to true exit loop if {_x} is set: cancel event on any move: if player's world is {OX::map}: loop {OX::game::players::*}: if "%loop-value%" is "%player%": set {_x} to true exit loop if {_x} is set: if y-location of player is smaller than "%yaml value ""minYtoLose"" from "{@cs}"%" parsed as integer: remove player from {OX::game::players::*} send coloured "%yaml value ""gamePlayerOut"" from "{@ms}"%" teleport player to {OX::game::lobby} stop