Skip to content

Commit

Permalink
🐛 Fix bug for wrong event type
Browse files Browse the repository at this point in the history
  • Loading branch information
way-zer committed Mar 1, 2020
1 parent 545208c commit a59cf45
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/kotlin/cf/wayzer/SuperItem/Item.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ abstract class Item : Listener {

@Suppress("unused")
inline fun <reified T:Event>listen(ignoreCancelled:Boolean=false, priority: EventPriority = EventPriority.NORMAL, crossinline handle:(T)->Unit){
Bukkit.getServer().pluginManager.registerEvent(T::class.java,this,priority, { _, event -> handle(event as T) },pluginMain,ignoreCancelled)
Bukkit.getServer().pluginManager.registerEvent(T::class.java,this,priority, { _, event -> if(event is T)handle(event) },pluginMain,ignoreCancelled)
}

fun register(){
Expand Down

0 comments on commit a59cf45

Please sign in to comment.