Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Jun 27, 2023
2 parents b1b8849 + c065c8b commit 8f6c111
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ object EffectBleed : Effect<NoCompileData>("bleed") {
plugin.runnableFactory.create {
current++

if (damage >= victim.health) {
val killed = damage >= victim.health

if (killed) {
victim.killer = data.player

if (data.player != null) {
Expand All @@ -49,7 +51,7 @@ object EffectBleed : Effect<NoCompileData>("bleed") {

victim.damage(damage)

if (current >= amount) {
if (current >= amount || killed) {
it.cancel()
}
}.runTaskTimer(interval.toLong(), interval.toLong())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.willfp.libreforge.triggers.Trigger
import com.willfp.libreforge.triggers.TriggerData
import com.willfp.libreforge.triggers.TriggerParameter
import org.bukkit.event.EventHandler
import org.bukkit.event.player.PlayerChangedWorldEvent
import org.bukkit.event.player.PlayerMoveEvent

object TriggerChangeWorld : Trigger("change_world") {
Expand All @@ -12,29 +13,23 @@ object TriggerChangeWorld : Trigger("change_world") {
TriggerParameter.LOCATION,
TriggerParameter.VELOCITY,
TriggerParameter.EVENT,
TriggerParameter.ITEM
TriggerParameter.ITEM,
TriggerParameter.TEXT
)

@EventHandler(ignoreCancelled = true)
fun handle(event: PlayerMoveEvent) {
fun handle(event: PlayerChangedWorldEvent) {
val player = event.player

if (event.to.world == null || event.from.world == null) {
return
}

if (event.to.world?.name != event.from.world?.name) {
return
}

this.dispatch(
player,
TriggerData(
player = player,
location = event.to,
location = event.player.location,
velocity = player.velocity,
event = event,
item = player.inventory.itemInMainHand
item = player.inventory.itemInMainHand,
text = event.player.world.name
)
)
}
Expand Down

0 comments on commit 8f6c111

Please sign in to comment.