mirror of
https://github.com/Auxilor/EcoSkills.git
synced 2026-01-03 06:12:21 +00:00
Optimised EntityDamageByEntityEvent#isCrit
This commit is contained in:
@@ -117,8 +117,7 @@ public class EcoSkillsPlugin extends EcoPlugin {
|
||||
new SkillDisplayListener(this),
|
||||
new StatModifierListener(),
|
||||
new DataListener(),
|
||||
new PlayerBlockListener(this),
|
||||
new EcoSkillsEventModifierHandler(this)
|
||||
new PlayerBlockListener(this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,22 +1,9 @@
|
||||
package com.willfp.ecoskills
|
||||
|
||||
import org.bukkit.event.EventHandler
|
||||
import org.bukkit.event.EventPriority
|
||||
import org.bukkit.event.Listener
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent
|
||||
import java.util.*
|
||||
|
||||
private val critMap = mutableMapOf<EntityDamageByEntityEvent, Boolean>()
|
||||
|
||||
class EcoSkillsEventModifierHandler(
|
||||
private val plugin: EcoSkillsPlugin
|
||||
) : Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
fun preventLeak(event: EntityDamageByEntityEvent) {
|
||||
plugin.scheduler.run {
|
||||
critMap.remove(event)
|
||||
}
|
||||
}
|
||||
}
|
||||
private val critMap = WeakHashMap<EntityDamageByEntityEvent, Boolean>()
|
||||
|
||||
var EntityDamageByEntityEvent.isCrit: Boolean
|
||||
get() {
|
||||
|
||||
Reference in New Issue
Block a user