Fixed skull on 1.21
This commit is contained in:
@@ -3,7 +3,7 @@ version = rootProject.version
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":eco-core:core-backend"))
|
||||
compileOnly("io.papermc.paper:paper-api:1.21-R0.1-SNAPSHOT")
|
||||
compileOnly("io.papermc.paper:paper-api:1.21.1-R0.1-SNAPSHOT")
|
||||
}
|
||||
|
||||
tasks {
|
||||
|
||||
@@ -7,7 +7,7 @@ dependencies {
|
||||
implementation("org.objenesis:objenesis:3.2")
|
||||
|
||||
compileOnly("io.papermc.paper:paper-api:1.20.2-R0.1-SNAPSHOT")
|
||||
compileOnly("me.clip:placeholderapi:2.11.4")
|
||||
compileOnly("me.clip:placeholderapi:2.11.6")
|
||||
compileOnly("net.kyori:adventure-text-minimessage:4.10.0")
|
||||
compileOnly("net.kyori:adventure-platform-bukkit:4.1.0")
|
||||
compileOnly("org.yaml:snakeyaml:1.33")
|
||||
|
||||
@@ -48,7 +48,7 @@ var SkullMeta.texture: String?
|
||||
* at java.lang.String.checkBoundsBeginEnd(String.java:4604) ~[?:?]
|
||||
* at java.lang.String.substring(String.java:2707) ~[?:?]
|
||||
* at java.lang.String.substring(String.java:2680) ~[?:?]
|
||||
* at com.willfp.eco.internal.spigot.proxy.v1_19_R1.common.SkullKt.setTexture(Skull.kt:36)
|
||||
* at com.willfp.eco.internal.spigot.proxy.v1_19_R1.common.SkullKt.setTexture(ModernSkull.kt:36)
|
||||
*
|
||||
if (base64.length < 20) {
|
||||
return
|
||||
|
||||
@@ -7,7 +7,7 @@ version = rootProject.version
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":eco-core:core-nms:common"))
|
||||
paperweight.paperDevBundle("1.21-R0.1-SNAPSHOT")
|
||||
paperweight.paperDevBundle("1.21.1-R0.1-SNAPSHOT")
|
||||
}
|
||||
|
||||
tasks {
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.willfp.eco.internal.spigot.proxy.common.modern
|
||||
|
||||
import com.mojang.authlib.GameProfile
|
||||
import com.mojang.authlib.properties.Property
|
||||
import net.minecraft.world.item.component.ResolvableProfile
|
||||
import org.bukkit.inventory.meta.SkullMeta
|
||||
import java.lang.reflect.Field
|
||||
import java.lang.reflect.Method
|
||||
import java.util.UUID
|
||||
|
||||
private lateinit var setProfile: Method
|
||||
private lateinit var profile: Field
|
||||
private lateinit var value: Field
|
||||
|
||||
var SkullMeta.texture: String?
|
||||
get() {
|
||||
if (!::value.isInitialized) {
|
||||
// Doing it this way because Property was changed to be a record and this is
|
||||
// a quick hack to get around that
|
||||
value = Property::class.java.getDeclaredField("value")
|
||||
value.isAccessible = true
|
||||
}
|
||||
|
||||
if (!::profile.isInitialized) {
|
||||
// Assumes instance of CraftMetaSkull; package-private class so can't do manual type check
|
||||
profile = this.javaClass.getDeclaredField("profile")
|
||||
profile.isAccessible = true
|
||||
}
|
||||
|
||||
val profile = profile[this] as ResolvableProfile? ?: return null
|
||||
val properties = profile.properties ?: return null
|
||||
val props = properties["textures"] ?: return null
|
||||
val prop = props.toMutableList().firstOrNull() ?: return null
|
||||
return value[prop] as String?
|
||||
}
|
||||
set(base64) {
|
||||
if (!::setProfile.isInitialized) {
|
||||
// Same here; that's why I can't delegate to a lazy initializer
|
||||
setProfile = this.javaClass.getDeclaredMethod("setProfile", ResolvableProfile::class.java)
|
||||
setProfile.isAccessible = true
|
||||
}
|
||||
|
||||
if (base64 == null || base64.length < 20) {
|
||||
setProfile.invoke(this, null)
|
||||
} else {
|
||||
val uuid = UUID(
|
||||
base64.substring(base64.length - 20).hashCode().toLong(),
|
||||
base64.substring(base64.length - 10).hashCode().toLong()
|
||||
)
|
||||
val profile = GameProfile(uuid, "eco")
|
||||
profile.properties.put("textures", Property("textures", base64))
|
||||
val resolvable = ResolvableProfile(profile)
|
||||
setProfile.invoke(this, resolvable)
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ version = rootProject.version
|
||||
dependencies {
|
||||
implementation(project(":eco-core:core-nms:modern"))
|
||||
implementation(project(":eco-core:core-nms:common"))
|
||||
paperweight.paperDevBundle("1.21-R0.1-SNAPSHOT")
|
||||
paperweight.paperDevBundle("1.21.1-R0.1-SNAPSHOT")
|
||||
|
||||
implementation("net.kyori:adventure-text-minimessage:4.11.0") {
|
||||
version {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.willfp.eco.internal.spigot.proxy.v1_21
|
||||
|
||||
import com.willfp.eco.internal.spigot.proxy.SkullProxy
|
||||
import com.willfp.eco.internal.spigot.proxy.common.texture
|
||||
import com.willfp.eco.internal.spigot.proxy.common.modern.texture
|
||||
import org.bukkit.inventory.meta.SkullMeta
|
||||
|
||||
class Skull : SkullProxy {
|
||||
|
||||
@@ -35,7 +35,7 @@ dependencies {
|
||||
compileOnly("fr.neatmonster:nocheatplus:3.16.1-SNAPSHOT")
|
||||
compileOnly("com.github.jiangdashao:matrix-api-repo:317d4635fd")
|
||||
compileOnly("com.gmail.nossr50.mcMMO:mcMMO:2.1.202")
|
||||
compileOnly("me.clip:placeholderapi:2.11.4")
|
||||
compileOnly("me.clip:placeholderapi:2.11.6")
|
||||
compileOnly("com.github.brcdev-minecraft:shopgui-api:3.0.0")
|
||||
compileOnly("com.github.LoneDev6:API-ItemsAdder:2.4.7")
|
||||
compileOnly("com.arcaniax:HeadDatabase-API:1.3.1")
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
version = 6.74.1
|
||||
version = 6.74.2
|
||||
kotlin.incremental.useClasspathSnapshot=false
|
||||
Reference in New Issue
Block a user