########################################### # Made by Smellyonionman for Smellycraft. # # onion@smellycraft.com # # Tested on Denizen-1.1.4-b4664-DEV # # Version 1.2.3 # #-----------------------------------------# # Updates and notes are found at: # # https://smellycraft.com/denizen # #-----------------------------------------# # You may use, modify or share this # # script, provided you don't remove # # or alter lines 1-13 of this file. # ########################################### sc_common_init: type: task debug: false script: - define namespace:sc_common - define admin:> - define targets:]].include[].deduplicate||> - define filename: - if ]||false>: - if : - ~yaml unload id:sc_common - ~yaml load:../Smellycraft/<[filename]> id:sc_common - else: - ~yaml create id:sc_common - define payload: - if <[payload].matches[false]>: - ~webget https://raw.githubusercontent.com/smellyonionman/smellycraft/master/configs/common.yml save:sc_raw headers:host/smellycraft.com:443|user-agent/smellycraft - define payload: - ~yaml loadtext:<[payload]> id:sc_common - yaml set type:! id:sc_common - ~yaml savefile:../Smellycraft/<[filename]> id:sc_common - if : - ~yaml load:../Smellycraft/schedules.yml id:sc_schedules - else: - ~yaml create id:sc_schedules - ~yaml savefile:../Smellycraft/schedules.yml id:sc_schedules - foreach : - adjust linked_player:]> - if .yml].not>: - yaml create id:sc_ - else: - yaml load:../Smellycraft/playerdata/.yml id:sc_ - if : - yaml create id:sc_cache - if : - yaml create id:sc_pcache - define feedback:> - inject >]> sc_common_cmd: type: command debug: false name: smellycraft description: usage: /smellycraft tab complete: - if ]> || || : - define args1:!|:reload|update|set - if : - determine <[args1]||> - else if : #If half a word, partial matches from tier 1 #If word complete, all from tier 2 - determine <[args1].filter[starts_with[]]||> - else if : - if : - determine ]]||> - else if : - if : - if : - determine ]]||> - else if : - determine ]]||> - else if : - if : - if : - if : - determine ]]||> - else if : - determine ]]||> script: - define namespace:sc_common - define admin:> - if : - if : - if ]||false> || || : - define arg: - inject - else if : - define placeholder:> - define feedback:].replace[[args]].with[<setting>&sp(<subsetting>)&sp<state>]> - else: - define placeholder:> - define feedback:<[placeholder].replace[[args]].with[]> - else if : - if : - define placeholder:> - define feedback:]> - else: - define placeholder:> - define feedback:<[placeholder].replace[[args]].with[]> - else if : - if : - if : - if : - if ]||false> || || : - yaml set settings.: id:sc_common - define placeholder:> - define feedback:<[placeholder].replace[[setting]].with[].replace[[state]].with[]> - else: - define feedback:> - else: - define feedback:> - else if : - if : - define arg: - yaml set settings.:<[arg]> id:sc_common - define placeholder:> - define feedback:<[placeholder].replace[[setting]].with[].replace[[state]].with[].pass[&c].fail[&a]><[arg]>]> - else: - define placeholder:> - define feedback:<[placeholder].replace[[args]].with[]> - else: - define placeholder:> - define feedback:<[placeholder].replace[[args]].with[]> - else: - define placeholder:> - define feedback:<[placeholder].replace[[args]].with[]> - if <[feedback].exists>: - inject >]> sc_common_datacmd: type: task debug: false definitions: namespace script: - if <[arg].exists||false>: - inject _data].yaml_key[scripts.<[arg]>]>]> - stop sc_common_update: type: task debug: false definitions: namespace|silent script: - if <[namespace].exists||false>: - ~webget https://smellycraft.com/denizen/update save:sc_versions headers:host/smellycraft.com:443|user-agent/smellycraft - define feedback:! - if : - define feedback:> - else: - ~yaml loadtext: id:sc_versions - define local:!|:_data].yaml_key[version].split[.]||0> - define remote:!|:.version].split[.]||-1> - foreach <[remote]||null>: - if <[value].is[MORE].than[<[local].get[<[loop_index]>]||0>]>: - define new:true - foreach stop - if <[new]||false>: - define placeholder:> - define feedback:<[placeholder].replace[[version]].with[<[remote].separated_by[.]>].replace[[url]].with[.url]>]> - else: - define feedback:> - if <[feedback].exists> && <[silent].exists.not>: - inject >]> - if : - ~yaml unload id:sc_versions sc_common_save: type: task debug: false definitions: namespace script: - if <[namespace].exists||false>: - if ]||false>: - yaml savefile:../Smellycraft/_data].yaml_key[filename]> id:<[namespace]> - if <[namespace].matches[sc_common]>: - if : - yaml savefile:../Smellycraft/schedules.yml id:sc_schedules - define feedback:> - if <[feedback].exists> && <[silent].exists.not>: - inject ].read[scripts.narrator]||_defaults].yaml_key[scripts.narrator]||sc_common_feedback>>]> - define feedback:! ##################################### # FEEDBACK: NARRATE OR ACTIONBAR? # ##################################### sc_common_feedback: type: task debug: false definitions: namespace|feedback|targets script: - if <[targets].exists.not>: - define targets: - if <[targets].matches[null]> || <[namespace].matches[null]> || <[feedback].matches[null]>: - stop - define prefix:].read[messages.prefix]||_defaults].yaml_key[messages.prefix]||&9&lb&aSmelly&2craft&9&rb]>> - if : - if : - define men_of_talk:!|:<[targets]> - else: - define men_of_action:!|:<[targets]> - else: - foreach <[targets]>: - if ].read[smellycraft.options.feedback].matches[chat|narrate]||true>: - define men_of_talk:|:<[value].as_player> - else: - define men_of_action:|:<[value].as_player> - if <[men_of_talk].exists>: - narrate &sp].separated_by[&sp]||&cError>].unescaped.parse_color.parsed> targets:<[men_of_talk]> - if <[men_of_action].exists>: - foreach <[feedback]>: - actionbar ].unescaped.parse_color.parsed> targets:<[men_of_action]> - wait >]> - define feedback:! ##################################### # MARQUEE: ANIMATED MENU TITLE TEXT # ##################################### sc_common_marquee: type: task debug: false definitions: title|wait|inv script: - repeat <[title].size>: - inventory open d:in@generic[size=>;contents=null;title=<[title].get[<[value]>].unescaped.parse_color>] - wait >>]> - define title:! - inventory open d:> sc_common_listener: type: world debug: false events: on reload scripts: - if : - inject on server start priority:-1: - inject on player join: - if ].not>: - if .yml]>: - ~yaml load:../Smellycraft/playerdata/.yml id:sc_ - else: - ~yaml create id:sc_ on player quits: - if ]>: - yaml savefile:../Smellycraft/playerdata/.yml id:sc_ - yaml unload id:sc_ - yaml set :! id:sc_pcache on shutdown: - define namespace:sc_common - inject on delta time hourly: - define namespace:sc_common - define silent:true - inject - foreach : - if ]>: - ~yaml savefile:../Smellycraft/playerdata/<[value].uuid>.yml id:sc_<[value].uuid> - if : - inject >]> sc_common_data: type: yaml data version: 1.2.3 filename: common.yml scripts: reload: sc_common_init save: sc_common_save update: sc_common_update sc_common_defaults: type: yaml data settings: update: true feedback: custom readingtime: 1.5s scripts: narrator: sc_common_feedback GUI: sc_common_marquee permissions: admin: smellycraft.admin messages: prefix: '&9[&aSmellycraft&9]' permission: '&cYou don''t have permission.' description: 'Global settings for Smellycraft plugins.' admin: saved: '&9Data was saved.' reload: '&9Common files have been reloaded.' set: '&a[setting] &9has been set to [state]&9.' args_m: '&cMissing arguments: [args]' args_i: '&cInvalid arguments: [args]' boolean: '&cPlease specify true or false.' disabled: '&cPlugin is currently disabled.' ingame: '&cThis command may only be used in-game.' update: notice: '&9Version &6[version] &9available at &a[url]' uptodate: '&9No new version available.' failed: - '&cVersion could not be checked.' - '&9Try visiting the repository:' - '&ahttps://smellycraft.com/denizen' enabled: '&aUpdates enabled.' enabled-no: '&9Updates are already enabled.' disabled: '&cUpdates disabled.' disabled-no: '&9Updates are already disabled.' specify: '&cPlease specify enable or disable.'