Skip to content

Commit

Permalink
Merge branch 'refs/heads/master' into new-data-handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Aug 24, 2024
2 parents f1b71c2 + 93bcf6c commit 449bcc1
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 12 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ allprojects {
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")

// ProtocolLib
//maven("https://repo.dmulloy2.net/nexus/repository/public/")
maven("https://repo.dmulloy2.net/nexus/repository/public/")

// WorldGuard
maven("https://maven.enginehub.org/repo/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ object ArgParserEnchantment : LookupArgParser {
val enchants = mutableMapOf<Enchantment, Int>()

for (arg in args) {
val argSplit = arg.split(":")
try {
val argSplit = arg.split(":")

val enchant = Enchantment.getByKey(NamespacedKey.minecraft(argSplit[0].lowercase())) ?: continue
val level = argSplit.getOrNull(1)?.toIntOrNull() ?: enchant.maxLevel
val enchant = Enchantment.getByKey(NamespacedKey.minecraft(argSplit[0].lowercase())) ?: continue
val level = argSplit.getOrNull(1)?.toIntOrNull() ?: enchant.maxLevel

enchants[enchant] = level
enchants[enchant] = level
} catch (e: IllegalArgumentException) {
continue
}
}

if (enchants.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ object ParticleFactoryRGB : ParticleFactory {
if (Prerequisite.HAS_1_20_5.isMet) {
Particle.valueOf("DUST")
} else {
Particle.valueOf("REDSTONE_DUST")
Particle.valueOf("REDSTONE")
}
}.getOrNull()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@ package com.willfp.eco.internal.spigot.proxy.common.packet.display
import com.willfp.eco.core.EcoPlugin
import com.willfp.eco.core.packet.PacketEvent
import com.willfp.eco.core.packet.PacketListener
import com.willfp.eco.internal.spigot.proxy.common.toResourceLocation
import com.willfp.eco.util.namespacedKeyOf
import net.minecraft.network.protocol.game.ClientboundPlaceGhostRecipePacket
import net.minecraft.resources.ResourceLocation

class PacketAutoRecipe(
private val plugin: EcoPlugin
) : PacketListener {
private val fKey = ClientboundPlaceGhostRecipePacket::class.java
.declaredFields
.first { it.type == ResourceLocation::class.java }
.apply { isAccessible = true }

override fun onSend(event: PacketEvent) {
val packet = event.packet.handle as? ClientboundPlaceGhostRecipePacket ?: return

Expand All @@ -24,9 +31,7 @@ class PacketAutoRecipe(
return
}

val fKey = packet.javaClass.getDeclaredField("b")
fKey.isAccessible = true
val key = fKey[packet] as ResourceLocation
fKey[packet] = ResourceLocation(key.namespace, key.path + "_displayed")
fKey[packet] = namespacedKeyOf(key.namespace, key.path + "_displayed").toResourceLocation()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import net.minecraft.util.Unit
import net.minecraft.world.item.component.CustomData
import net.minecraft.world.item.component.CustomModelData
import net.minecraft.world.item.component.ItemLore
import net.minecraft.world.item.enchantment.ItemEnchantments
import org.bukkit.Bukkit
import org.bukkit.craftbukkit.CraftRegistry
import org.bukkit.craftbukkit.CraftServer
Expand Down Expand Up @@ -53,7 +54,7 @@ class NewEcoFastItemStack(
private val pdc = (handle.get(DataComponents.CUSTOM_DATA)?.copyTag() ?: CompoundTag()).makePdc()

override fun getEnchants(checkStored: Boolean): Map<Enchantment, Int> {
val enchantments = handle.get(DataComponents.ENCHANTMENTS) ?: return emptyMap()
val enchantments = handle.get(DataComponents.ENCHANTMENTS) ?: ItemEnchantments.EMPTY

val map = mutableMapOf<Enchantment, Int>()

Expand Down
2 changes: 1 addition & 1 deletion eco-core/core-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dependencies {
compileOnly("io.papermc.paper:paper-api:1.20.2-R0.1-SNAPSHOT")

// Plugin dependencies
compileOnly("com.comphenix.protocol:ProtocolLib:5.0.0-SNAPSHOT")
compileOnly("com.comphenix.protocol:ProtocolLib:5.1.0")
compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.0.7-SNAPSHOT")
compileOnly("com.github.TechFortress:GriefPrevention:16.17.1")
compileOnly("com.github.TownyAdvanced:Towny:0.99.5.21") {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version = 6.73.4
version = 6.73.7
kotlin.incremental.useClasspathSnapshot=false

0 comments on commit 449bcc1

Please sign in to comment.