CobbleSword / NachoSpigot

NachoSpigot is a fork of TacoSpigot 1.8.9 that offers several enhancements to performance as well as bug fixes.
GNU General Public License v3.0
237 stars 88 forks source link

SkullMeta setOwner #127

Open andreasdc opened 3 years ago

andreasdc commented 3 years ago

Will calling setOwner to the same name spam mojang api or will it cache in ItemStack SkullMeta?

andreasdc commented 3 years ago
Sculas commented 3 years ago

@Outfluencer ?

CyberFlameGO commented 2 years ago

This issue seems stale, it should be closed

Rqver commented 2 years ago

I can confirm that using setOwner changes the skin of the head to an alex, then to the correct skin. The alex stays around for 1-2 seconds before updating.

sadcenter commented 2 years ago

I'll work on that.

sadcenter commented 2 years ago

Okay, actually it isn't a bug, it's just minecraft fault... It takes around 450ms to download skin texture. So slow

Sculas commented 2 years ago

Is the skin texture cached?

sadcenter commented 2 years ago

Yea it is, but sometimes there is no player in cache and the server has to download texture. When the skin is alex the server is downloading actual skin. I was thinking about changing GameProfileRepository in MinecraftServer due it's responsible for this stuff. I believe this change would also bring better performance. https://github.com/CobbleSword/NachoSpigot/blob/ebf0841bee5ccf847d0b2dd8d18ec10be6afced8/NachoSpigot-Server/src/main/java/net/minecraft/server/MinecraftServer.java#L133 https://github.com/Electroid/mojang-api - I've heard this api is great, I'm also using this in my auth plugins.

Sculas commented 2 years ago

Spammed that API and Mojang's API a couple of times and it seems that Electroid's API is faster.

Sculas commented 2 years ago

So if you want, feel free to PR that. But keep in mind to keep the old logic for Minecraft's session server in case Electroid's API breaks. We need a fallback in the case that such a thing happens.

Sculas commented 2 years ago

So just do a try-catch, and if that fails send a request to Mojang's API and continue from there. Make sure to log an error for that in the console so we can check what's wrong.

andreasdc commented 2 years ago

You have maybe mojang api from different ips to bypass mojang's limit?

sadcenter commented 2 years ago

Definetly faster, and also Electroid's api has no ratelimit.

andreasdc commented 2 years ago

It uses normal mojang urls, so it has 600 connections per 10 minutes, but I see it has its own url.

sadcenter commented 2 years ago

There is a way to bypass rate limit. https://github.com/Electroid/mojang-api#purpose

sadcenter commented 2 years ago

I think I've done that. It's nearly(or fully?) impossible to make heads load instantly, we would have to make heads sync what would make this even worse, imagine for example 200 heads loading at once and a player has to wait while heads are loading. I made an async implementation of authlib which uses file caching that speeds up the process. (preview https://github.com/sadcenter/NachoSpigot/tree/auth/NachoSpigot-Server/src/main/java/com/github/sadcenter/auth) I'm currently using ashcon api to read textures, the only downside is providing too much data (more data -> it takes more time to deserialize JSON by GSON -> late response). @andreasdc already has suggested to the owner a function to exclude parameters that are not wanted (Electroid/mojang-api#48). I'm almost sure I'll post PR tomorrow. BTW: It's not a bug

Sculas commented 2 years ago

@sadcenter Since there's not a lot of data, you could also just go through each line and find the right one and parse it yourself.

andreasdc commented 2 years ago
  • bug calling setOwner changes skin to alex, then to skin, when doing it again it's again alex, skin.

This was the bug @sadcenter I think

sadcenter commented 2 years ago

Okay, NVM after some tests I've concluded that parsing doesn't make a real difference here

Sculas commented 2 years ago

Also, if possible, make sure to cache it. And check if the player is online, if so grab their skin since when they're online it should be held in memory so you don't need to send a unnecessary http request.

sadcenter commented 2 years ago

It's already in the code BTW: What do you guys think about making accessibility to turn online/offline mode per player, like in bungeecord? This will allow developers to make premium authentication plugins like FastLogin, JPremium, mineLogin on Spigot, currently, this is only available on proxies, etc. IMO Nice feature

andreasdc commented 2 years ago

It's already in the code BTW: What do you guys think about making accessibility to turn online/offline mode per player, like in bungeecord? This will allow developers to make premium authentication plugins like FastLogin, JPremium, mineLogin on Spigot, currently, this is only available on proxies, etc. IMO Nice feature

IMO there are cooler things and optimizations that should be created in Nacho first.

CyberFlameGO commented 2 years ago

It's already in the code

BTW: What do you guys think about making accessibility to turn online/offline mode per player, like in bungeecord? This will allow developers to make premium authentication plugins like FastLogin, JPremium, mineLogin on Spigot, currently, this is only available on proxies, etc.

IMO Nice feature

I always thought it was like servers in the sense that servers can only be offline or online, unless you mean separate proxies (or unless I'm just oblivious to that knowledge). Cool idea, but as @andreasdc said there's other stuff the project is focusing on. If you wanna contribute something like that I'd love to see that on this project, though!

andreasdc commented 2 years ago

It's already in the code BTW: What do you guys think about making accessibility to turn online/offline mode per player, like in bungeecord? This will allow developers to make premium authentication plugins like FastLogin, JPremium, mineLogin on Spigot, currently, this is only available on proxies, etc. IMO Nice feature

I always thought it was like servers in the sense that servers can only be offline or online, unless you mean separate proxies (or unless I'm just oblivious to that knowledge). Cool idea, but as @andreasdc said there's other stuff the project is focusing on. If you wanna contribute something like that I'd love to see that on this project, though!

I think @sadcenter wants to do auth plugin to check premium users on spigot, but I think it's better to look into getCubes, movement, double interactions, packet sending and many other cool optimizations that can be done in Nacho, we are fork of Taco, good fork of Paper, right?

sadcenter commented 2 years ago

I want to add accessibility to set online mode per player in PreLoginEvent which shouldn't be difficult

Sculas commented 2 years ago

@sadcenter Any updates? Might wanna PR this soon if possible so this issue can be closed :)