Skip to content

Commit

Permalink
fixed ensure_plugin_installed
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan-1F committed Jun 30, 2024
1 parent a051081 commit 3b8e1bf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mcdreforged_plugin_manager/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ def ensure_plugin_installed(func: Callable):
A decorator that ensures the plugin id(s) in the function parameter is installed
"""
@functools.wraps(func)
def wrapper(source: CommandSource, plugin_id: Union[str, List[str]], *args, **kwargs):
plugin_ids = [plugin_id] if isinstance(plugin_id, str) else plugin_id
def wrapper(source: CommandSource, plugin_id_input: Union[str, List[str]], *args, **kwargs):
plugin_ids = [plugin_id_input] if isinstance(plugin_id_input, str) else plugin_id_input
for plugin_id in plugin_ids:
if not is_plugin_loaded(plugin_id):
source.reply(tr('plugin.not_installed', plugin_id))
return
func(source, plugin_ids, *args, **kwargs)
func(source, plugin_id_input, *args, **kwargs)

return wrapper

Expand Down

0 comments on commit 3b8e1bf

Please sign in to comment.