Skip to content

Commit

Permalink
Stop searching for ground if already logged in
Browse files Browse the repository at this point in the history
  • Loading branch information
Iru21 committed Feb 7, 2023
1 parent 3fbdfad commit c32dc66
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
@@ -1,4 +1,4 @@
kotlin.code.style = official
minecraftVersion = 1.17
pluginName = Authy
pluginVersion = 3.2.3
pluginVersion = 3.2.4
12 changes: 8 additions & 4 deletions src/main/kotlin/me/iru/utils/TeleportUtil.kt
Expand Up @@ -41,18 +41,22 @@ object TeleportUtil {

val mh = loc.world?.minHeight ?: 0

var task0 : BukkitTask? = null
task0 = authy.server.scheduler.runTaskTimer(authy, Runnable {
lateinit var task : BukkitTask
task = authy.server.scheduler.runTaskTimer(authy, Runnable {
if(!Authy.loginProcess.contains(player)) {
task.cancel()
}

if(loc.y < mh) {
task0!!.cancel()
task.cancel()
player.teleport(loc)
}

val under = loc.block.getRelative(BlockFace.DOWN)
if(!under.type.isSolid) {
loc = under.location
} else {
task0!!.cancel()
task.cancel()
player.teleport(loc)
}
}, 0L, 0L)
Expand Down

0 comments on commit c32dc66

Please sign in to comment.