Cuberite Forum

Full Version: Skins Restorer plugin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
It would be epic to have a SKINSRESTORER plugin for cuberite, and I searched if there is but I have not found it for that I write.It would be epic to have a skin restorer plugin for cuberite, and I searched if there is but I have not found it for that I write.It would be epic to have a skin restorer plugin for cuberite, and I searched if there is but I have not found it for that I write.

Link plugin spigot: SkinsRestorer | SpigotMC - High Performance Minecraft
That would most definitely require some modification in the C++ code.

I looked around and couldn't really understand how the player skin is updated, and even if I did, I don't think I would be able to make it work (I've never programmed in C++ before).
Code:
                Object ep = ReflectionUtil.invokeMethod(p.getClass(), p, "getHandle");
                Object profile = ReflectionUtil.invokeMethod(ep.getClass(), ep, "getProfile");
                Object propMap = ReflectionUtil.invokeMethod(profile.getClass(), profile, "getProperties");
                ReflectionUtil.invokeMethod(propMap, "clear");
                ReflectionUtil.invokeMethod(propMap.getClass(), propMap, "put", new Class[]{Object.class, Object.class}, "textures", props);


It seems like that this is some acres to the mojang code of spigot.     
I think in the end it comes down to those lines:
(04-18-2021, 01:43 PM)12xx12 Wrote: [ -> ]I think in the end it comes down to those lines

Yes, on the Skin Restorer's side. I meant how the skin is updated in Cuberite.

I actually looked around Cuberite's code a bit more and it seems to come down to here, but I'm not 100% sure if you can just set that value to any already-joined cPlayer.

I would have to (and might later, just for curiosity's sake) print the a_Properties variable to see how the skin data is structured.  Smile

Keep in mind that Skins Restorer also does some trickery to actually refresh the player's skin for other players, which seems to be quickly making them invisible and then visible again but I'm not sure if that's all that is needed to make it work.

Also I'm not sure what this does, and if it's needed at all (I'm guessing it is).
(04-19-2021, 12:06 AM)HeCorr Wrote: [ -> ]
(04-18-2021, 01:43 PM)12xx12 Wrote: [ -> ]I think in the end it comes down to those lines

Yes, on the Skin Restorer's side. I meant how the skin is updated in Cuberite.

I actually looked around Cuberite's code a bit more and it seems to come down to here, but I'm not 100% sure if you can just set that value to any already-joined cPlayer.

I would have to (and might later, just for curiosity's sake) print the a_Properties variable to see how the skin data is structured.  Smile

Keep in mind that Skins Restorer also does some trickery to actually refresh the player's skin for other players, which seems to be quickly making them invisible and then visible again but I'm not sure if that's all that is needed to make it work.

Also I'm not sure what this does, and if it's needed at all (I'm guessing it is).

You're right.
We might have to reveal the m_Properties property of client handle to the API or add a c-function which takes a string of the json object and replaces the actual values. Something like:

Code:
cClientHandle::SetSkin(AString & a_SkinJson)
(04-19-2021, 12:33 AM)12xx12 Wrote: [ -> ]You're right.
We might have to reveal the m_Properties property of client handle to the API or add a c-function which takes a string of the json object and replaces the actual values. Something like:

Code:
cClientHandle::SetSkin(AString & a_SkinJson)

Yep, that'd be awesome and I'd love to try to implement such method, but I'd have to learn at least the basics of C++ and setup a dev environment which I'm feeling too lazy to do Big Grin