on load: if file "plugins/KLimits/config.yml" doesn't exists: send "&cNie znaleziono pliki konfiguracyjnego." to console create file "plugins/KLimits/config.yml" wait a tick download from "https://pastebin.com/raw/vey0E8GJ" to "plugins/KLimits/config.yml" send "&aStworzono plik konfiguracyjny." to console set {tags} to yml value "tag" of file "plugins/KLimits/config.yml" set {move} to yml value "events.anymove" of file "plugins/KLimits/config.yml" set {every} to yml value "events.everyseconds" of file "plugins/KLimits/config.yml" set {inventory} to yml value "events.inventoryclose" of file "plugins/KLimits/config.yml" command /schowek []: trigger: if arg 1 is not set: set {_x::*} to configuration section "limits" get of "plugins/KLimits/config.yml" set {_num} to 0 open chest with 3 rows named "&7Limity: " to player loop {_x::*}: set {_k} to loop-value set {_z} to yml value "limits.%{_k}%.player.max" of file "plugins/KLimits/config.yml" set {_v} to yml value "limits.%{_k}%.vip.max" of file "plugins/KLimits/config.yml" set {_item} to {_k} parsed as item replace all "" with "0" in {%{_k}%::%player%} format slot {_num} of player with 1 of {_item} named "&3%loop-value%" with lore "&aPosiadasz: &c%{%{_k}%::%player%}%||&aLimit: || &aVip: &c%{_v}%|| &aplayer: &c%{_z}%" to close then run [execute player command "schowek %{_k}%"] add 1 to {_num} if arg 1 is set: if {%arg 1%::%player%} is "": set {_wiad} to yml value "message.schowekbrakitemow" of file "plugins/KLimits/config.yml" send "%{tags}% %{_wiad}%" else: set {_t} to arg 1 parsed as item set {_x} to amount of {_t} in player's inventory set {_z} to yml value "limits.%arg 1%.vip.permission" of file "plugins/KLimits/config.yml" if player has permission "%{_z}%": set {_p} to yml value "limits.%arg 1%.vip.max" of file "plugins/KLimits/config.yml" else: set {_p} to yml value "limits.%arg 1%.player.max" of file "plugins/KLimits/config.yml" set {_b} to {_x}-{_p} if {%arg 1%::%player%} >= {_b}: loop {_b} times: if {%arg 1%::%player%} >= 1: give player {_t} remove 1 from {%arg 1%::%player%} else: send "&cERROR." else: if {%arg 1%::%player%} > 0: loop {%arg 1%::%player%} times: give player {_t} set {%arg 1%::%player%} to 0 else: set {_wiad} to yml value "message.schowekbrakitemow" of file "plugins/KLimits/config.yml" send "%{tags}% %{_wiad}%" on anymove: if {move} is "true": set {_x::*} to configuration section "limits" get of "plugins/KLimits/config.yml" loop {_x::*}: set {_z} to yml value "limits.%loop-value%.vip.permission" of file "plugins/KLimits/config.yml" if player has permission "%{_z}%": set {_p} to yml value "limits.%loop-value%.vip.max" of file "plugins/KLimits/config.yml" else: set {_p} to yml value "limits.%loop-value%.player.max" of file "plugins/KLimits/config.yml" set {_i} to amount of loop-value in player's inventory if {_i} > {_p}: set {_k} to {_i}-{_p} loop {_k} times: remove loop-value-1 from player's inventory add 1 to {%loop-value-1%::%player%} set {_wiad} to yml value "message.maszzaduzo" of file "plugins/KLimits/config.yml" set {_o} to yml value "limits.%loop-value%.name" of file "plugins/KLimits/config.yml" replace all "{NAME}" with "%{_o}%" in {_wiad} replace all "{MAX}" with "%{_p}%" in {_wiad} replace all "{HAVE}" with "%{_i}%" in {_wiad} send "%{_wiad}%" on inventory close: if {inventory} is "true": set {_x::*} to configuration section "limits" get of "plugins/KLimits/config.yml" loop {_x::*}: set {_z} to yml value "limits.%loop-value%.vip.permission" of file "plugins/KLimits/config.yml" if player has permission "%{_z}%": set {_p} to yml value "limits.%loop-value%.vip.max" of file "plugins/KLimits/config.yml" else: set {_p} to yml value "limits.%loop-value%.player.max" of file "plugins/KLimits/config.yml" set {_i} to amount of loop-value in player's inventory if {_i} > {_p}: set {_k} to {_i}-{_p} loop {_k} times: remove loop-value-1 from player's inventory add 1 to {%loop-value-1%::%player%} set {_wiad} to yml value "message.maszzaduzo" of file "plugins/KLimits/config.yml" set {_o} to yml value "limits.%loop-value%.name" of file "plugins/KLimits/config.yml" replace all "{NAME}" with "%{_o}%" in {_wiad} replace all "{MAX}" with "%{_p}%" in {_wiad} replace all "{HAVE}" with "%{_i}%" in {_wiad} send "%{_wiad}%" every 20 tick: if {every} is "true": loop all players: set {_x::*} to configuration section "limits" get of "plugins/KLimits/config.yml" loop {_x::*}: set {_z} to yml value "limits.%loop-value-2%.vip.permission" of file "plugins/KLimits/config.yml" if loop-player has permission "%{_z}%": set {_p} to yml value "limits.%loop-value-2%.vip.max" of file "plugins/KLimits/config.yml" else: set {_p} to yml value "limits.%loop-value-2%.player.max" of file "plugins/KLimits/config.yml" set {_i} to amount of loop-value-2 in loop-player's inventory if {_i} > {_p}: set {_k} to {_i}-{_p} loop {_k} times: remove loop-value-2 from loop-player's inventory add 1 to {%loop-value-2%::%loop-player%} set {_wiad} to yml value "message.maszzaduzo" of file "plugins/KLimits/config.yml" set {_o} to yml value "limits.%loop-value-2%.name" of file "plugins/KLimits/config.yml" replace all "{NAME}" with "%{_o}%" in {_wiad} replace all "{MAX}" with "%{_p}%" in {_wiad} replace all "{HAVE}" with "%{_i}%" in {_wiad} send "%{_wiad}%" to loop-player