setResourcePack not working after "No"

Discussion in 'Plugin Development' started by Maximvdw, Mar 13, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Maximvdw

    Dear Bukkiteers,

    I have a problem with setResoucePack (haven't used it since setTexturePack).
    It works the first time on a unique server IP. But if I try it again it wont prompt me again. Is this normal?

    The code I tried:
    Code:java
    1. /**
    2. * On player join
    3. *
    4. * @param event
    5. * PlayerJoinEvent
    6. */
    7. @EventHandler
    8. public void onJoin(PlayerJoinEvent event) {
    9. Player player = event.getPlayer(); // Get player
    10. player.setResoucePack("[url]http://www.test.com/zipfile.zip[/url]";
    11. }


    and also this
    Code:
        /**
        * On player join
        *
        * @param event
        *            PlayerJoinEvent
        */
        @EventHandler
        public void onJoin(PlayerJoinEvent event) {
            Player player = event.getPlayer(); // Get player
            setTexturePack(player, url);
        }
     
        public void setTexturePack(Player p, String url) {
            try {
                Validate.notNull(url, "Texture pack URL cannot be null");
                byte[] message = url.getBytes("UTF-8");
                Validate.isTrue(message.length <= Messenger.MAX_MESSAGE_SIZE,
                        "Texture pack URL is too long");
                ((CraftPlayer) p).getHandle().playerConnection
                        .sendPacket(new PacketPlayOutCustomPayload("MC|RPack",
                                message));
            } catch (UnsupportedEncodingException ex) {
                ex.printStackTrace();
            }
        }
    Also tried the deprecated MC|TPack packet

    Anyone know why it only works the first time. I clicked "No" btw when the prompt appeared.

    Best Regards,
    Maximvdw
     
  2. Offline

    Garris0n

    Yep.
     
  3. Offline

    Maximvdw

    Is the choice saved server side or client side?
     
  4. Offline

    RawCode

    client side.
     
  5. Offline

    Bammerbom

    Maximvdw there is just a method Player.setTexturePack(url)
     
  6. Offline

    Maximvdw

    I said I used that but it did not work. But since it is saved client side there does not seem to be a way to trigger the prompt again.
     
Thread Status:
Not open for further replies.

Share This Page