import: eu.decentsoftware.holograms.api.DHAPI options: worldName: world hologramIDPrefix: hornCoralID hologramMaxID: 1000000 function getRandomLocBetweenTwoLocs(loc1: location, loc2: location) :: location: if world of {_loc1} isn't world of {_loc2}: return location at (0, 0, 0) in world of {_loc1} set {_x} to random number between (x-loc of {_loc1}) and (x-loc of {_loc2}) set {_y} to random number between (y-loc of {_loc1}) and (y-loc of {_loc2}) set {_z} to random number between (z-loc of {_loc1}) and (z-loc of {_loc2}) return location at ({_x}, {_y}, {_z}) in world of {_loc1} every 1 minute: set {_time} to (now formatted as "HH") parsed as integer {_time} is between 10 and 19 set {_spawnLoc1} to location at (362, 132, 495) in world "{@worldName}" set {_spawnLoc2} to location at (471, 132, 607) in world "{@worldName}" set {_noSpawnLoc1} to location at (396, 132, 547) in world "{@worldName}" set {_noSpawnLoc2} to location at (418, 132, 568) in world "{@worldName}" set {_amountOfCorals} to random integer between 5 and 15 loop {_amountOfCorals} times: set {_randomLoc} to getRandomLocBetweenTwoLocs({_spawnLoc1}, {_spawnLoc2}) set {_b} to false while {_b} is false: set {_randomLoc} to getRandomLocBetweenTwoLocs({_spawnLoc1}, {_spawnLoc2}) {_randomLoc} is not within {_noSpawnLoc1} and {_noSpawnLoc2} block at {_randomLoc} is air set {_b} to true set {_randomLoc} to location of block at {_randomLoc} set {_hologramID} to random integer between 1 and {@hologramMaxID} while {hornCoralPlants::hologramIDs::*} contains {_hologramID}: set {_hologramID} to random integer between 1 and {@hologramMaxID} set {_holoFullID} to "{@hologramIDPrefix}_%{_hologramID}%" set block at {_randomLoc} to living horn coral plant set {hornCoralPlants::corals::%{_randomLoc}%} to {_hologramID} add 1 to y-loc of {_randomLoc} DHAPI.createHologram({_holoFullID}, {_randomLoc}, true) set {_hologram} to DHAPI.getHologram({_holoFullID}) set {_line} to "&6Kliknij aby mnie zebrać!" DHAPI.addHologramLine({_hologram}, {_line}) add {_hologramID} to {hornCoralPlants::hologramIDs::*} on block break: event-block is living horn coral plant {hornCoralPlants::corals::%location of event-block%} is set cancel event on right click: target block is living horn coral plant {hornCoralPlants::corals::%location of target block%} is set set {_blockLoc} to location of target block set target block to air set {_item} to living horn coral plant named "&6Rozgwiazda" with lore "&8» &7Waluta z &eEventu wakacyjnego &f(2024)" and "&8» &7Wymienisz ją na &fklucze &7pod &f/event" if player has space for {_item}: give {_item} to player else: drop {_item} at player set {_id} to {hornCoralPlants::corals::%{_blockLoc}%} set {_holoFullID} to "{@hologramIDPrefix}_%{_id}%" DHAPI.removeHologram({_holoFullID}) clear {hornCoralPlants::corals::%{_blockLoc}%} remove {_id} from {hornCoralPlants::hologramIDs::*} send "&aZebrałeś rozgwiazdę!" to player command /coralsclear: permission: server.command.coralsclear trigger: loop {hornCoralPlants::hologramIDs::*}: set {_holoFullID} to "{@hologramIDPrefix}_%loop-value%" DHAPI.removeHologram({_holoFullID}) clear {hornCoralPlants::hologramIDs::*} clear {hornCoralPlants::corals::*} send "&aWyczyszczono wszystkie zmienne związane z koralowcami." to sender