Solved PlayerResourcePackStatusEvent Problem

Discussion in 'Spigot Plugin Development' started by Kiwanga, Apr 27, 2017.

  1. So i want to give my player a costume resource-pack for a new game. I tested this code already with Serverresourcepack: enabled
    So if i change it to prompt, I get the request if i want to get the resourcepack. If the player doesn't accept it, i kick him. If he now tries to rejoin he doesn't get the request anymore and gets every time kicked... why?

    Code (Text):
    public class JoineQuit_Listener implements Listener{
        private Main plugin;
        private String prefix = Variables.prefix;
        public JoineQuit_Listener(Main plugin) {
            this.plugin = plugin;
        public void onJoin(PlayerJoinEvent e) {
            Player p = e.getPlayer();
            Bukkit.getScheduler().scheduleAsyncDelayedTask(plugin, new BukkitRunnable() {
                public void run() {
            }, 10);

        public void onChangePack(PlayerResourcePackStatusEvent e) {
            Player p = e.getPlayer();
            PlayerResourcePackStatusEvent.Status status = e.getStatus();
            if (status == PlayerResourcePackStatusEvent.Status.DECLINED) {
                p.kickPlayer(prefix + "§7You have to §aaccept §7the resourcepack in order to play the game!");
            else if (status == PlayerResourcePackStatusEvent.Status.FAILED_DOWNLOAD) {
                p.kickPlayer(prefix + "§7The resourcepack has §cnot §7been loaded! Try again by rejoining!");
            else if (status == PlayerResourcePackStatusEvent.Status.ACCEPTED) {
                p.sendMessage(prefix + "§7Downloading resourcepack...");
            else if (status == PlayerResourcePackStatusEvent.Status.SUCCESSFULLY_LOADED) {
                p.sendMessage(prefix + "§7Resourcepack successfully §aloaded§7!");
  2. You're not supposed to have underscores in your class name! :O

    Anyways, sometimes when a player declines a resource pack, it doesn't ask them again and just automatically refuses. Not sure how to fix that, or even if that's your issue, but I hope it might help out.
  3. Built into Minecraft.
    • Like Like x 2
  4. In that case, it's client-side, so you can't override it from your plugin (not to my knowledge anyways).
  5. Client may be remembering that the user denied the request. Since from my point of view, resource packs were designed to be optional, the client ignores further requests after the user has denied, in order to not annoy the user.

    I'm not 100% sure on this, correct me if I'm wrong as I haven't looked at the resource pack code in a while. A solution you could attempt is changing the hash but I'm not sure that will work. In any case, if the user doesn't want the resource pack, what are the negative consequences?
  6. Yeah i found the problem... it's built into minecraft. If a player has the setting on "Prompt" he will be ask. Now if he clicks no it automaticlly will change to "Disabled". Thank you anyways
  7. WAS


    Beware, resource packs don't always work. I've never ever had a single resource pack prompt ever download. Since the first came out, on win7, 8, 8.1, and now 10. I have to manually find the resource pack. So be sure to list it on your website, cause a lot of websites don't and then I am out of luck xD
  8. Then I wonder, how does Mineplex do it? They ask every time I'm sure.
  9. If i remember correctly, there was a way to do this using packet. Use protocollibs and start brainstorming? Im 90% sure that it has to do with sending a packet.