options: Noperms: &cYou do not have permission to that command! #===============================================================================# import: java.util.Arrays org.bukkit.event.server.TabCompleteEvent #===============================================================================# effect set completions to %strings% at %string%: trigger: if expression-2 is "": event.setCompletions(Arrays.asList(expressions-1)) else: set {_completions::*} to expressions-1 loop expression-2.length() times: loop {_completions::*}: if {_completions::%loop-index%}.substring(loop-number - 1, and loop-number) isn't expression-2.substring(loop-number - 1, and loop-number): clear {_completions::%loop-index%} event.setCompletions(Arrays.asList({_completions::*})) #===============================================================================# expression tabbed command: get: set {_text} to first element out of split event.getBuffer() at " " return "/%{_text}%" if event.getSender() is CONSOLE else {_text} #===============================================================================# expression tab arg[ument]( |-)%*number%: get: set {_l::*} to split event.getBuffer() at " " clear {_l::1} set {_l::*} to {_l::*} return {_l::%expr 1%} #===============================================================================# expression buffer: get: return event.getBuffer() #===============================================================================# on TabCompleteEvent: if tabbed command is "/npcsk": if tab arg 2 isn't set: set completions to "reload" or "info" at tab arg 1 on join: set {%player%.npc-use} to now on right click: if event-entity is a citizen: set {_t} to name of event-entity replace all "ยง" with "&" in {_t} NPCFile({_t}, player) if player is sneaking: if {debug.mode.npc} is true: set {NPC::Debug-Alert::*} to {NPC::Debug-Alert} split at "[NPC NAME]" send "%{NPC::Debug-Alert::1}%&e%{_t}%%{NPC::Debug-Alert::2}%" to player if file "plugins/iCodeDevelopment/NPCS/NPC-Data/%{_t}%.json" is missing: send "&cNPC File not Found!" to player stop else: send "&aNPC File Found!" to player set {_contents::*} to file contents of "plugins/iCodeDevelopment/NPCS/NPC-Data/%{_t}%.json" set {_content} to concat {_contents::*} with nl send {_content} to player function NPCFile(file: text, p: player): if file "plugins/iCodeDevelopment/NPCS/NPC-Data/%{_file}%.json" is missing: stop else: if difference between now and {%{_p}%.npc-use} is greater than or equal to 5 seconds: set {%{_p}%.npc-use} to now set {_contents::*} to file contents of "plugins/iCodeDevelopment/NPCS/NPC-Data/%{_file}%.json" set {_content} to concat {_contents::*} with nl set {_input} to {_content} copy json {_input} to {_output::*} set {_name} to {_output::Name} set {_chatcolor} to colored {_output::ChatColor} set {_messages::*} to {_output::Messages::*} if {_messages::*} is not "": loop {_messages::*}: set {_msg} to loop-value replace all "[PLAYER]" with "%{_p}%" in {_msg} set {_message} to {NPC::Message Format} replace all "[CHAT COLOR]" with {_chatcolor} in {_message} replace all "[NPC NAME]" with {_name} in {_message} replace all "[MESSAGE]" with {_msg} in {_message} add {_message} to {_messages-npc::*} set {_commands::*} to {_output::Commands::*} if {_messages::*} is not "": loop {_messages-npc::*}: send formatted loop-value to {_p} wait {NPC::Message Delay} if {_commands::*} is not "": loop {_commands::*}: set {_cmd} to loop-value replace all "[PLAYER]" with "%{_p}%" in {_cmd} make {_p} run command "%{_cmd}%" as op else: set {_time} to 5 seconds set {_dif} to difference between now and {%{_p}%.npc-use} remove {_dif} from {_time} send "&7You must wait &e%{_time}% &7before performing that action!" to {_p} command npcsk [] []: usage: /npcsk [Reload / Info] permission: command.npcsk permission message: {@Noperms} executable by: players and console trigger: if arg-1 is set: if player has permission "command.npcsk": if arg-1 is "Reload": if file "plugins/iCodeDevelopment" is missing: create directory "plugins/iCodeDevelopment/" if file "plugins/iCodeDevelopment/NPCS" is missing: create directory "plugins/iCodeDevelopment/NPCS" if file "plugins/iCodeDevelopment/NPCS/NPC-Data" is missing: create directory "plugins/iCodeDevelopment/NPCS/NPC-Data" if {ServerID} is not set: set {ServerID} to random 20 char string from charset `a-zA-Z0-9` if file "plugins/iCodeDevelopment/NPCS/config.json" is missing: download file from "https://raw.githubusercontent.com/iCodeDreamsMC/NPCS/master/config.json" to file "plugins/iCodeDevelopment/NPCS/config.json" wait 2 ticks set line 3 in file "plugins/iCodeDevelopment/NPCS/config.json" to " ""Version"": ""1.0""," set line 4 in file "plugins/iCodeDevelopment/NPCS/config.json" to " ""ServerID"": ""%{ServerID}%""," set {_contents::*} to file contents of "plugins/iCodeDevelopment/NPCS/config.json" set {_content} to concat {_contents::*} with nl set {_input} to {_content} copy json {_input} to {_output::*} set {NPC::Prefix} to colored {_output::Prefix} set {NPC::Version} to {_output::Version} set {NPC::ServerID} to {_output::ServerID} set {NPC::AdminID} to {_output::AdminID} set {NPC::Debug} to {_output::Debug} if {NPC::Debug} is true: set {debug.mode.npc} to true if {NPC::Debug} is false: set {debug.mode.npc} to false set {NPC::Message Format} to {_output::NPC Message Format} set {NPC::Message Delay} to "%{_output::Message Delay}% seconds" parsed as timespan set {NPC::Reload-Message} to colored {_output::Messages::Reload} set {NPC::Debug-Alert} to colored {_output::Messages::Debug Alert} send "%{NPC::Prefix}%%{NPC::Reload-Message}%" to player send "%{NPC::Prefix}%%{NPC::Reload-Message}%" to console if arg-1 is "Info": set {_contents1::*} to contents from url "https://raw.githubusercontent.com/iCodeDreamsMC/NPCS/master/api.json" set {_content1} to concat {_contents1::*} with nl set {_input1} to {_content1} copy json {_input1} to {_output1::*} set {_output1::LatestVersion} to {_output1::LatestVersion} send "&a&m&l======================&2&m&l======================" send "" send " &2&lNPC &a&lSKRIPT" send " &8Created by: %{_output1::Author}%" send "" send " &7Server: &r%bukkit version% (%skript version%)" if {_output1::LatestVersion} = {NPC::Version}: send " &7Version: &r%{NPC::Version}%" else: send " &7Version: &r%{NPC::Version}% &c&lOUTDATED! &8(New Version %{_output1::LatestVersion}%&8)" send "" send "&2&m&l======================&a&m&l======================" else if arg-1 is not "Reload" or "Info": send "&c[Error] &7Correct Usage: &e/npcsk [Reload / Info]" else: send "&cYou do not have permission to run this command!" else: send "&c[Error] &7Correct Usage: &e/npcsk [Reload / Info]"