Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/head guis #193

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Fix/head guis #193

wants to merge 4 commits into from

Conversation

rainbowdashlabs
Copy link
Member

@rainbowdashlabs rainbowdashlabs commented Oct 8, 2024

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
Copy link
Member

@SirYwell SirYwell left a comment

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
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
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
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.

Copy link
Member Author

@rainbowdashlabs rainbowdashlabs Oct 9, 2024

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
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
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

Copy link
Member Author

@rainbowdashlabs rainbowdashlabs Oct 9, 2024

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
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.

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