From 14c529a595de8da63b5e4bcab83d4337819698de Mon Sep 17 00:00:00 2001 From: Struchkov Mark Date: Wed, 29 Mar 2023 01:18:41 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B8=D0=BB=20=D0=B4?= =?UTF-8?q?=D0=B5=D1=84=D0=BE=D0=BB=D1=82=D0=BD=D1=83=D1=8E=20=D0=BA=D0=BB?= =?UTF-8?q?=D0=B0=D0=B2=D0=B8=D0=B0=D1=82=D1=83=D1=80=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../godfather/simple/core/GeneralAutoResponder.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/GeneralAutoResponder.java b/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/GeneralAutoResponder.java index fa0174d..3fdf20e 100644 --- a/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/GeneralAutoResponder.java +++ b/bot-core/bot-core-simple/src/main/java/dev/struchkov/godfather/simple/core/GeneralAutoResponder.java @@ -14,6 +14,7 @@ import dev.struchkov.haiti.context.exception.NotFoundException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -51,7 +52,8 @@ public class GeneralAutoResponder { } public void registrationActionUnit(ActionUnit actionUnit) { - actionUnitMap.computeIfAbsent(actionUnit.getUnitType(), k -> new HashMap<>()).putIfAbsent(actionUnit.getMessageType(), actionUnit); + actionUnitMap.computeIfAbsent(actionUnit.getUnitType(), k -> new ArrayList<>()); + actionUnitMap.get(actionUnit.getUnitType()).add(actionUnit); } /** @@ -132,7 +134,7 @@ public class GeneralAutoResponder { return accessibility.isEmpty() || accessibility.get().check(message); } - public void answer(UnitRequest, M> unitRequest) { + public void answer(UnitRequest unitRequest) { if (checkNotNull(errorHandler)) { try { unitRequest = getAction(unitRequest); @@ -146,7 +148,7 @@ public class GeneralAutoResponder { } } - private UnitRequest, M> activeUnitAfter(UnitRequest, M> unitRequest) { + private UnitRequest activeUnitAfter(UnitRequest unitRequest) { final Set> nextUnits = unitRequest.getUnit().getNextUnits(); if (checkNotNull(nextUnits)) { Optional> first = nextUnits.stream()