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

Fixes #4020 #4193

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Dinnerwolph
Copy link

@Dinnerwolph Dinnerwolph commented May 20, 2024

Description

Proposed changes

Related Issues (if applicable)

Resolves #4020

Checklist

  • I have fully tested the proposed changes and promise that they will not break everything into chaos.
  • I have also tested the proposed changes in combination with various popular addons and can confirm my changes do not break them.
  • I have made sure that the proposed changes do not break compatibility across the supported Minecraft versions (1.16.* - 1.20.*).
  • I followed the existing code standards and didn't mess up the formatting.
  • I did my best to add documentation to any public classes or methods I added.
  • I have added Nonnull and Nullable annotations to my methods to indicate their behaviour for null values
  • I added sufficient Unit Tests to cover my code.

@Dinnerwolph Dinnerwolph requested a review from a team as a code owner May 20, 2024 15:21
Copy link
Contributor

Your Pull Request was automatically labelled as: "✨ Fix"
Thank you for contributing to this project! ❤️

@github-actions github-actions bot added the ✨ Fix This Pull Request fixes an issue. label May 20, 2024
Comment on lines +496 to +508
if (itemMeta instanceof BookMeta itemBookMeta && sfitemMeta instanceof BookMeta sfItemBookMeta) {
if(itemBookMeta.getAuthor() != sfItemBookMeta.getAuthor())
return false;
if(itemBookMeta.getTitle() != sfItemBookMeta.getTitle())
return false;
if(itemBookMeta.getPageCount() != sfItemBookMeta.getPageCount())
return false;
}

if (itemMeta instanceof SkullMeta itemHeadMeta && sfitemMeta instanceof SkullMeta sfItemHeadMeta) {
if(itemHeadMeta.getOwningPlayer() != sfItemHeadMeta.getOwningPlayer())
return false;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Other than the codestyle this looks good, only thing I think is wrong is the if statements are missing brackets and some spaces.

Other than that functionally its probably okay but you can inline the returns to be like
return itemBookMeta.getAuthor().equals(sfItemBookMeta.getAuthor() && etc etc
or
return itemHeadMeta.getOwningPlayer().equals(sfItemHeadMeta.getOwningPlayer());
I'm not 100% sure that the player check is a good idea since it's nullable iirc, so you might need to change that, I'd have to check to be completely sure

@TheBusyBot TheBusyBot added the ⚡ Merge Conflicts This Pull Request has merged conflicts which need to be resolved! label Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Fix This Pull Request fixes an issue. ⚡ Merge Conflicts This Pull Request has merged conflicts which need to be resolved!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Books and player heads metadata copy/dupe
3 participants