Skip to content

Commit

Permalink
Add yaw and pitch to teleport in config
Browse files Browse the repository at this point in the history
  • Loading branch information
Iru21 committed Jan 25, 2023
1 parent 8c0b62e commit 3fbdfad
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 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.2
pluginVersion = 3.2.3
24 changes: 12 additions & 12 deletions src/main/kotlin/me/iru/process/JoinProcess.kt
Expand Up @@ -42,18 +42,18 @@ class JoinProcess(private val player: Player) {
}

private fun joinTeleports() {
if(!this.player.hasPlayedBefore() && authy.config.getBoolean("onFirstJoin.teleport")) {
val x = authy.config.getDouble("onFirstJoin.x")
val y = authy.config.getDouble("onFirstJoin.y") + 0.1
val z = authy.config.getDouble("onFirstJoin.z")
val world = authy.config.getString("onFirstJoin.world") ?: "world"
player.teleport(Location(authy.server.getWorld(world), x, y, z))
} else if(authy.config.getBoolean("onJoin.teleport")) {
val x = authy.config.getDouble("onJoin.x")
val y = authy.config.getDouble("onJoin.y") + 0.1
val z = authy.config.getDouble("onJoin.z")
val world = authy.config.getString("onJoin.world") ?: "world"
player.teleport(Location(authy.server.getWorld(world), x, y, z))
var key = "onJoin"
if(!this.player.hasPlayedBefore()) {
key = "onFirstJoin"
}
if(authy.config.getBoolean("onFirstJoin.teleport") || authy.config.getBoolean("onJoin.teleport")) {
val x = authy.config.getDouble("$key.x")
val y = authy.config.getDouble("$key.y") + 0.1
val z = authy.config.getDouble("$key.z")
val yaw = authy.config.getDouble("$key.yaw").toFloat()
val pitch = authy.config.getDouble("$key.pitch").toFloat()
val world = authy.config.getString("$key.world") ?: "world"
player.teleport(Location(authy.server.getWorld(world), x, y, z, yaw, pitch))
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/config.yml
Expand Up @@ -34,6 +34,8 @@ onFirstJoin:
x: 0
y: 0
z: 0
yaw: 0
pitch: 0
world: world

onJoin:
Expand All @@ -43,6 +45,8 @@ onJoin:
x: 0
y: 0
z: 0
yaw: 0
pitch: 0
world: world

duplicateIpProtection:
Expand Down

0 comments on commit 3fbdfad

Please sign in to comment.