mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 08:14:00 +02:00
Merge branch 'main' into feature/set-lore
This commit is contained in:
commit
2d66aa44ba
14 changed files with 176 additions and 23 deletions
2
.github/workflows/gradle.yml
vendored
2
.github/workflows/gradle.yml
vendored
|
|
@ -41,7 +41,7 @@ jobs:
|
|||
- name: Make gradlew executable
|
||||
run: chmod +x ./gradlew
|
||||
- name: Build with Gradle Wrapper
|
||||
run: ./gradlew build
|
||||
run: ./gradlew build --parallel
|
||||
|
||||
- name: Summarize tests results
|
||||
uses: jeantessier/test-summary-action@v1
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# Custom Anvil
|
||||
|
||||
**Custom Anvil** is a plugin that allows server administrators to customize every aspect of the anvil's mechanics.
|
||||
It is expected to work on 1.18 to 1.21.3 minecraft servers running spigot or paper.
|
||||
It is expected to work on 1.18 to 1.21.5 minecraft servers running spigot or paper.
|
||||
(the plugin support of 1.16.5 to 1.17.1 is experimental and may encounter issues)
|
||||
|
||||
**Custom Anvil** was previously named **Unsafe Enchants+**.
|
||||
|
|
@ -87,7 +87,7 @@ as low priority as I work for the plugin on my free time for free.
|
|||
|
||||
One of the configurations allow displaying price about 40 and removing Too Expensive. \
|
||||
By how the minecraft client work: price above 40 can only be displayed green, even if the player does not own enough experience level.
|
||||
Minecraft version 1.17 to 1.21.1 do not need any dependency. Other version need ProtocoLib enabled on your server for this feature. \
|
||||
Minecraft version 1.17 to 1.21.5 do not need any dependency. Other version need ProtocoLib enabled on your server for this feature. \
|
||||
You can also wait for an update of the plugin to support a newer version.
|
||||
|
||||
Please note that 1.16.5 to 1.17.1 are not officially supported. Run at your own risk.
|
||||
|
|
@ -100,7 +100,7 @@ For information about the API, please refer to [the Wiki](https://github.com/ale
|
|||
|
||||
### Default Plugin's Configurations
|
||||
For 1.18 to 1.20.6 use the [1.18 configurations](https://github.com/alexcrea/CustomAnvil/tree/master/defaultconfigs/1.18)\
|
||||
For 1.21 to 1.21.1 use the [1.21 configurations](https://github.com/alexcrea/CustomAnvil/tree/master/defaultconfigs/1.21)
|
||||
For 1.21 to 1.21.5 use the [1.21 configurations](https://github.com/alexcrea/CustomAnvil/tree/master/defaultconfigs/1.21)
|
||||
|
||||
---
|
||||
Custom anvil [use bstat](https://bstats.org/plugin/bukkit/Unsafe%20Enchants%20Plus/20923) for metric. You can [disable it](https://bstats.org/getting-started) if you like.
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ plugins {
|
|||
}
|
||||
|
||||
group = "xyz.alexcrea"
|
||||
version = "1.9.1"
|
||||
version = "1.10.1"
|
||||
|
||||
repositories {
|
||||
// EcoEnchants
|
||||
|
|
@ -67,6 +67,7 @@ dependencies {
|
|||
implementation(project(":nms:v1_21R1", configuration = "reobf"))
|
||||
implementation(project(":nms:v1_21R2", configuration = "reobf"))
|
||||
implementation(project(":nms:v1_21R3", configuration = "reobf"))
|
||||
implementation(project(":nms:v1_21R4"))//, configuration = "reobf")) // TODO add again when paperweigh 1.21.5 update
|
||||
|
||||
// include kotlin for the offline jar
|
||||
implementation(kotlin("stdlib"))
|
||||
|
|
|
|||
|
|
@ -3,6 +3,6 @@ kotlin.code.style=official
|
|||
# Signing
|
||||
signing.gnupg.executable=gpg
|
||||
signing.gnupg.useLegacyGpg=true
|
||||
signing.gnupg.keyName=B0DBF91F
|
||||
signing.gnupg.keyName=2D3280C5
|
||||
|
||||
kotlin.daemon.jvmargs=-Xmx8G
|
||||
|
|
@ -7,28 +7,11 @@ import xyz.alexcrea.cuanvil.dependency.gui.ExternGuiTester
|
|||
class v1_21R1_ExternGuiTester: ExternGuiTester {
|
||||
override val wesjdAnvilGuiName = "Wrapper1_21_R1"
|
||||
|
||||
var tested = false;
|
||||
var possible = false;
|
||||
|
||||
override fun getContainerClass(view: InventoryView): Class<Any>? {
|
||||
// In case we are in a test environment
|
||||
if(!tested) testClassExist()
|
||||
if(!possible) return null
|
||||
|
||||
if(view !is CraftInventoryView<*, *>) return null
|
||||
val container = view.handle
|
||||
|
||||
return container.javaClass
|
||||
}
|
||||
|
||||
fun testClassExist(){
|
||||
tested = true;
|
||||
try {
|
||||
Class.forName("org.bukkit.craftbukkit.inventory.CraftInventoryView")
|
||||
possible = true
|
||||
} catch (e: ClassNotFoundException){
|
||||
possible = false
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
package xyz.alexcrea.cuanvil.dependency.gui.version
|
||||
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryView
|
||||
import org.bukkit.inventory.InventoryView
|
||||
import xyz.alexcrea.cuanvil.dependency.gui.ExternGuiTester
|
||||
|
||||
class v1_21R2_ExternGuiTester: ExternGuiTester {
|
||||
override val wesjdAnvilGuiName = "Wrapper1_21_R2"
|
||||
|
||||
var tested = false;
|
||||
var possible = false;
|
||||
|
||||
override fun getContainerClass(view: InventoryView): Class<Any>? {
|
||||
// In case we are in a test environment
|
||||
if(!tested) testClassExist()
|
||||
if(!possible) return null
|
||||
|
||||
if(view !is CraftInventoryView<*, *>) return null
|
||||
val container = view.handle
|
||||
|
||||
return container.javaClass
|
||||
}
|
||||
|
||||
fun testClassExist(){
|
||||
tested = true;
|
||||
try {
|
||||
Class.forName("org.bukkit.craftbukkit.inventory.CraftInventoryView")
|
||||
possible = true
|
||||
} catch (e: ClassNotFoundException){
|
||||
possible = false
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package xyz.alexcrea.cuanvil.dependency.gui.version
|
||||
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryView
|
||||
import org.bukkit.inventory.InventoryView
|
||||
import xyz.alexcrea.cuanvil.dependency.gui.ExternGuiTester
|
||||
|
||||
class v1_21R3_ExternGuiTester: ExternGuiTester {
|
||||
override val wesjdAnvilGuiName = "Wrapper1_21_R3"
|
||||
|
||||
override fun getContainerClass(view: InventoryView): Class<Any>? {
|
||||
if(view !is CraftInventoryView<*, *>) return null
|
||||
val container = view.handle
|
||||
|
||||
return container.javaClass
|
||||
}
|
||||
|
||||
}
|
||||
1
nms/v1_21R4/.gitignore
vendored
Normal file
1
nms/v1_21R4/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
.lastDeploymentsId
|
||||
44
nms/v1_21R4/build.gradle.kts
Normal file
44
nms/v1_21R4/build.gradle.kts
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
|
||||
group = rootProject.group
|
||||
version = rootProject.version
|
||||
|
||||
plugins {
|
||||
id("io.papermc.paperweight.userdev")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":nms:nms-common"))
|
||||
|
||||
// Used for nms
|
||||
paperweight.paperDevBundle("1.21.5-no-moonrise-SNAPSHOT")
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven("https://repo.papermc.io/repository/maven-public/")
|
||||
|
||||
mavenLocal()//TODO remove when paperDevBundle 1.21.5 release
|
||||
}
|
||||
|
||||
// minecraft 1.21 java version is 21.
|
||||
|
||||
// Configure used version of kotlin and java
|
||||
java {
|
||||
disableAutoTargetJvm()
|
||||
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
|
||||
}
|
||||
|
||||
// Set target version
|
||||
tasks.withType<JavaCompile>().configureEach {
|
||||
sourceCompatibility = "21"
|
||||
targetCompatibility = "21"
|
||||
|
||||
options.encoding = "UTF-8"
|
||||
}
|
||||
|
||||
kotlin {
|
||||
compilerOptions {
|
||||
apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
|
||||
jvmTarget.set(JvmTarget.JVM_21)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package xyz.alexcrea.cuanvil.dependency.gui.version
|
||||
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryView
|
||||
import org.bukkit.inventory.InventoryView
|
||||
import xyz.alexcrea.cuanvil.dependency.gui.ExternGuiTester
|
||||
|
||||
class v1_21R4_ExternGuiTester: ExternGuiTester {
|
||||
override val wesjdAnvilGuiName = "Wrapper1_21_R4"
|
||||
|
||||
var tested = false;
|
||||
var possible = false;
|
||||
|
||||
override fun getContainerClass(view: InventoryView): Class<Any>? {
|
||||
// In case we are in a test environment
|
||||
if(!tested) testClassExist()
|
||||
if(!possible) return null
|
||||
|
||||
if(view !is CraftInventoryView<*, *>) return null
|
||||
val container = view.handle
|
||||
|
||||
return container.javaClass
|
||||
}
|
||||
|
||||
fun testClassExist(){
|
||||
tested = true;
|
||||
try {
|
||||
Class.forName("org.bukkit.craftbukkit.inventory.CraftInventoryView")
|
||||
possible = true
|
||||
} catch (e: ClassNotFoundException){
|
||||
possible = false
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package xyz.alexcrea.cuanvil.dependency.packet.versions
|
||||
|
||||
import net.minecraft.network.protocol.game.ClientboundPlayerAbilitiesPacket
|
||||
import net.minecraft.world.entity.player.Abilities
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer
|
||||
import org.bukkit.entity.Player
|
||||
import xyz.alexcrea.cuanvil.dependency.packet.PacketManager
|
||||
import xyz.alexcrea.cuanvil.dependency.packet.PacketManagerBase
|
||||
|
||||
class V1_21R4_PacketManager : PacketManagerBase(), PacketManager {
|
||||
override val canSetInstantBuild: Boolean
|
||||
get() = true
|
||||
|
||||
override fun setInstantBuild(player: Player, instantBuild: Boolean) {
|
||||
val nmsPlayer = (player as CraftPlayer).handle
|
||||
val playerAbilities = nmsPlayer.abilities
|
||||
val sendedAbilities: Abilities
|
||||
if (playerAbilities.instabuild == instantBuild) {
|
||||
sendedAbilities = playerAbilities
|
||||
} else {
|
||||
sendedAbilities = Abilities()
|
||||
sendedAbilities.invulnerable = playerAbilities.invulnerable
|
||||
sendedAbilities.flying = playerAbilities.flying
|
||||
sendedAbilities.mayfly = playerAbilities.mayfly
|
||||
sendedAbilities.instabuild = instantBuild
|
||||
sendedAbilities.mayBuild = playerAbilities.mayBuild
|
||||
sendedAbilities.flyingSpeed = playerAbilities.flyingSpeed
|
||||
sendedAbilities.walkingSpeed = playerAbilities.walkingSpeed
|
||||
}
|
||||
val packet = ClientboundPlayerAbilitiesPacket(sendedAbilities)
|
||||
nmsPlayer.connection.send(packet)
|
||||
}
|
||||
}
|
||||
|
|
@ -29,6 +29,8 @@ include("nms:v1_21R2")
|
|||
findProject(":nms:v1_21R2")?.name = "v1_21R2"
|
||||
include("nms:v1_21R3")
|
||||
findProject(":nms:v1_21R3")?.name = "v1_21R3"
|
||||
include("nms:v1_21R4")
|
||||
findProject(":nms:v1_21R4")?.name = "v1_21R4"
|
||||
|
||||
include(":impl:LegacyEcoEnchant")
|
||||
findProject(":impl:LegacyEcoEnchant")?.name = "LegacyEcoEnchant"
|
||||
|
|
@ -41,6 +41,9 @@ object GuiTesterSelector {
|
|||
|
||||
21 -> when (versionParts[2]) {
|
||||
0, 1 -> v1_21R1_ExternGuiTester()
|
||||
2, 3 -> v1_21R2_ExternGuiTester()
|
||||
4 -> v1_21R3_ExternGuiTester()
|
||||
5 -> v1_21R4_ExternGuiTester()
|
||||
else -> null
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ object PacketManagerSelector {
|
|||
0, 1 -> V1_21R1_PacketManager()
|
||||
2, 3 -> V1_21R2_PacketManager()
|
||||
4 -> V1_21R3_PacketManager()
|
||||
5 -> V1_21R4_PacketManager()
|
||||
else -> null
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue