package valandur.webapi.command.hook;

import org.spongepowered.api.command.CommandException;
import org.spongepowered.api.command.CommandResult;
import org.spongepowered.api.command.CommandSource;
import org.spongepowered.api.command.args.CommandContext;
import org.spongepowered.api.command.spec.CommandExecutor;
import valandur.webapi.WebAPI;
import valandur.webapi.hook.CommandWebHook;
import valandur.webapi.hook.WebHookParam;

import java.util.LinkedHashMap;
import java.util.Map;

public class CmdNotifyHook implements CommandExecutor {

    private CommandWebHook cmdHook;

    public CmdNotifyHook(CommandWebHook cmdHook) {
        this.cmdHook = cmdHook;
    }

    @Override
    public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
        Map<String, Object> data = new LinkedHashMap<>();
        for (WebHookParam param : cmdHook.getParams()) {
            data.put(param.getName(), param.getValue(args).orElse(null));
        }

        WebAPI.getWebHookService().notifyHook(cmdHook, src.getIdentifier(), data);

        return CommandResult.success();
    }
}

@@ -832,24 +832,99 @@
 ashMap%3C%3E();%0A
+        data.put(%22source%22, WebAPI.getCacheService().asCachedObject(src));%0A%0A
         for 

Add source to notify hooks