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

General Fix for Head Textures #4026

Closed
wants to merge 3 commits into from
Closed

Conversation

captainbboy
Copy link

Note: I do not believe the fix is completely comprehensive.

Description

I am making this pull request to fix the "Alex/Steve" heads issue that Slimefun currently has on spigot builds > 246. Heads are not being turned into their custom textures.

Proposed changes

I have changed the code to mainly stop using dough-api and instead to use plain Bukkit code to request the textures. I am aware that this probably not a comprehensive fix (meaning I did not remove every instance of DoughAPI's method calls. I just replaced the main SlimefunUtils function and the SlimefunItem function for custom textures), however, I hope this can serve as a base.

Related Issues (if applicable)

Resolves #4024

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.

Note: I do not believe the fix is completely comprehensive.
@captainbboy captainbboy requested a review from a team as a code owner November 22, 2023 17:30
Copy link
Contributor

Pro Tip!
You can help us label your Pull Requests by using the following branch naming convention next time you create a pull request. ❤️

Branch naming convention Label
feature/** 🎈 Feature
fix/** ✨ Fix
chore/** 🧹 Chores
api/** 🔧 API
performance/** 💡 Performance Optimization
compatibility/** 🤝 Compatibility

If your changes do not fall into any of these categories, don't worry. You can just ignore this message in that case! 👀

@J3fftw1
Copy link
Contributor

J3fftw1 commented Nov 22, 2023

If the issue is in dough we will have to fix it on dough side.
I know patching and fixing it later is better.
But i believe this can be easily fixed on doughs side

Copy link
Contributor

@J3fftw1 J3fftw1 left a comment

Choose a reason for hiding this comment

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

Small review since i still think its better to be fixed on doughs side

import java.util.List;
import java.util.Optional;
import java.util.OptionalInt;
import java.util.*;
Copy link
Contributor

Choose a reason for hiding this comment

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

dont star import

Copy link
Author

Choose a reason for hiding this comment

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

apologies, my IDE did that. I've fixed it.


PlayerProfile profile = Bukkit.createPlayerProfile(RANDOM_UUID); // Create a new player profile
PlayerTextures textures = profile.getTextures();
URL urlObject;
Copy link
Contributor

Choose a reason for hiding this comment

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

URL is deprecated please use URI

Copy link
Author

@captainbboy captainbboy Nov 22, 2023

Choose a reason for hiding this comment

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

Are you asking for me to make it a URI and then convert it to URL? <PlayerTextures>.setSkin only accepts a URL parameter.

Copy link
Contributor

@JustAHuman-xD JustAHuman-xD left a comment

Choose a reason for hiding this comment

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

This is also a straight up breaking change, you are throwing an exception in getProfile, and then using that in a method that returns non null. Afaik previously it would send a message to log and give the Steve head if anything went wrong, now it will just stop completely which is a pretty big breaking change.

Copy link
Contributor

Slimefun preview build

A Slimefun preview build is available for testing!
Commit: 840e69d1

https://preview-builds.walshy.dev/download/Slimefun/4026/840e69d1

Note: This is not a supported build and is only here for the purposes of testing.
Do not run this on a live server and do not report bugs anywhere but this PR!

@captainbboy
Copy link
Author

This is also a straight up breaking change, you are throwing an exception in getProfile, and then using that in a method that returns non null. Afaik previously it would send a message to log and give the Steve head if anything went wrong, now it will just stop completely which is a pretty big breaking change.

Have now fixed

@J3fftw1 J3fftw1 mentioned this pull request Nov 22, 2023
7 tasks
@J3fftw1
Copy link
Contributor

J3fftw1 commented Nov 22, 2023

Thanks for the PR but this is getting superceded by #4027

@J3fftw1 J3fftw1 closed this Nov 22, 2023
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.

Custom Player Heads are no Longer Working
3 participants