Skip to content

Commit

Permalink
Do not conceal location on first join (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
Iru21 committed Jun 21, 2023
1 parent 0d7ac8d commit dafe7a8
Show file tree
Hide file tree
Showing 2 changed files with 7 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.7
pluginVersion = 3.2.8
10 changes: 6 additions & 4 deletions src/main/kotlin/me/iru/process/PreLoginDataStore.kt
Expand Up @@ -17,7 +17,7 @@ object PreLoginDataStore {

fun save(p: Player) {
saveEffects(p)
if(shouldConceal() && !p.isDead) {
if(shouldConceal(p) && !p.isDead) {
locations[p.uniqueId] = p.location
}
saveFireTicks(p)
Expand All @@ -26,7 +26,7 @@ object PreLoginDataStore {

fun restore(p: Player) {
restoreEffects(p)
if(shouldConceal()) {
if(shouldConceal(p)) {
restoreLocation(p)
}
p.fireTicks = fireTicks[p.uniqueId] ?: 0
Expand Down Expand Up @@ -71,8 +71,10 @@ object PreLoginDataStore {
}
}

private fun shouldConceal(): Boolean {
return authy.config.getBoolean("onJoin.teleport") && authy.config.getBoolean("onJoin.concealment")
private fun shouldConceal(p: Player): Boolean {
return authy.config.getBoolean("onJoin.teleport") &&
authy.config.getBoolean("onJoin.concealment") &&
p.hasPlayedBefore()
}

}

0 comments on commit dafe7a8

Please sign in to comment.