@@ -14,7 +14,7 @@ dmodels_command:
1414 type : command
1515 debug : false
1616 name : dmodels
17- usage : /dmodels [load/loadall/spawn/remove/animate/stopanimate/npcmodel]
17+ usage : /dmodels [load/loadall/spawn/remove/animate/stopanimate/npcmodel/unload/unloadall ]
1818 description : Manages Denizen Models.
1919 permission : dmodels.help
2020 tab completions :
@@ -61,6 +61,29 @@ dmodels_command:
6161 - debug log "[DModels] <&[emphasis] ><player.name||server> <&[base] > is loading <[files] .size.custom_color[emphasis] > model files: <[files] .formatted.custom_color[emphasis] > "
6262 - ~run dmodels_multi_load def.list:<[files] >
6363 - narrate <&[base] > Done!
64+ - case unload:
65+ - if !<player.has_permission[dmodels.unload] > :
66+ - narrate "<&[error] > You do not have permission for that."
67+ - stop
68+ - if !<context.args.get[2] .exists> :
69+ - narrate "<&[warning] > /dmodels unload [model] <&[error] > - unloads a model's data from memory."
70+ - stop
71+ - define model <context.args.get[2] >
72+ - if !<[model] .to_lowercase.matches_character_set[<script[dmodels_cmd_data] .data_key[valid_chars] > ] > :
73+ - narrate "<&[error] > Given model name has an invalid format."
74+ - stop
75+ - if !<server.has_flag[dmodels_data.model_<[model] > ] > :
76+ - narrate "<&[error] > No such model exists, or that model has never been loaded."
77+ - stop
78+ - flag server dmodels_data.model_<[model] > :!
79+ - flag server dmodels_data.animations_<[model] > :!
80+ - narrate "<&[base] > Removed model <[model] .custom_color[emphasis] > from memory."
81+ - case unloadall:
82+ - if !<player.has_permission[dmodels.unloadall] > :
83+ - narrate "<&[error] > You do not have permission for that."
84+ - stop
85+ - flag server dmodels_data:!
86+ - narrate "<&[base] > Removed all DModels data from meory."
6487 - case spawn:
6588 - if !<player.has_permission[dmodels.spawn] > :
6689 - narrate "<&[error] > You do not have permission for that."
@@ -154,6 +177,10 @@ dmodels_command:
154177 - narrate "<&[warning] > /dmodels load [path] <&[error] > - loads a model from file based on filename"
155178 - if <player.has_permission[dmodels.loadall] ||true> :
156179 - narrate "<&[warning] > /dmodels loadall <&[error] > - loads all models in the source folder"
180+ - if <player.has_permission[dmodels.unload] ||true> :
181+ - narrate "<&[warning] > /dmodels unload [model] <&[error] > - unloads a specific model from memory"
182+ - if <player.has_permission[dmodels.unloadall] ||true> :
183+ - narrate "<&[warning] > /dmodels unloadall <&[error] > - unloads all DModels data from memory"
157184 - if <player.has_permission[dmodels.spawn] ||true> :
158185 - narrate "<&[warning] > /dmodels spawn [model] <&[error] > - spawns a model at your position (must be loaded)"
159186 - if <player.has_permission[dmodels.remove] ||true> :
@@ -180,8 +207,8 @@ dmodels_tab_1:
180207 debug : false
181208 script :
182209 - define list <list>
183- - foreach load|loadall|spawn|remove|animate|stopanimate|npcmodel|help as:key:
184- - if <player.has_permission[<[key] > ] ||true> :
210+ - foreach load|loadall|spawn|remove|animate|stopanimate|npcmodel|help|unload|unloadall as:key:
211+ - if <player.has_permission[dmodels. <[key] > ] ||true> :
185212 - define list:->:<[key] >
186213 - determine <[list] >
187214
0 commit comments