Giving Player a Resource Pack, Then Returning It to Old One?

Discussion in 'Plugin Development' started by Blockhead7360, Oct 3, 2015.

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

    Blockhead7360

    Hey!

    I was wondering if there was anyway to give a player a resource pack when he does something (like change a world, which I know how to use PlayerWorldChangedEvent), AND return it back to their old one (when the player does something else).

    Please help, thanks :D
     
  2. Offline

    mine-care

    @Blockhead7360 Sadly you cannot obtain the name of resource pack they use so you cannot turn it back, but sure you can force them to use a resource pack, there should be a thread showing how its done but even if there isnt i can tell ya.
     
  3. Offline

    teej107

    Just clearing some things here: If a client doesn't have the resource pack, then you can't do anything about that. The most that will happen is a download prompt and they can always deny the download.
     
  4. Offline

    mine-care

    @teej107 For 1.7.9 i was able to force download the resourcepack on the client and therefore install it, it was as if they pressed yes to the prompt!

    The method:
    Code:
        public void forceTexturePack(Player who,URL zipFrom) {
            ((CraftPlayer)who).getHandle().playerConnection.sendPacket(new PacketPlayOutCustomPayload("MC|RPack", (zipFrom.toString()).getBytes(Charsets.UTF_8)));
        }
    It may not work on 1.8
     
  5. Offline

    teej107

    @mine-care You sure about that? Because the client will automatically switch resource packs if you already have it installed.
     
  6. Offline

    mine-care

    @teej107 I am prety sure, i had it on my Kit PvP server so when players joined they would go straigth to "Downloading" screen when it blurs the background and it downloads the resource pack and then sets it on. Ofc, they could change that afterwards with no impact on their clients but still it would force it. Also back when we had Texture Packs instead of resource packs, the payload was TPacks i think :/

    IT may work on 1.8 but i dought it, the payload packet has changed. it will need modifying
     
  7. Offline

    boomboompower

    For removing the resource pack, just make a empty one and send that to them.
     
Thread Status:
Not open for further replies.

Share This Page