Skip to content

Commit 36e0057

Browse files
committed
Revert "moved manager utils into companion object in reuqest handler"
This reverts commit f12aab3.
1 parent f12aab3 commit 36e0057

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2025 Lambda
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
package com.lambda.interaction.request
19+
20+
import com.lambda.util.reflections.getInstances
21+
22+
object ManagerUtils {
23+
val managers = getInstances<RequestHandler<*>>()
24+
val accumulatedManagerPriority = managers.map { it.stagePriority }.reduce { acc, priority -> acc + priority }
25+
}

common/src/main/kotlin/com/lambda/interaction/request/RequestHandler.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import com.lambda.core.Loadable
2222
import com.lambda.event.Event
2323
import com.lambda.event.events.TickEvent
2424
import com.lambda.event.listener.SafeListener.Companion.listen
25+
import com.lambda.interaction.request.ManagerUtils.accumulatedManagerPriority
2526
import com.lambda.threading.runSafe
26-
import com.lambda.util.reflections.getInstances
2727
import kotlin.reflect.KClass
2828

2929
/**
@@ -119,9 +119,4 @@ abstract class RequestHandler<R : Request>(
119119
abstract fun SafeContext.handleRequest(request: R)
120120

121121
protected abstract fun preEvent(): Event
122-
123-
companion object {
124-
val managers = getInstances<RequestHandler<*>>()
125-
val accumulatedManagerPriority = managers.map { it.stagePriority }.reduce { acc, priority -> acc + priority }
126-
}
127122
}

0 commit comments

Comments
 (0)