options: Path: plugins/RepairPlus on load: if folder "{@Path}/" doesn't exists: create folder "{@Path}/" if file "{@Path}/config.yml" doesn't exist: create file "{@Path}/config.yml" wf "##" to "{@Path}/config.yml" wf "## --------------" to "{@Path}/config.yml" wf "##" to "{@Path}/config.yml" wf "## RepairPlus Config" to "{@Path}/config.yml" wf "##" to "{@Path}/config.yml" wf "## Please use § instead of & in this config." to "{@Path}/config.yml" wf "## You are not allowed to resell this skript." to "{@Path}/config.yml" wf "## Copyright: KamillPlayZ" to "{@Path}/config.yml" wf "## --------------" to "{@Path}/config.yml" wf "##" to "{@Path}/config.yml" wf "filename: 'repairplus.sk'" to "{@Path}/config.yml" wf "permission: 'repairplus.use'" to "{@Path}/config.yml" wf "## Messages" to "{@Path}/config.yml" wf "prefix: '&a&lRepair &8» &f'" to "{@Path}/config.yml" wf "" to "{@Path}/config.yml" wf "gui-title: '&e&lRepair'" to "{@Path}/config.yml" wf "" to "{@Path}/config.yml" wf "confirm-title: '&aConfirm'" to "{@Path}/config.yml" wf "confirm-lore:" to "{@Path}/config.yml" wf "- ' &7If you are sure about &a&nrepairing&7 your'" to "{@Path}/config.yml" wf "- ' &7armor please click here.'" to "{@Path}/config.yml" wf "- ''" to "{@Path}/config.yml" wf "- ' &cNote: &7only the enchants matter while'" to "{@Path}/config.yml" wf "- ' &7repairing, the durability doesn''t.'" to "{@Path}/config.yml" wf "" to "{@Path}/config.yml" wf "cancel-title: '&cCancel'" to "{@Path}/config.yml" wf "cancel-lore:" to "{@Path}/config.yml" wf "- ' &7If you''d like to &c&ncancel&7 the repairing'" to "{@Path}/config.yml" wf "- ' &7please click here, or press escape.'" to "{@Path}/config.yml" wf "## Put the placeholder %%price%% where you want the price display to be" to "{@Path}/config.yml" wf "price-title: '&aWhat does it cost?'" to "{@Path}/config.yml" wf "price-lore:" to "{@Path}/config.yml" wf "- ' &7Repairing this item costs: &a&n$%%price%%&7.'" to "{@Path}/config.yml" wf "- ' &7Please click &a&nconfirm&7 if you''d like to proceed.'" to "{@Path}/config.yml" wf "## The base price for each level of enchant on a tool" to "{@Path}/config.yml" wf "price: 5000" to "{@Path}/config.yml" wf "## The price multiplier for each level of enchant there's on an item" to "{@Path}/config.yml" wf "price-multiplier: 0.1" to "{@Path}/config.yml" wf "" to "{@Path}/config.yml" wf "not-enough-money: '&cYou don''t have enough money!'" to "{@Path}/config.yml" wf "" to "{@Path}/config.yml" wf "successful-repair: '&aYour repair was successful!'" to "{@Path}/config.yml" wf "## Message when you cancel the repair" to "{@Path}/config.yml" wf "cancelled: '&cYou cancelled the repair!'" to "{@Path}/config.yml" wf "noperm: '&cYou don''t have permission for this!'" to "{@Path}/config.yml" wf "" to "{@Path}/config.yml" wf "## Items" to "{@Path}/config.yml" wf "price-item: anvil" to "{@Path}/config.yml" wf "confirm-item: lime stained glass pane" to "{@Path}/config.yml" wf "cancel-item: red stained glass pane" to "{@Path}/config.yml" set {repairplus::prefix} to yaml value "prefix" from file "{@Path}/config.yml" set {repairplus::gui-title} to yaml value "gui-title" from file "{@Path}/config.yml" set {repairplus::confirm-title} to yaml value "confirm-title" from file "{@Path}/config.yml" set {repairplus::cancel-title} to yaml value "cancel-title" from file "{@Path}/config.yml" set {repairplus::price-title} to yaml value "price-title" from file "{@Path}/config.yml" set {repairplus::confirm-lore::*} to yaml list "confirm-lore" from file "{@Path}/config.yml" set {repairplus::cancel-lore::*} to yaml list "cancel-lore" from file "{@Path}/config.yml" set {repairplus::price-lore::*} to yaml list "price-lore" from file "{@Path}/config.yml" set {repairplus::price} to yaml value "price" from file "{@Path}/config.yml" set {repairplus::price-multiplier} to yaml value "price-multiplier" from file "{@Path}/config.yml" set {repairplus::not-enough-money} to yaml value "not-enough-money" from file "{@Path}/config.yml" set {repairplus::successful-repair} to yaml value "successful-repair" from file "{@Path}/config.yml" set {repairplus::cancelled} to yaml value "cancelled" from file "{@Path}/config.yml" set {repairplus::noperm} to yaml value "noperm" from file "{@Path}/config.yml" set {repairplus::permission} to yaml value "permission" from file "{@Path}/config.yml" set {repairplus::price-item} to yaml value "price-item" from file "{@Path}/config.yml" set {repairplus::confirm-item} to yaml value "confirm-item" from file "{@Path}/config.yml" set {repairplus::cancel-item} to yaml value "cancel-item" from file "{@Path}/config.yml" set {repairplus::filename} to yaml value "filename" from file "{@Path}/config.yml" set {repairplus::price-item} to {repairplus::price-item} parsed as a material set {repairplus::confirm-item} to {repairplus::confirm-item} parsed as a material set {repairplus::cancel-item} to {repairplus::cancel-item} parsed as a material function numFormat(integer: text) :: text: return regex replace "(?<=\d)(?=(\d\d\d)+(?!\d))" with "," in {_integer} function repair(i: item, p: player): loop enchantments of {_i}: add level of loop-enchantment of {_i} to {_ps} set {_price} to ({_ps}*{repairplus::price})*({_ps}*{repairplus::price-multiplier}) set {_price2} to numFormat("%{_price}%") replace all "%%price%%" in {repairplus::price-title} with "%{_price2}%" replace all "%%price%%" in {repairplus::price-lore::*} with "%{_price2}%" create a gui with id "repairplus" with virtual chest with 3 rows named "%{repairplus::gui-title}%": loop 11 times: make next gui slot with gray stained glass pane named "" set {confirmitem} to {repairplus::confirm-item} named "%{repairplus::confirm-title}%" loop {repairplus::confirm-lore::*}: add loop-value to lore of {confirmitem} make gui slot 11 with {confirmitem}: if {_p}'s balance >= {_price}: repair tool of {_p} subtract {_price} from {_p}'s balance close inventory of {_p} message "%{repairplus::prefix}%%{repairplus::successful-repair}%" to {_p} else: message "%{repairplus::prefix}%%{repairplus::not-enough-money}%" to {_p} close inventory of {_p} make next gui slot with gray stained glass pane named "" set {priceitem} to {repairplus::price-item} named "%{repairplus::price-title}%" loop {repairplus::price-lore::*}: add loop-value to lore of {priceitem} make gui slot 13 with {priceitem} set {cancelitem} to {repairplus::cancel-item} named "%{repairplus::cancel-title}%" loop {repairplus::cancel-lore::*}: add loop-value to lore of {cancelitem} make gui slot 15 with {cancelitem}: message "%{repairplus::prefix}%%{repairplus::cancelled}%" to {_p} close inventory of {_p} loop 12 times: make next gui slot with gray stained glass pane named "" open gui "repairplus" to {_p} command /repair: trigger: if sender has permission "%{repairplus::permission}%": repair(player's held item, player) else: message "%{repairplus::prefix}%%{repairplus::noperm}%" command /repairplus: trigger: if sender is op: make console execute command "sk reload %{repairplus::filename}%" message "%{repairplus::prefix}%&aSuccessful reload!" to sender else if sender is console: make console execute command "sk reload %{repairplus::filename}%" message "%{repairplus::prefix}%&aSuccessful reload!" to sender else: message "%{repairplus::prefix}%%{repairplus::noperm}%" to sender on inventory click: if name of player's current inventory is "%{repairplus::gui-title}%": cancel event