1

I code currently a minecraft java plugin which loads a texturepack but I have a problem. When you decline the download of the texturepack, it will never ask again for downloading or accepting and I never got a error.

I used this code:

player.setResourcepack("<url>");

and it showed one time so it does work but never ask again if I decline it. Please help.

pppery
  • 3,731
  • 22
  • 33
  • 46

3 Answers3

1

Yes, this is expected behavior. If a player decline resourcepack installation once then he will never receive an installation request again.

https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/Player.html#setResourcePack(java.lang.String)

  • but many Servers are reasking if i decline. Also some plugins does this to. I also tryed to analyse the code from one plugin wich can reask and found nothing. It uses the exact same code player.setResourcepack(""); – DAOCMINECRAFT Jul 01 '22 at 12:25
  • @DAOCMINECRAFT probably it's possible using NMS and packet sending of the resourcepack request. The easiest way is just kick player in case of declined request. See [PlayerResourcePackStatusEvent](https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/player/PlayerResourcePackStatusEvent.html). – Feniksovich Jul 02 '22 at 12:27
1

Try to provide a new version of the texture pack or rename the texture pack. As a result the players should receive a new request.

Funzter
  • 86
  • 5
1

You can send packages and listen to the responses. There are many ways to do so. Essentially, you have to send a PacketPlayOutResourcePackSend packet with the necessary information.

Afterwards, listen to the PacketPlayInResourcePackStatus. There are just a few possible states: SUCCESSFULLY_LOADED, DECLINED, FAILED_DOWNLOAD, ACCEPTED. In theory, you have to resend the package request once the state is DECLINED. (Like my credit card -.-)

I can't give you any more details since I haven't used this in a while, but no one else seemed to answer your question.

micartey
  • 128
  • 6