From b83666a58412a97cb544ae78cb76dd1c34363d5f Mon Sep 17 00:00:00 2001 From: Gravit Date: Thu, 18 Oct 2018 21:48:44 +0700 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=BF=D1=80=D0=B5=D1=82=20=D0=B4?= =?UTF-8?q?=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B8?= =?UTF-8?q?=20=D1=83=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BE?= =?UTF-8?q?=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=87=D0=B8=D0=BA=D0=BE?= =?UTF-8?q?=D0=B2=20=D0=B2=D0=BE=20=D0=B2=D1=80=D0=B5=D0=BC=D1=8F=20=D0=B2?= =?UTF-8?q?=D0=BF=D1=8B=D0=BE=D0=BB=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/ru/gravit/utils/event/EventManager.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libLauncher/src/main/java/ru/gravit/utils/event/EventManager.java b/libLauncher/src/main/java/ru/gravit/utils/event/EventManager.java index 8e33afd6..2bc6446b 100644 --- a/libLauncher/src/main/java/ru/gravit/utils/event/EventManager.java +++ b/libLauncher/src/main/java/ru/gravit/utils/event/EventManager.java @@ -57,12 +57,14 @@ public synchronized void stop() public BlockingQueue queue = new LinkedBlockingQueue<>(QUEUE_MAX_SIZE); //Максимальный размер очереди public int registerHandler(EventHandler func, UUID[] events) { + if(isStarted.get()) throw new IllegalThreadStateException("It is forbidden to add a handler during thread operation."); Arrays.sort(events); handlers.add(new Entry(func,events)); return handlers.size(); } public void unregisterHandler(EventHandler func) { + if(isStarted.get()) throw new IllegalThreadStateException("It is forbidden to remove a handler during thread operation."); handlers.removeIf(e -> e.func.equals(func)); } public void sendEvent(UUID key, EventInterface event, boolean blocking)