Skip to content
This repository was archived by the owner on Dec 10, 2025. It is now read-only.

Commit bcbd7b3

Browse files
committed
feat: add last seen command for offline players
1 parent 679d2a7 commit bcbd7b3

File tree

1 file changed

+20
-0
lines changed
  • surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit

1 file changed

+20
-0
lines changed

surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/BukkitMain.kt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,26 @@ class BukkitMain : SuspendingJavaPlugin() {
323323
}
324324
}
325325
}
326+
327+
commandAPICommand("lastSeen") {
328+
offlinePlayerArgument("player")
329+
anyExecutor { sender, args ->
330+
val player: OfflinePlayer by args
331+
val cloudPlayer = player.toCloudOfflinePlayer()
332+
launch {
333+
val lastSeen = cloudPlayer.lastSeen()
334+
sender.sendText {
335+
appendPrefix()
336+
info("Last seen for player ${player.name} (${player.uniqueId})")
337+
appendNewPrefixedLine {
338+
variableKey("Last Seen")
339+
spacer(": ")
340+
variableValue(lastSeen?.toString() ?: "#Unknown")
341+
}
342+
}
343+
}
344+
}
345+
}
326346
}
327347

328348
@OptIn(ExperimentalContracts::class)

0 commit comments

Comments
 (0)