Skip to content

Fix/head guis - #193

Open
rainbowdashlabs wants to merge 4 commits into
masterfrom
fix/head-guis
Open

Fix/head guis#193
rainbowdashlabs wants to merge 4 commits into
masterfrom
fix/head-guis

Conversation

@rainbowdashlabs

@rainbowdashlabs rainbowdashlabs commented Oct 8, 2024

Copy link
Copy Markdown
Member

This PR is a mess, but it works. I didnt bother for backwards compatibility honestly. Also not about spigot compatibility. Too many people are using latest java, paper and stuff anyway.

@rainbowdashlabs
rainbowdashlabs changed the base branch from development to legacy October 8, 2024 12:32
@rainbowdashlabs
rainbowdashlabs changed the base branch from legacy to master October 8, 2024 12:36
@rainbowdashlabs
rainbowdashlabs marked this pull request as ready for review October 8, 2024 12:58

@SirYwell SirYwell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noted a few things. I think we should also be careful about compatibility, I can work on that later.

}
head.setItemMeta(headMeta);
return head;
UUID uuid = plugin.getServer().getOnlinePlayers().stream().findAny().get().getUniqueId();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the intention here? I think generating a random UUID here was fine before.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes it actually is fine again. It wasnt in a previous iteration

Comment on lines +23 to +25
ItemStack getPlayerHead(UUID owner, String texture);
ItemStack getPlayerHead(OfflinePlayer owner, String texture);
ItemStack getPlayerHead(String texture);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need all those methods? I'd probably just add the method that takes a UUID and a texture - but we should avoid Stringly typed arguments as they can be confusing (you are passing a URL string to it?). The existing methods shouldn't be touched imo.

@rainbowdashlabs rainbowdashlabs Oct 9, 2024

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is mainly about keeping compatibility with legacy, without reinventing the wheel. I mainly went for a "make it work approach" instead of producing fine code.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this is a huge mess right now. legacy might not even work anymore right now...
This is a big abstraction issue, since legacy requires the texture as base64 encoded whatever and latest requires the url encoded in the base46 string

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest way might not even work on older paper versions between 1.13 and 1.18 I think. once again I hate multiversion support xD

@rainbowdashlabs rainbowdashlabs Oct 9, 2024

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Esp since the same method is used to 1. create a player head for the requested owner and 2. to create a player head with some texture. This really messed it up a lot.
Another issue is that the skulls class is part of the core and has to work with two completely different approaches of creating skulls.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, for proper multi-version support the old strategy must exist as fallback on versions that don't have the bukkit PlayerProfile API. I think it's fine to extract the url only as needed. Or alternatively pass an object that holds both the base64 string and the url instead of just a string - that would also help with proper typing.

Comment thread LandLord-core/src/main/java/biz/princeps/landlord/util/Skulls.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants