Skip to content

Commit

Permalink
oops, forgot to stage these
Browse files Browse the repository at this point in the history
  • Loading branch information
Iru21 committed May 19, 2023
1 parent 9371a8b commit d0134ef
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 66 deletions.
24 changes: 22 additions & 2 deletions src/main/kotlin/me/iru/process/JoinProcess.kt
Expand Up @@ -3,9 +3,10 @@ package me.iru.process
import me.iru.Authy
import me.iru.PrefixType
import me.iru.data.migration.Migration
import me.iru.utils.TeleportUtil
import me.iru.utils.hasValidName
import org.bukkit.Location
import org.bukkit.Material
import org.bukkit.block.BlockFace
import org.bukkit.entity.Player
import org.bukkit.potion.PotionEffect
import org.bukkit.potion.PotionEffectType
Expand All @@ -28,7 +29,7 @@ class JoinProcess(private val player: Player) {
if(session.tryAutoLogin(player)) return

joinTeleports()
TeleportUtil.teleportToValidPlace(player)
teleportToValidPlace()

// Place premium check here

Expand Down Expand Up @@ -57,6 +58,25 @@ class JoinProcess(private val player: Player) {
}
}

private fun teleportToValidPlace() {
val invalidBlocks = mutableListOf(Material.NETHER_PORTAL)
val loc = player.location
if(!invalidBlocks.contains(loc.block.type)) return

var b = loc.block
for(x in 2 downTo -2 step 1) {
for(z in 2 downTo -2 step 1) {
if(invalidBlocks.contains(b.type) && !(b.type.isSolid && b.getRelative(BlockFace.UP).type.isSolid)) {
b = b.getRelative(x, 0, z)
} else {
player.teleport(b.location)
return
}
}
}
return
}

private fun check() {
lateinit var messageTask : BukkitTask
messageTask = authy.server.scheduler.runTaskTimer(authy, Runnable {
Expand Down
64 changes: 0 additions & 64 deletions src/main/kotlin/me/iru/utils/TeleportUtil.kt

This file was deleted.

0 comments on commit d0134ef

Please sign in to comment.