We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 873a84f commit 67f0001Copy full SHA for 67f0001
1 file changed
src/main/kotlin/com/lambda/util/OneSetPerTick.kt
@@ -35,7 +35,10 @@ class OneSetPerTick<T>(
35
private set
36
37
init {
38
- instances.add(this)
+ listen<TickEvent.Post>(priority = Int.MIN_VALUE) {
39
+ setThisTick = false
40
+ if (resetAfterTick) reset()
41
+ }
42
}
43
44
@Suppress("Unused")
@@ -60,22 +63,4 @@ class OneSetPerTick<T>(
60
63
private fun reset() {
61
64
value = defaultValue
62
65
-
- fun destroy() {
- destroyed = true
66
- instances.remove(this)
67
- }
68
69
- companion object {
70
- private val instances = linkedSetOf<OneSetPerTick<*>>()
71
72
- init {
73
- listen<TickEvent.Post>(priority = Int.MIN_VALUE) {
74
- instances.forEach {
75
- it.setThisTick = false
76
- if (it.resetAfterTick) it.reset()
77
78
79
80
81
0 commit comments