PaperMC / Paper

The most widely used, high performance Minecraft server that aims to fix gameplay and mechanics inconsistencies
https://papermc.io/
Other
10.03k stars 2.33k forks source link

AttributeModifier getUniqueId broken #11015

Open miniking1000 opened 4 months ago

miniking1000 commented 4 months ago

Expected behavior

To not see an error

Observed/Actual behavior

[08:26:20 ERROR]: [CustomizablePlayerModels] Exception while processing cpm packet: cpm_net:set_scl java.lang.IllegalArgumentException: Invalid UUID string: minecraft:creative_mode_block_range at java.base/java.util.UUID.fromString1(UUID.java:282) ~[?:?] at java.base/java.util.UUID.fromString(UUID.java:260) ~[?:?] at org.bukkit.attribute.AttributeModifier.getUniqueId(AttributeModifier.java:68) ~[paper-api-1.21-R0.1-SNAPSHOT.jar:?] at CustomPlayerModels-Bukkit-0.6.17b.jar/com.tom.cpm.bukkit.AttributeScaler.lambda$setScale$0(AttributeScaler.java:26) ~[CustomPlayerModels-Bukkit-0.6.17b.jar:?] at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:178) ~[?:?] at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708) ~[?:?] at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?] at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?] at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) ~[?:?] at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?] at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) ~[?:?] at CustomPlayerModels-Bukkit-0.6.17b.jar/com.tom.cpm.bukkit.AttributeScaler.lambda$setScale$1(AttributeScaler.java:26) ~[CustomPlayerModels-Bukkit-0.6.17b.jar:?] at java.base/java.util.Arrays$ArrayList.forEach(Arrays.java:4305) ~[?:?] at CustomPlayerModels-Bukkit-0.6.17b.jar/com.tom.cpm.bukkit.AttributeScaler.setScale(AttributeScaler.java:23) ~[CustomPlayerModels-Bukkit-0.6.17b.jar:?] at CustomPlayerModels-Bukkit-0.6.17b.jar/com.tom.cpm.bukkit.AttributeScaler.setScale(AttributeScaler.java:18) ~[CustomPlayerModels-Bukkit-0.6.17b.jar:?] at CustomPlayerModels-Bukkit-0.6.17b.jar/com.tom.cpm.shared.network.NetHandler.lambda$addScaler$14(NetHandler.java:539) ~[CustomPlayerModels-Bukkit-0.6.17b.jar:?] at CustomPlayerModels-Bukkit-0.6.17b.jar/com.tom.cpm.shared.config.PlayerData.rescale(PlayerData.java:140) ~[CustomPlayerModels-Bukkit-0.6.17b.jar:?] at CustomPlayerModels-Bukkit-0.6.17b.jar/com.tom.cpm.shared.config.PlayerData.rescaleToTarget(PlayerData.java:113) ~[CustomPlayerModels-Bukkit-0.6.17b.jar:?] at CustomPlayerModels-Bukkit-0.6.17b.jar/com.tom.cpm.shared.network.packet.SetScaleC2S.handle(SetScaleC2S.java:32) ~[CustomPlayerModels-Bukkit-0.6.17b.jar:?] at CustomPlayerModels-Bukkit-0.6.17b.jar/com.tom.cpm.shared.network.IC2SPacket.handle0(IC2SPacket.java:14) ~[CustomPlayerModels-Bukkit-0.6.17b.jar:?] at CustomPlayerModels-Bukkit-0.6.17b.jar/com.tom.cpm.shared.network.IC2SPacket.handle(IC2SPacket.java:9) ~[CustomPlayerModels-Bukkit-0.6.17b.jar:?] at CustomPlayerModels-Bukkit-0.6.17b.jar/com.tom.cpm.shared.network.IPacket.lambda$handleRaw$0(IPacket.java:13) ~[CustomPlayerModels-Bukkit-0.6.17b.jar:?] at CustomPlayerModels-Bukkit-0.6.17b.jar/com.tom.cpm.shared.network.NetHandler.execute(NetHandler.java:415) ~[CustomPlayerModels-Bukkit-0.6.17b.jar:?] at CustomPlayerModels-Bukkit-0.6.17b.jar/com.tom.cpm.shared.network.IPacket.handleRaw(IPacket.java:13) ~[CustomPlayerModels-Bukkit-0.6.17b.jar:?] at CustomPlayerModels-Bukkit-0.6.17b.jar/com.tom.cpm.shared.network.NetHandler.processPacket(NetHandler.java:199) ~[CustomPlayerModels-Bukkit-0.6.17b.jar:?] at CustomPlayerModels-Bukkit-0.6.17b.jar/com.tom.cpm.shared.network.NetHandler.receiveServer(NetHandler.java:185) ~[CustomPlayerModels-Bukkit-0.6.17b.jar:?] at CustomPlayerModels-Bukkit-0.6.17b.jar/com.tom.cpm.bukkit.Network.onPluginMessageReceived(Network.java:108) ~[CustomPlayerModels-Bukkit-0.6.17b.jar:?] at org.bukkit.plugin.messaging.StandardMessenger.dispatchIncomingMessage(StandardMessenger.java:455) ~[paper-api-1.21-R0.1-SNAPSHOT.jar:?] at net.minecraft.server.network.ServerCommonPacketListenerImpl.handleCustomPayload(ServerCommonPacketListenerImpl.java:197) ~[paper-1.21.jar:1.21-40-b45d9b6] at net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket.handle(ServerboundCustomPayloadPacket.java:26) ~[paper-1.21.jar:1.21-40-b45d9b6] at net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket.handle(ServerboundCustomPayloadPacket.java:13) ~[paper-1.21.jar:1.21-40-b45d9b6] at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$0(PacketUtils.java:36) ~[paper-1.21.jar:1.21-40-b45d9b6] at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.21.jar:1.21-40-b45d9b6] at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:151) ~[paper-1.21.jar:1.21-40-b45d9b6] at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[paper-1.21.jar:1.21-40-b45d9b6] at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1478) ~[paper-1.21.jar:1.21-40-b45d9b6] at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:201) ~[paper-1.21.jar:1.21-40-b45d9b6] at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:125) ~[paper-1.21.jar:1.21-40-b45d9b6] at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1456) ~[paper-1.21.jar:1.21-40-b45d9b6] at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1449) ~[paper-1.21.jar:1.21-40-b45d9b6] at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:135) ~[paper-1.21.jar:1.21-40-b45d9b6] at net.minecraft.server.MinecraftServer.managedBlock(MinecraftServer.java:1408) ~[paper-1.21.jar:1.21-40-b45d9b6] at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1415) ~[paper-1.21.jar:1.21-40-b45d9b6] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1260) ~[paper-1.21.jar:1.21-40-b45d9b6] at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:329) ~[paper-1.21.jar:1.21-40-b45d9b6] at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]

Steps/models to reproduce

1) download latest build of the server for 1.21 2) install latest version of CPM plugin 3) join the server with any model active

Plugin and Datapack List

plugins [08:27:30 INFO]: Server Plugins (40): [08:27:30 INFO]: Paper Plugins: [08:27:30 INFO]: - Socialismus [08:27:30 INFO]: Bukkit Plugins: [08:27:30 INFO]: - Advanced-eHideTags, alice, ArtMap, Badageess, BreweryX, Chunky, CoreProtect, CustomizablePlayerModels, DebugStickCraftingInSurvival, DFanchovments [08:27:30 INFO]: DFBubbleOverBrain, DFCarts, dfmodels, DFWhiteList, DiscordSRV, emotecraft, Essentials, FarmControl, GSit, InvisibleItemFrames [08:27:30 INFO]: LuckPerms, NerfPhantoms, PL-Hide, PlaceholderAPI, PlasmoVoice, PrideAlchemsit, ProtocolLib, pv-addon-discs, pv-addon-groups, pv-addon-lavaplayer-lib [08:27:30 INFO]: pv-addon-sculk, ServerListPlus, SignIt, SnowballDamage, spark, TAB, ToolStats, UsefulWanderingTrader, Vault datapack list [08:27:43 INFO]: There are 5 data pack(s) enabled: [vanilla (built-in)], [file/bukkit (world)], [file/sub-df (world)], [file/dreamfox (world)], [paper (built-in)] [08:27:43 INFO]: There are 1 data pack(s) available: [file/old-DFgames (world)]

Paper version

[08:28:33 INFO]: This server is running Paper version 1.21-40-master@b45d9b6 (2024-07-01T08:23:14Z) (Implementing API version 1.21-R0.1-SNAPSHOT) You are running the latest version Previous version: 1.21-2249-1615793 (MC: 1.21)

Other

I tried to write to CPM, but they said: "Bukkit API implementation bug, report it to paper/purpur. The bukkit api still uses UUIDs, vanilla changed to resource locations in 1.21.", Then to purpur, but they said "Please send the stacktrace generated while using Paper to their bug tracker", so here we are!

MiniDigger commented 4 months ago

code in question: https://github.com/tom5454/CustomPlayerModels/blob/0.6.17b/CustomPlayerModels-1.21/src/platform-shared/java/com/tom/cpm/common/AttributeScaler.java#L26C23-L26C34 they hack around internals instead of using the api it seems. that must be an absolute mess to maintain, lmao

Brokkonaut commented 4 months ago

You are in the wrong class @MiniDigger It is here: https://github.com/tom5454/CustomPlayerModels/blob/0.6.17b/CustomPlayerModels-Bukkit/src/main/java/com/tom/cpm/bukkit/AttributeScaler.java#L26

There is API with NamespacedKeys for that, the plugin should use them in 1.21.

The old UUID based API is completely broken - class AttributeModifier:

    public UUID getUniqueId() {
        return UUID.fromString(getKey().toString());
    }

This is just impossible to work.

lynxplay commented 4 months ago

It's on the tracking list, we have a plan to fix this too 👍

GrenFlem commented 3 months ago

someone let me know if this is fixed, im not actually sure this does anything to the stuff in game, just an error in console for me, works as intended though.

foxya27 commented 2 months ago

UP! We need fix it!

kennytv commented 2 months ago

You shouldn't use that method anymore, even once "fixed". Attributes modifiers no longer have uuids

Lulu13022002 commented 2 months ago

The recent upstream update should "fix" that issue. However spigot only avoid/mitigated the issue and does not retain backward compat since uuid of known attribute modifiers has changed. So some weird things happens where AttributeInstance#getModifier(modifier.getUniqueId()) return null for example.