options: ZakazaneMikstury: instant health, instant damage LimitEfektow: 3 PotionTime: short: 5 seconds long: 15 seconds command /setpotioncombineblock: permission: setpotioncombineblock.sk trigger: set {CombinePotionBlock::%location of targeted block%} to true send "&aPomyślnie ustawiono lokację!" on uncancelled break: if {CombinePotionBlock::%location of targeted block%} is set: clear {CombinePotionBlock::%location of targeted block%} on right click: if {CombinePotionBlock::%location of targeted block%} is set: cancel event PotionCombine(player, player's tool, air) function PotionCombine(p: player, item: item, potion: item) :: boolean: if {_item} is air: send "&cMusisz wziąć miecz do ręki, aby móc nałożyć na niego miksturę!" to {_p} return false stop if {_item} is not a weapon: send "&cMikstury możesz łączyć tylko z brońmi!" to {_p} return false stop remove {_item} from {_p} set {_x} to chest inventory named "&8Połącz miksturę z mieczem!" if {_potion} is air: set {_slot16} to barrier named "&cWybierz miksturę którą chcesz nadać na miecz!" else: set {_slot16} to {_potion} set slot 10 of {_x} to {_item} set slot 13 of {_x} to golden nugget named "&eKliknij, aby połączyć miecz z potką!" with lore "" and "&7Działa to w ten sposób, że przy" and "&7uderzaniu gracza, uderzony " and "&7gracz dostaje ustawiony/e efekty!" set slot 16 of {_x} to {_slot16} open {_x} to {_p} return true function SuccesCombine(p: player, weapon: item, potion: item): close {_p}'s inventory if lore of {_weapon} contains "&7» &bEfekt: %{_potion}%": send title "&cBłąd!" with subtitle "&7Ten item ma już nałozony ten efekt!" to {_p} give {_weapon} to {_p} give {_potion} to {_p} stop set {_lore::*} to lore of {_weapon} loop {_lore::*}: if loop-value contains "&7» &bEfekt: ": add 1 to {_x} if {_x} >= {@LimitEfektow}: send title "&cBłąd!" with subtitle "&7Niestety limit efektów to: {@LimitEfektow}!" to {_p} give {_weapon} to {_p} give {_potion} to {_p} stop send title "&7" with subtitle "&aPomyślnie nałożono efekt!" to {_p} add "&7» &bEfekt: %{_potion}%" to lore of {_weapon} give {_weapon} to {_p} on inventory click: if name of event-inventory is "&8Połącz miksturę z mieczem!": cancel event if event-inventory is not player's inventory: send {_item} if clicked slot is 13: if slot 16 of event-inventory is barrier: send "&cMusisz wybrać miksturę!" stop set slot 26 of event-inventory to stone SuccesCombine(player, slot 10 of event-inventory, slot 16 of event-inventory) else: clicked slot is not air if "%type of clicked slot%" parsed as item is not a potion: send "&cProszę wybrać poprawną miksturę!" to player stop set {_x::*} to {@ZakazaneMikstury} loop {_x::*}: set {_split::*} to replaceName("%type of clicked slot%") split at "." if "%{_split::1}%" contains "%loop-value%": send "&cNiestety ale ta mikstura jest niedozolona na mieczu!" stop set slot 26 of player's current inventory to stone PotionCombine(player, slot 10 of player's current inventory, type of clicked slot) remove clicked slot from player on inventory close: if name of event-inventory is "&8Połącz miksturę z mieczem!": if slot 26 of event-inventory is not stone: give slot 10 of event-inventory to player if slot 16 of event-inventory is not barrier: give slot 16 of event-inventory to player on damage: attacker is a player set {_lore::*} to lore of attacker's tool loop {_lore::*}: if loop-value contains "&7» &bEfekt: ": set {_loopValue} to colored loop-value replace all "&7» &bEfekt: " with "" in {_loopValue} set {_efekt} to uncolored {_loopValue} set {_efekt::*} to split replaceName("%{_efekt}%") at "." apply ({_efekt::1} parsed as potion effect type) of tier ({_efekt::2} parsed as number) to victim for ({_efekt::3} parsed as timespan) function replaceName(p: text) :: text: if {_p} contains "strong": set {_tier} to 2 else: set {_tier} to 1 if {_p} contains "long": set {_time} to {@PotionTime.long} else: set {_time} to {@PotionTime.short} replace all "potion of " with "" in {_p} replace all "strong " with "" in {_p} replace all "long " with "" in {_p} replace all "extended " with "" in {_p} replace all "turtle master" with "slowness" in {_p} replace all "harming" with "damage" in {_p} replace all "poisoning" with "poison" in {_p} replace all "leaping" with "jump boost" in {_p} set {_p} to "%{_p}%.%{_tier}%.%{_time}%" return {_p}