Skip to content

Commit

Permalink
v4.1.1 b52
Browse files Browse the repository at this point in the history
* potential fix for nametags not working after a while
  • Loading branch information
stumper66 committed Aug 10, 2024
1 parent 5ca9289 commit 54217b1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version = 4.1.1 b51
version = 4.1.1 b52
description = The Ultimate RPG Mob Levelling Solution
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import io.github.arcaneplugins.levelledmobs.util.MessageUtils
import io.github.arcaneplugins.levelledmobs.util.QuickTimer
import io.github.arcaneplugins.levelledmobs.util.Utils
import io.github.arcaneplugins.levelledmobs.wrappers.LivingEntityWrapper
import io.github.arcaneplugins.levelledmobs.wrappers.SchedulerWrapper
import java.time.Instant
import java.util.Random
import java.util.Stack
Expand Down Expand Up @@ -127,6 +128,8 @@ class LevelledMobs : JavaPlugin() {
if (nametagQueueManager.hasNametagSupport) {
levelManager.startNametagAutoUpdateTask()
levelManager.startNametagTimer()
val scheduler = SchedulerWrapper { nametagQueueManager.taskChecker() }
scheduler.runTaskTimerAsynchronously(50000, 5000)
}

prepareToLoadCustomDrops()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,19 @@ class NametagQueueManager {
doThread = false
}

fun taskChecker(){
val qt = queueTask ?: return

if (!qt.isCancelled || Bukkit.getScheduler().isCurrentlyRunning(qt.taskId)) return
val status = if (qt.isCancelled) "cancelled"
else "not running"

Log.war("Restarting Nametag Queue Manager task, status was $status")
qt.cancel()
isRunning = false
start()
}

fun addToQueue(item: QueueItem) {
if (!item.lmEntity.shouldShowLMNametag) return
if (Bukkit.getOnlinePlayers().isEmpty()) return
Expand Down

0 comments on commit 54217b1

Please sign in to comment.