Skip to content

Commit

Permalink
Fixed move trigger and updated kotlin and eco
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Dec 6, 2023
1 parent 962d3e5 commit 07c3641
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
}

dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20")
}
}

Expand Down Expand Up @@ -39,7 +39,7 @@ allprojects {

dependencies {
compileOnly("org.jetbrains:annotations:23.0.0")
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:1.7.10")
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:1.9.20")

compileOnly(fileTree("lib") { include("*.jar") })
}
Expand Down
2 changes: 1 addition & 1 deletion core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ dependencies {
isTransitive = false
}

compileOnly("com.willfp:eco:6.65.0")
compileOnly("com.willfp:eco:6.67.0")
compileOnly("io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT")
compileOnly("net.kyori:adventure-text-minimessage:4.14.0")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.willfp.libreforge.triggers.TriggerParameter
import io.papermc.paper.event.entity.EntityMoveEvent
import org.bukkit.entity.Player
import org.bukkit.event.EventHandler
import org.bukkit.event.player.PlayerMoveEvent

object TriggerMove : Trigger("move") {
override val parameters = setOf(
Expand Down Expand Up @@ -46,4 +47,33 @@ object TriggerMove : Trigger("move") {
)
)
}

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

if (Prerequisite.HAS_PAPER.isMet) {
if (!event.hasChangedBlock()) {
return
}
}

val distance = if (event.to.world == event.from.world) {
event.to.distance(event.from)
} else {
0.0
}

this.dispatch(
player.toDispatcher(),
TriggerData(
player = player,
location = player.location,
velocity = player.velocity,
event = event,
item = player.equipment.itemInMainHand,
value = distance
)
)
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version = 4.48.0
version = 4.48.1
kotlin.code.style = official
2 changes: 1 addition & 1 deletion loader/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dependencies {
compileOnly(project(":core"))

compileOnly("com.willfp:eco:6.55.2")
compileOnly("com.willfp:eco:6.67.0")
compileOnly("io.papermc.paper:paper-api:1.17.1-R0.1-SNAPSHOT")
}

Expand Down

0 comments on commit 07c3641

Please sign in to comment.