diff options
author | J10a1n15 <45315647+j10a1n15@users.noreply.github.com> | 2024-09-10 23:35:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-10 23:35:59 +0200 |
commit | f75c9933794cdb9c7dff5486369636b18854b76d (patch) | |
tree | 18f731eeed1f7d4ef008c4abc50a7ccc75d10072 | |
parent | d6c9b63136cae3a8abf7d4ce91424dfc648dc59c (diff) | |
download | skyhanni-f75c9933794cdb9c7dff5486369636b18854b76d.tar.gz skyhanni-f75c9933794cdb9c7dff5486369636b18854b76d.tar.bz2 skyhanni-f75c9933794cdb9c7dff5486369636b18854b76d.zip |
Fix: Last Server Chat Spam (#2495)
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/misc/LastServersConfig.java | 2 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/LastServers.kt | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/misc/LastServersConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/misc/LastServersConfig.java index a488b52e9..e613b013b 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/misc/LastServersConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/misc/LastServersConfig.java @@ -9,7 +9,7 @@ import io.github.notenoughupdates.moulconfig.annotations.ConfigOption; public class LastServersConfig { @Expose - @ConfigOption(name = "Enabled", desc = "Receive notifications when you rejoin a server you have previously joined.") + @ConfigOption(name = "Enabled", desc = "Receive notifications when you rejoin a server you were in previously.") @ConfigEditorBoolean @FeatureToggle public boolean enabled = false; diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/LastServers.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/LastServers.kt index 8bc2d96e4..7a59ef4f6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/LastServers.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/LastServers.kt @@ -26,14 +26,18 @@ object LastServers { // Update the time of the current server if the player is still on the same server. // This is necessary because the player can be on the same server for a long time. // And if the player leaves the server and joins it again, it still warns the player. - lastServers[id] = SimpleTimeMark.now() + if (lastServerId == id) { + lastServers[id] = SimpleTimeMark.now() + return + } lastServers.entries.removeIf { it.value.passedSince() > config.warnTime.seconds } lastServers[id]?.passedSince()?.let { - ChatUtils.chat("§7You already joined this server §b${it.format()}§7 ago.") + ChatUtils.chat("§7You were already on this server §b${it.format()}§7 ago.") } ChatUtils.debug("Adding $id to last servers.") lastServerId = id + lastServers[id] = SimpleTimeMark.now() } private fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled |