Open-source multiplayer game server compatible with the RuneScape client https://www.openrs2.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
openrs2/bundler/src/main/java/dev/openrs2/bundler/transform/TypoTransformer.kt

42 lines
1.2 KiB

package dev.openrs2.bundler.transform
import com.github.michaelbull.logging.InlineLogger
import dev.openrs2.asm.classpath.ClassPath
import dev.openrs2.asm.classpath.Library
import dev.openrs2.asm.transform.Transformer
import org.objectweb.asm.tree.ClassNode
import org.objectweb.asm.tree.LdcInsnNode
import org.objectweb.asm.tree.MethodNode
import javax.inject.Singleton
@Singleton
class TypoTransformer : Transformer() {
private var errorsFixed = 0
override fun preTransform(classPath: ClassPath) {
errorsFixed = 0
}
override fun transformCode(classPath: ClassPath, library: Library, clazz: ClassNode, method: MethodNode): Boolean {
for (insn in method.instructions) {
if (insn !is LdcInsnNode) {
continue
}
if (insn.cst == "Carregando /secure/libs_v4s/RCras - ") {
insn.cst = "Carregando texturas - "
errorsFixed++
}
}
return false
}
override fun postTransform(classPath: ClassPath) {
logger.info { "Fixed $errorsFixed typographical errors" }
}
private companion object {
private val logger = InlineLogger()
}
}