@@ -20,6 +20,10 @@ import taboolib.platform.BukkitPlugin
2020import java.io.File
2121import java.util.concurrent.ConcurrentHashMap
2222
23+ /* *
24+ * Shared hologram bridge that picks one supported provider at runtime and keeps
25+ * Matrix plugin requests synchronized with that provider.
26+ */
2327object MatrixHolograms {
2428
2529 private const val resourcePath = " Hologram/config.yml"
@@ -63,17 +67,26 @@ object MatrixHolograms {
6367 requests.clear()
6468 }
6569
70+ /* *
71+ * Reload hologram settings and rebuild the active provider cache.
72+ */
6673 fun reload () {
6774 settings = loadSettings()
6875 refreshAdapter(rebuildCached = true , force = true )
6976 }
7077
78+ /* *
79+ * Return the active hologram config file.
80+ */
7181 fun configFile (): File {
7282 val plugin = BukkitPlugin .getInstance()
7383 MatrixResourceFiles .saveResourceIfAbsent(plugin, resourcePath)
7484 return MatrixResourceFiles .dataFile(plugin, resourcePath)
7585 }
7686
87+ /* *
88+ * Create or update a hologram request in the active provider.
89+ */
7790 fun createOrUpdate (request : MatrixHologramRequest ) {
7891 val qualifiedId = request.qualifiedId()
7992 if (request.lines.isEmpty()) {
@@ -85,12 +98,18 @@ object MatrixHolograms {
8598 adapter?.createOrUpdate(render(request))
8699 }
87100
101+ /* *
102+ * Remove a hologram by namespace and id.
103+ */
88104 fun remove (namespace : String , id : String ) {
89105 val qualifiedId = qualifiedId(namespace, id)
90106 requests.remove(qualifiedId)
91107 adapter?.remove(qualifiedId)
92108 }
93109
110+ /* *
111+ * Remove all holograms in a namespace.
112+ */
94113 fun clearNamespace (namespace : String ) {
95114 val prefix = " ${namespace.trim().ifBlank { " matrix" }.lowercase()} _"
96115 val keys = requests.keys.filter { it.startsWith(prefix) }
@@ -100,10 +119,16 @@ object MatrixHolograms {
100119 }
101120 }
102121
122+ /* *
123+ * Return the configured default vertical offset.
124+ */
103125 fun defaultHeight (): Double {
104126 return settings.defaultHeight
105127 }
106128
129+ /* *
130+ * Return the selected provider name or a status marker.
131+ */
107132 fun providerSummary (): String {
108133 return if (! settings.enabled) {
109134 " disabled"
@@ -112,6 +137,9 @@ object MatrixHolograms {
112137 }
113138 }
114139
140+ /* *
141+ * Whether the hologram bridge is enabled in config.
142+ */
115143 fun isEnabled (): Boolean {
116144 return settings.enabled
117145 }
0 commit comments