Final cleanup for 2.1 + Chatbox helms

This commit is contained in:
downthecrop 2025-11-23 05:15:19 -08:00
parent f61852660a
commit 8de4f8d097
15 changed files with 4 additions and 43 deletions

View file

@ -113,7 +113,7 @@ class plugin : Plugin() {
private fun getConfig() { private fun getConfig() {
val cleanUsername = getCleanUserName() val cleanUsername = getCleanUserName()
println(cleanUsername) //println(cleanUsername)
// Abort if we are pre-login // Abort if we are pre-login
if (cleanUsername.isEmpty()) return if (cleanUsername.isEmpty()) return

View file

@ -1,15 +1,11 @@
package KondoKit.pluginmanager package KondoKit.pluginmanager
/**
* Configuration object for GitLab API settings that can be shared between
* GitLabPluginFetcher and PluginDownloadManager
*/
object GitLabConfig { object GitLabConfig {
const val GITLAB_PROJECT_ID = "38297322" const val GITLAB_PROJECT_ID = "38297322"
const val GITLAB_PROJECT_PATH = "2009scape/tools/client-plugins" // Using path from DownloadManager const val GITLAB_PROJECT_PATH = "2009scape/tools/client-plugins"
const val GITLAB_BRANCH = "master" const val GITLAB_BRANCH = "master"
const val DEBUG = true // Set to false to disable debug logging const val DEBUG = false // Spams pretty hard
fun getGitLabApiBaseUrl(): String = "https://gitlab.com/api/v4/projects/$GITLAB_PROJECT_ID" fun getGitLabApiBaseUrl(): String = "https://gitlab.com/api/v4/projects/$GITLAB_PROJECT_ID"
@ -19,7 +15,6 @@ object GitLabConfig {
fun getRawFileUrl(filePath: String): String = fun getRawFileUrl(filePath: String): String =
"${getGitLabApiBaseUrl()}/repository/files/${filePath.replace("/", "%2F")}/raw?ref=${GITLAB_BRANCH}" "${getGitLabApiBaseUrl()}/repository/files/${filePath.replace("/", "%2F")}/raw?ref=${GITLAB_BRANCH}"
// Archive URL helper
fun getArchiveBaseUrl(): String = fun getArchiveBaseUrl(): String =
"https://gitlab.com/$GITLAB_PROJECT_PATH/-/archive/$GITLAB_BRANCH/${GITLAB_PROJECT_PATH.replace("/", "-")}-$GITLAB_BRANCH.zip" "https://gitlab.com/$GITLAB_PROJECT_PATH/-/archive/$GITLAB_BRANCH/${GITLAB_PROJECT_PATH.replace("/", "-")}-$GITLAB_BRANCH.zip"

View file

@ -98,7 +98,6 @@ object PluginDownloadManager {
GitLabConfig.getArchiveUrlWithRefType(plugin.path), GitLabConfig.getArchiveUrlWithRefType(plugin.path),
// Format 2: Using ref parameter // Format 2: Using ref parameter
GitLabConfig.getArchiveUrl(plugin.path), GitLabConfig.getArchiveUrl(plugin.path),
// Format 3: Direct archive URL without path parameter (we'll filter later)
GitLabConfig.getArchiveBaseUrl() GitLabConfig.getArchiveBaseUrl()
) )

View file

@ -1,9 +1,5 @@
package KondoKit.pluginmanager package KondoKit.pluginmanager
/**
* Shared lightweight logger so pluginmanager classes don't each redefine
* their own debug helper tied to GitLabConfig.DEBUG.
*/
object PluginLogger { object PluginLogger {
fun debug(tag: String, message: String) { fun debug(tag: String, message: String) {
if (GitLabConfig.DEBUG) { if (GitLabConfig.DEBUG) {

View file

@ -2,9 +2,6 @@ package KondoKit.ui
import javax.swing.JPanel import javax.swing.JPanel
/**
* Contract implemented by UI views; kept in a dedicated UI package to avoid tangling with concrete implementations.
*/
interface View { interface View {
val name: String val name: String
val iconSpriteId: Int val iconSpriteId: Int

View file

@ -3,9 +3,6 @@ package KondoKit.ui
import java.awt.Dimension import java.awt.Dimension
import java.awt.Font import java.awt.Font
/**
* Shared constants for fonts, dimensions, and colors across the entire KondoKit plugin.
*/
object ViewConstants { object ViewConstants {
val FONT_RUNESCAPE_SMALL_16 = Font("RuneScape Small", Font.TRUETYPE_FONT, 16) val FONT_RUNESCAPE_SMALL_16 = Font("RuneScape Small", Font.TRUETYPE_FONT, 16)
val FONT_RUNESCAPE_SMALL_14 = Font("RuneScape Small", Font.PLAIN, 14) val FONT_RUNESCAPE_SMALL_14 = Font("RuneScape Small", Font.PLAIN, 14)

View file

@ -2,9 +2,6 @@ package KondoKit.util
import java.io.File import java.io.File
/**
* File-related helpers shared across the plugin to avoid ad-hoc copies.
*/
object FileUtils { object FileUtils {
fun deleteRecursively(file: File): Boolean { fun deleteRecursively(file: File): Boolean {
if (file.isDirectory) { if (file.isDirectory) {

View file

@ -15,7 +15,6 @@ import java.util.Timer
import javax.swing.* import javax.swing.*
object Helpers { object Helpers {
// Convenience helper for loading resources relative to the KondoKit plugin class
fun openResource(path: String) = plugin::class.java.getResourceAsStream(path) fun openResource(path: String) = plugin::class.java.getResourceAsStream(path)
// Read a bundled resource as text using the given charset (UTF-8 by default) // Read a bundled resource as text using the given charset (UTF-8 by default)

View file

@ -4,9 +4,6 @@ import java.io.IOException
import java.net.HttpURLConnection import java.net.HttpURLConnection
import java.net.URL import java.net.URL
/**
* Lightweight helper for opening GET connections with shared defaults so callers don't repeat header setup.
*/
object HttpFetcher { object HttpFetcher {
const val DEFAULT_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36" const val DEFAULT_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"

View file

@ -3,9 +3,6 @@ package KondoKit.util
import com.google.gson.Gson import com.google.gson.Gson
import com.google.gson.reflect.TypeToken import com.google.gson.reflect.TypeToken
/**
* Centralizes JSON parsing to reuse the same Gson configuration everywhere.
*/
object JsonParser { object JsonParser {
val gson: Gson = Gson() val gson: Gson = Gson()

View file

@ -7,7 +7,6 @@ import rt4.SoftwareSprite
import java.awt.Color import java.awt.Color
import java.awt.image.BufferedImage import java.awt.image.BufferedImage
// Define interfaces for common sprite types
interface BaseSprite { interface BaseSprite {
val width: Int val width: Int
val height: Int val height: Int
@ -22,7 +21,6 @@ interface NonIndexedSprite : BaseSprite {
val pixels: IntArray? val pixels: IntArray?
} }
// Adapter functions for existing sprite types
fun adaptSoftwareSprite(sprite: SoftwareSprite): NonIndexedSprite { fun adaptSoftwareSprite(sprite: SoftwareSprite): NonIndexedSprite {
return object : NonIndexedSprite { return object : NonIndexedSprite {
override val width: Int = sprite.width override val width: Int = sprite.width

View file

@ -1,8 +1,5 @@
package KondoKit.util package KondoKit.util
/**
* Utility for mapping XP values to levels and vice versa.
*/
object XPTable { object XPTable {
private val xpForLevels: IntArray = IntArray(100) private val xpForLevels: IntArray = IntArray(100)

View file

@ -30,7 +30,6 @@ import kotlin.math.ceil
if it is implemented. Check GroundItems plugin for an example. if it is implemented. Check GroundItems plugin for an example.
*/ */
object ReflectiveEditorView : View { object ReflectiveEditorView : View {
var reflectiveEditorView: JPanel? = null var reflectiveEditorView: JPanel? = null
const val VIEW_NAME = "REFLECTIVE_EDITOR_VIEW" const val VIEW_NAME = "REFLECTIVE_EDITOR_VIEW"

View file

@ -12,10 +12,6 @@ import javax.swing.Box
import javax.swing.BoxLayout import javax.swing.BoxLayout
import javax.swing.JPanel import javax.swing.JPanel
/**
* Utility helpers shared across view implementations to avoid duplicating
* common UI wiring such as search rows and vertical panel setup.
*/
object ViewLayoutHelpers { object ViewLayoutHelpers {
data class SearchFieldSection( data class SearchFieldSection(
@ -63,9 +59,6 @@ object ViewLayoutHelpers {
return SearchFieldSection(wrapper = wrapper, searchField = searchField) return SearchFieldSection(wrapper = wrapper, searchField = searchField)
} }
/**
* Provides a BoxLayout.Y_AXIS panel with the default view background.
*/
fun createVerticalPanel(background: Color = VIEW_BACKGROUND_COLOR): JPanel { fun createVerticalPanel(background: Color = VIEW_BACKGROUND_COLOR): JPanel {
return JPanel().apply { return JPanel().apply {
layout = BoxLayout(this, BoxLayout.Y_AXIS) layout = BoxLayout(this, BoxLayout.Y_AXIS)