bump 26.1
This commit is contained in:
parent
fa5142290c
commit
725ba737ae
|
|
@ -1,13 +1,14 @@
|
||||||
|
import io.papermc.paperweight.userdev.ReobfArtifactConfiguration
|
||||||
import net.minecrell.pluginyml.paper.PaperPluginDescription
|
import net.minecrell.pluginyml.paper.PaperPluginDescription
|
||||||
|
|
||||||
group = "net.hareworks"
|
group = "net.hareworks"
|
||||||
version = "1.0"
|
version = "1.0"
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm") version "2.2.21"
|
kotlin("jvm") version "2.3.21"
|
||||||
id("de.eldoria.plugin-yml.paper") version "0.8.0"
|
id("de.eldoria.plugin-yml.paper") version "0.9.0"
|
||||||
id("com.gradleup.shadow") version "9.2.2"
|
id("com.gradleup.shadow") version "9.2.2"
|
||||||
id("io.papermc.paperweight.userdev") version "2.0.0-beta.19"
|
id("io.papermc.paperweight.userdev") version "2.0.0-beta.21"
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|
@ -15,25 +16,27 @@ repositories {
|
||||||
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
|
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
paperweight.reobfArtifactConfiguration = ReobfArtifactConfiguration.MOJANG_PRODUCTION
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly("me.clip:placeholderapi:2.11.6")
|
compileOnly("me.clip:placeholderapi:2.11.6")
|
||||||
paperweight.paperDevBundle("1.21.11-R0.1-SNAPSHOT")
|
paperweight.paperDevBundle("26.1.2.build.49-beta")
|
||||||
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:2.1.0")
|
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:2.1.0")
|
||||||
implementation("net.hareworks:kommand-lib:1.1")
|
implementation("net.hareworks:kommand-lib:1.1")
|
||||||
implementation("net.hareworks:permits-lib:1.1")
|
implementation("net.hareworks:permits-lib:1.1")
|
||||||
compileOnly("net.kyori:adventure-text-minimessage:4.17.0")
|
compileOnly("net.kyori:adventure-text-minimessage:4.26.1")
|
||||||
compileOnly("net.kyori:adventure-text-serializer-plain:4.17.0")
|
compileOnly("net.kyori:adventure-text-serializer-plain:4.26.1")
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
jvmToolchain(21)
|
jvmToolchain(25)
|
||||||
}
|
}
|
||||||
|
|
||||||
paper {
|
paper {
|
||||||
main = "net.hareworks.ghostdisplays.GhostDisplaysPlugin"
|
main = "net.hareworks.ghostdisplays.GhostDisplaysPlugin"
|
||||||
name = "GhostDisplays"
|
name = "GhostDisplays"
|
||||||
version = project.version as String
|
version = project.version as String
|
||||||
apiVersion = "1.21"
|
apiVersion = "26.1"
|
||||||
foliaSupported = true
|
foliaSupported = true
|
||||||
description = "Invisible display entity controller library."
|
description = "Invisible display entity controller library."
|
||||||
authors = listOf("Hareworks")
|
authors = listOf("Hareworks")
|
||||||
|
|
@ -63,7 +66,4 @@ tasks {
|
||||||
exclude(dependency("org.jetbrains.kotlin:kotlin-stdlib-jdk7"))
|
exclude(dependency("org.jetbrains.kotlin:kotlin-stdlib-jdk7"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assemble {
|
|
||||||
dependsOn(reobfJar)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 9e1ee75736bbbecc7ef69f229c2bb55a8f4fbce8
|
Subproject commit 99ad5009154115833816ace9c3da5a28ecd77344
|
||||||
|
|
@ -2,8 +2,8 @@ package net.hareworks.ghostdisplays.internal.nms
|
||||||
|
|
||||||
import io.netty.channel.ChannelDuplexHandler
|
import io.netty.channel.ChannelDuplexHandler
|
||||||
import io.netty.channel.ChannelHandlerContext
|
import io.netty.channel.ChannelHandlerContext
|
||||||
import java.lang.invoke.MethodHandles
|
|
||||||
import java.util.logging.Level
|
import java.util.logging.Level
|
||||||
|
import net.minecraft.network.protocol.game.ServerboundAttackPacket
|
||||||
import net.minecraft.network.protocol.game.ServerboundInteractPacket
|
import net.minecraft.network.protocol.game.ServerboundInteractPacket
|
||||||
import net.minecraft.world.InteractionHand
|
import net.minecraft.world.InteractionHand
|
||||||
import org.bukkit.craftbukkit.entity.CraftPlayer
|
import org.bukkit.craftbukkit.entity.CraftPlayer
|
||||||
|
|
@ -35,18 +35,6 @@ internal class InteractionPacketListener(
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val HANDLER_NAME = "ghostdisplays_interact"
|
private const val HANDLER_NAME = "ghostdisplays_interact"
|
||||||
|
|
||||||
private val ENTITY_ID_GETTER = run {
|
|
||||||
val lookup = MethodHandles.privateLookupIn(
|
|
||||||
ServerboundInteractPacket::class.java,
|
|
||||||
MethodHandles.lookup()
|
|
||||||
)
|
|
||||||
lookup.findGetter(
|
|
||||||
ServerboundInteractPacket::class.java,
|
|
||||||
"entityId",
|
|
||||||
Int::class.javaPrimitiveType
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun injectAll() {
|
fun injectAll() {
|
||||||
|
|
@ -83,46 +71,40 @@ internal class InteractionPacketListener(
|
||||||
private fun createHandler(player: Player): ChannelDuplexHandler {
|
private fun createHandler(player: Player): ChannelDuplexHandler {
|
||||||
return object : ChannelDuplexHandler() {
|
return object : ChannelDuplexHandler() {
|
||||||
override fun channelRead(ctx: ChannelHandlerContext, msg: Any) {
|
override fun channelRead(ctx: ChannelHandlerContext, msg: Any) {
|
||||||
if (msg is ServerboundInteractPacket) {
|
try {
|
||||||
try {
|
when (msg) {
|
||||||
val entityId = ENTITY_ID_GETTER.invoke(msg) as Int
|
is ServerboundInteractPacket -> {
|
||||||
val data = extractAction(entityId, msg)
|
val pos = msg.location()
|
||||||
onInteract(player, data)
|
onInteract(
|
||||||
} catch (ex: Throwable) {
|
player,
|
||||||
plugin.logger.log(Level.WARNING, "Failed to handle interact packet", ex)
|
InteractData(
|
||||||
|
entityId = msg.entityId(),
|
||||||
|
action = InteractAction.INTERACT_AT,
|
||||||
|
hand = toBukkit(msg.hand()),
|
||||||
|
clickPosition = org.bukkit.util.Vector(pos.x, pos.y, pos.z),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
is ServerboundAttackPacket -> {
|
||||||
|
onInteract(
|
||||||
|
player,
|
||||||
|
InteractData(
|
||||||
|
entityId = msg.entityId(),
|
||||||
|
action = InteractAction.ATTACK,
|
||||||
|
hand = null,
|
||||||
|
clickPosition = null,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (ex: Throwable) {
|
||||||
|
plugin.logger.log(Level.WARNING, "Failed to handle interact packet", ex)
|
||||||
}
|
}
|
||||||
super.channelRead(ctx, msg)
|
super.channelRead(ctx, msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun extractAction(entityId: Int, packet: ServerboundInteractPacket): InteractData {
|
|
||||||
var action = InteractAction.ATTACK
|
|
||||||
var hand: EquipmentSlot? = null
|
|
||||||
var clickPos: org.bukkit.util.Vector? = null
|
|
||||||
|
|
||||||
packet.dispatch(object : ServerboundInteractPacket.Handler {
|
|
||||||
override fun onInteraction(nmsHand: InteractionHand) {
|
|
||||||
action = InteractAction.INTERACT
|
|
||||||
hand = toBukkit(nmsHand)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onInteraction(nmsHand: InteractionHand, pos: net.minecraft.world.phys.Vec3) {
|
|
||||||
action = InteractAction.INTERACT_AT
|
|
||||||
hand = toBukkit(nmsHand)
|
|
||||||
clickPos = org.bukkit.util.Vector(pos.x, pos.y, pos.z)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onAttack() {
|
|
||||||
action = InteractAction.ATTACK
|
|
||||||
hand = null
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
return InteractData(entityId, action, hand, clickPos)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun toBukkit(hand: InteractionHand): EquipmentSlot = when (hand) {
|
private fun toBukkit(hand: InteractionHand): EquipmentSlot = when (hand) {
|
||||||
InteractionHand.MAIN_HAND -> EquipmentSlot.HAND
|
InteractionHand.MAIN_HAND -> EquipmentSlot.HAND
|
||||||
InteractionHand.OFF_HAND -> EquipmentSlot.OFF_HAND
|
InteractionHand.OFF_HAND -> EquipmentSlot.OFF_HAND
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user