Skip to content

1.21.9/10: Cannot modify the PropertyMap of WrappedGameProfile because it is immutable #3564

@Brokkonaut

Description

@Brokkonaut
  • This issue is not solved in a development build

Describe the bug
I have code like this:

WrappedGameProfile playerProfile = new WrappedGameProfile(uuid, name);
for (ProfileProperty property : profile.getProperties()) {
  playerProfile.getProperties().put(property.getName(), new WrappedSignedProperty(property.getName(), property.getValue(), property.getSignature()));
}

Exception since 1.21.9 is

Could not set profile property

java.lang.UnsupportedOperationException
at com.google.common.collect.ImmutableMultimap.put(ImmutableMultimap.java:506)
at com.google.common.collect.ForwardingMultimap.put(ForwardingMultimap.java:104)
at ProtocolLib.jar//com.comphenix.protocol.wrappers.GuavaWrappers$1.put(GuavaWrappers.java:95)
at ProtocolLib.jar//com.comphenix.protocol.wrappers.collection.ConvertedMultimap.put(ConvertedMultimap.java:117)
at CubesideNPCs.jar//de.cubeside.npcs.EntityPacketAdapter.onPacketSpawnEntity(EntityPacketAdapter.java:162)
at CubesideNPCs.jar//de.cubeside.npcs.EntityPacketAdapter.onPacketSending(EntityPacketAdapter.java:87)

Possible solution
I think adding a constructor for WrappedGameProfile that also takes the properties map and directly creates a nms GameProfile with properties is the best solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions