From 5c99fa13aac90abdfe51c9d6140ccbc5502a8285 Mon Sep 17 00:00:00 2001 From: twisti <76837088+twisti-dev@users.noreply.github.com> Date: Thu, 28 May 2026 11:12:35 +0200 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=94=A7=20chore:=20add=20run=20directo?= =?UTF-8?q?ry=20to=20.gitignore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - include run/ directory to ignore build artifacts - ensure local development files are not tracked --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index b7c785d0..133dd7a1 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,8 @@ build/ !**/src/main/**/build/ !**/src/test/**/build/ +run/ + ### IntelliJ IDEA ### .idea/modules.xml .idea/jarRepositories.xml From a9819d54fb89cf5ab57c0e86ad5cda2440f32c35 Mon Sep 17 00:00:00 2001 From: twisti <76837088+twisti-dev@users.noreply.github.com> Date: Thu, 28 May 2026 11:25:06 +0200 Subject: [PATCH 2/4] =?UTF-8?q?=E2=9C=A8=20feat(hat):=20add=20bypass=20per?= =?UTF-8?q?mission=20for=20hat=20command=20armor=20change=20restriction?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - introduce HAT_COMMAND_BYPASS permission to allow players to change helmets - prevent armor change for players without the bypass permission --- .../surf/essentials/command/HatCommand.kt | 32 +++++++++++++++++++ .../EssentialsPermissionRegistry.kt | 1 + 2 files changed, 33 insertions(+) diff --git a/src/main/kotlin/dev/slne/surf/essentials/command/HatCommand.kt b/src/main/kotlin/dev/slne/surf/essentials/command/HatCommand.kt index bbe6400c..d437fe61 100644 --- a/src/main/kotlin/dev/slne/surf/essentials/command/HatCommand.kt +++ b/src/main/kotlin/dev/slne/surf/essentials/command/HatCommand.kt @@ -1,18 +1,33 @@ package dev.slne.surf.essentials.command +import dev.jorel.commandapi.CommandAPIPaper import dev.jorel.commandapi.kotlindsl.commandTree import dev.jorel.commandapi.kotlindsl.entitySelectorArgumentOnePlayer import dev.jorel.commandapi.kotlindsl.getValue import dev.jorel.commandapi.kotlindsl.playerExecutor +import dev.slne.surf.api.core.messages.adventure.buildText import dev.slne.surf.api.core.messages.adventure.sendText import dev.slne.surf.essentials.util.permission.EssentialsPermissionRegistry +import io.papermc.paper.datacomponent.DataComponentTypes +import org.bukkit.enchantments.Enchantment import org.bukkit.entity.Player +import org.bukkit.inventory.ItemStack fun hatCommand() = commandTree("hat") { withPermission(EssentialsPermissionRegistry.HAT_COMMAND) playerExecutor { player, _ -> val itemInHand = player.inventory.itemInMainHand val helmet = player.inventory.helmet + + if (!player.hasPermission(EssentialsPermissionRegistry.HAT_COMMAND_BYPASS)) { + if (helmet.isPreventArmorChange()) { + throw CommandAPIPaper.failWithAdventureComponent(buildText { + appendErrorPrefix() + error("Du kannst deinen Hut nicht verändern!") + }) + } + } + player.inventory.setHelmet(itemInHand) player.inventory.setItemInMainHand(helmet) @@ -34,6 +49,17 @@ fun hatCommand() = commandTree("hat") { val player: Player by args val itemInHand = executor.inventory.itemInMainHand val helmet = player.inventory.helmet + + if (!executor.hasPermission(EssentialsPermissionRegistry.HAT_COMMAND_BYPASS)) { + if (helmet.isPreventArmorChange()) { + throw CommandAPIPaper.failWithAdventureComponent(buildText { + appendErrorPrefix() + variableValue(player.name) + error("s Hut kann nicht verändert werden!") + }) + } + } + player.inventory.setHelmet(itemInHand) player.inventory.setItemInMainHand(helmet) @@ -60,4 +86,10 @@ fun hatCommand() = commandTree("hat") { } } } +} + +@Suppress("UnstableApiUsage") +private fun ItemStack.isPreventArmorChange(): Boolean { + val enchantments = getData(DataComponentTypes.ENCHANTMENTS) ?: return false + return enchantments.enchantments().keys.any { it.key() == Enchantment.BINDING_CURSE.key() } } \ No newline at end of file diff --git a/src/main/kotlin/dev/slne/surf/essentials/util/permission/EssentialsPermissionRegistry.kt b/src/main/kotlin/dev/slne/surf/essentials/util/permission/EssentialsPermissionRegistry.kt index 5dc06d46..b4ba67eb 100644 --- a/src/main/kotlin/dev/slne/surf/essentials/util/permission/EssentialsPermissionRegistry.kt +++ b/src/main/kotlin/dev/slne/surf/essentials/util/permission/EssentialsPermissionRegistry.kt @@ -22,6 +22,7 @@ object EssentialsPermissionRegistry : PermissionRegistry() { val HEAL_COMMAND_OTHERS = create("$PREFIX.heal.command.others") val HAT_COMMAND = create("$PREFIX.hat.command") val HAT_COMMAND_OTHERS = create("$PREFIX.hat.command.others") + val HAT_COMMAND_BYPASS = create("$PREFIX.hat.command.bypass") val LIST_COMMAND = create("$PREFIX.list.command") val LIST_COMMAND_WORLD = create("$PREFIX.list.command.world") val TRASH_COMMAND = create("$PREFIX.trash.command") From 2546d75f0410cc4be1f4a4e1a256b1b99b3398c0 Mon Sep 17 00:00:00 2001 From: twisti <76837088+twisti-dev@users.noreply.github.com> Date: Thu, 28 May 2026 11:25:26 +0200 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=94=A7=20chore:=20update=20version=20?= =?UTF-8?q?in=20gradle.properties=20to=203.3.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 2c820d7a..ba2ef6b3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ kotlin.code.style=official kotlin.stdlib.default.dependency=false org.gradle.parallel=true -version=3.3.1 \ No newline at end of file +version=3.3.2 \ No newline at end of file From f795d3c74bd47be4680b113dfc28da20c441a801 Mon Sep 17 00:00:00 2001 From: twisti <76837088+twisti-dev@users.noreply.github.com> Date: Thu, 28 May 2026 11:27:29 +0200 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=94=A7=20chore(build):=20configure=20?= =?UTF-8?q?runServer=20to=20use=20Surf=20API=20Bukkit=20integration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - add withSurfApiBukkit() to runServer configuration in build.gradle.kts --- build.gradle.kts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index 6f254632..eee69bc8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,5 @@ import dev.slne.surf.api.gradle.util.registerRequired +import dev.slne.surf.api.gradle.util.withSurfApiBukkit plugins { id("dev.slne.surf.api.gradle.paper-plugin") @@ -19,6 +20,14 @@ surfPaperPluginApi { } authors.addAll("twisti", "red", "mikey") + + runServer { + withSurfApiBukkit() + } +} + +runPaper { + folia.registerTask() } dependencies {