mirror of
https://gitlab.com/2009scape/rt4-client.git
synced 2025-12-13 18:10:20 -07:00
Final cleanup for 2.1 + Chatbox helms
This commit is contained in:
parent
f61852660a
commit
8de4f8d097
15 changed files with 4 additions and 43 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
BIN
plugin-playground/src/main/kotlin/KondoKit/.DS_Store
vendored
BIN
plugin-playground/src/main/kotlin/KondoKit/.DS_Store
vendored
Binary file not shown.
|
|
@ -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"
|
||||||
|
|
||||||
|
|
@ -18,8 +14,7 @@ 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"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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) {
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
|
|
@ -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) {
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue