-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
211 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
analyser/src/test/kotlin/org/tabooproject/reflex/AnalyserTestAnnotation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.tabooproject.reflex | ||
|
||
import org.junit.jupiter.api.Test | ||
import org.tabooproject.reflex.res.EventPriority | ||
import org.tabooproject.reflex.res.SubscribeEvent | ||
|
||
/** | ||
* Reflex | ||
* org.tabooproject.reflex.AnalyserTestAnnotation | ||
* | ||
* @author 坏黑 | ||
* @since 2022/8/6 14:47 | ||
*/ | ||
class AnalyserTestAnnotation { | ||
|
||
@SubscribeEvent(priority = EventPriority.HIGH) | ||
fun event() { | ||
} | ||
|
||
@Test | ||
fun testKotlinReflect() { | ||
val analyser = ClassAnalyser.analyseByASM(AnalyserTestAnnotation::class.java) | ||
val method = analyser.getMethod("event") | ||
assert(method.getAnnotation(SubscribeEvent::class.java).properties().size == 1) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
analyser/src/test/kotlin/org/tabooproject/reflex/res/EventOrder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package org.tabooproject.reflex.res | ||
|
||
/** | ||
* Sponge Only | ||
* | ||
* TabooLib | ||
* org.tabooproject.reflex.res.EventOrder | ||
* | ||
* @author sky | ||
* @since 2021/6/21 6:24 下午 | ||
*/ | ||
enum class EventOrder { | ||
|
||
/** | ||
* The order point of PRE handles setting up things that need to be done | ||
* before other things are handled PRE is read only and cannot cancel the | ||
* events. | ||
*/ | ||
PRE, | ||
|
||
/** | ||
* The order point of AFTER_PRE handles things that need to be done after | ||
* PRE AFTER_PRE is read only and cannot cancel the events. | ||
*/ | ||
AFTER_PRE, | ||
|
||
/** | ||
* The order point of FIRST handles cancellation by protection plugins for | ||
* informational responses FIRST is read only but can cancel events. | ||
*/ | ||
FIRST, | ||
|
||
/** | ||
* The order point of EARLY handles standard actions that need to be done | ||
* before other plugins EARLY is not read only and can cancel events. | ||
*/ | ||
EARLY, | ||
|
||
/** | ||
* The order point of DEFAULT handles just standard event handlings, you | ||
* should use this unless you know you need otherwise DEFAULT is not read | ||
* only and can cancel events. | ||
*/ | ||
DEFAULT, | ||
|
||
/** | ||
* The order point of LATE handles standard actions that need to be done | ||
* after other plugins LATE is not read only and can cancel the event. | ||
*/ | ||
LATE, | ||
|
||
/** | ||
* The order point of LAST handles last minute cancellations by protection | ||
* plugins LAST is read only but can cancel events. | ||
*/ | ||
LAST, | ||
|
||
/** | ||
* The order point of BEFORE_POST handles preparation for things needing | ||
* to be done in post BEFORE_POST is read only and cannot cancel events. | ||
*/ | ||
BEFORE_POST, | ||
|
||
/** | ||
* The order point of POST handles last minute things and monitoring | ||
* of events for rollback or logging POST is read only and | ||
* cannot cancel events.</p> | ||
*/ | ||
POST | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
analyser/src/test/kotlin/org/tabooproject/reflex/res/EventPriority.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.tabooproject.reflex.res | ||
|
||
/** | ||
* TabooLib | ||
* org.tabooproject.reflex.res.EventPriority | ||
* | ||
* @author sky | ||
* @since 2021/6/16 1:07 上午 | ||
*/ | ||
enum class EventPriority(val level: Int) { | ||
|
||
LOWEST(-64), LOW(-32), NORMAL(0), HIGH(32), HIGHEST(64), MONITOR(128) | ||
} |
13 changes: 13 additions & 0 deletions
13
analyser/src/test/kotlin/org/tabooproject/reflex/res/PostOrder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.tabooproject.reflex.res | ||
|
||
/** | ||
* TabooLib | ||
* org.tabooproject.reflex.res.PostOrder | ||
* | ||
* @author sky | ||
* @since 2021/7/2 11:26 下午 | ||
*/ | ||
enum class PostOrder { | ||
|
||
FIRST, EARLY, NORMAL, LATE, LAST | ||
} |
21 changes: 21 additions & 0 deletions
21
analyser/src/test/kotlin/org/tabooproject/reflex/res/SubscribeEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.tabooproject.reflex.res | ||
|
||
import org.tabooproject.reflex.res.EventOrder | ||
import org.tabooproject.reflex.res.EventPriority | ||
import org.tabooproject.reflex.res.PostOrder | ||
|
||
@Target(AnnotationTarget.FUNCTION) | ||
@kotlin.annotation.Retention(AnnotationRetention.RUNTIME) | ||
annotation class SubscribeEvent( | ||
val priority: EventPriority = EventPriority.NORMAL, | ||
val ignoreCancelled: Boolean = false, | ||
// only bungeecord platform | ||
val level: Int = -1, | ||
// only velocity | ||
val postOrder: PostOrder = PostOrder.NORMAL, | ||
// only sponge platform | ||
val order: EventOrder = EventOrder.DEFAULT, | ||
val beforeModifications: Boolean = false, | ||
// optional event | ||
val bind: String = "" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters