mirror of
https://gitlab.com/2009scape/rt4-client.git
synced 2025-12-20 13:30:30 -07:00
Faster loading XP Widgets, file loading heleprs and XP widget resetting
This commit is contained in:
parent
7f09263209
commit
7cc56d0e53
5 changed files with 255 additions and 99 deletions
|
|
@ -3,6 +3,8 @@ package KondoKit
|
|||
import rt4.GameShell
|
||||
import java.awt.*
|
||||
import java.awt.event.MouseListener
|
||||
import java.nio.charset.Charset
|
||||
import java.nio.charset.StandardCharsets
|
||||
import java.lang.reflect.Field
|
||||
import java.lang.reflect.ParameterizedType
|
||||
import java.lang.reflect.Type
|
||||
|
|
@ -11,6 +13,16 @@ import java.util.Timer
|
|||
import javax.swing.*
|
||||
|
||||
object Helpers {
|
||||
// Convenience helper for loading resources relative to the KondoKit plugin class
|
||||
fun openResource(path: String) = plugin::class.java.getResourceAsStream(path)
|
||||
|
||||
// Read a bundled resource as text using the given charset (UTF-8 by default)
|
||||
fun readResourceText(path: String, charset: Charset = StandardCharsets.UTF_8): String? {
|
||||
val stream = openResource(path) ?: return null
|
||||
stream.use { s ->
|
||||
return s.reader(charset).use { it.readText() }
|
||||
}
|
||||
}
|
||||
|
||||
fun convertValue(type: Class<*>, genericType: Type?, value: String): Any {
|
||||
return when {
|
||||
|
|
@ -233,4 +245,4 @@ object Helpers {
|
|||
else -> Color(128, 128, 128) // Default grey for unhandled skill IDs
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue