Solved Semi-force a texture pack

Discussion in 'Plugin Development' started by CraterHater, Nov 8, 2016.

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

    CraterHater

    Hey!

    How would I bring up the "yes, no" question for a texture pack each time the player logs on. When they select no, kick them from the game.

    Thanks
     
  2. Offline

    ipodtouch0218

    PlayerResourceStatusEvent
    If #getStatus() is PlayerResourceStatusEvent.Status.DECLINED or PlayerResourceStatusEvent.Status.FAILED_DOWNLOAD

    #kickPlayer(reason);

    EDIT: To prompt it, you just have to put the resource pack link inside of the "resource-pack" section in server.properties. If the player has "ask" in Mulitplayer Options off, I think it will return "DECLINED"
     
    CraterHater likes this.
  3. Offline

    CraterHater

    Code:
    @EventHandler
        public void resource(PlayerResourcePackStatusEvent event){
            if(event.getStatus() == PlayerResourcePackStatusEvent.Status.DECLINED){
                Player p = event.getPlayer();
                p.kickPlayer("You must accept the resource pack!");
            }
        }
    Thank you so much already but this doesn't seem to work, do you know?
    @ipodtouch0218

    EDIT: it does work, just kickPlayer doesn't work
     
  4. Online

    timtower Administrator Administrator Moderator

  5. Offline

    CraterHater

    @ipodtouch0218

    @timtower
    I got that to work but now I have an issue that it doesn't actually install the resourcepack, it just does nothing if you accept.
    here is my join code:
    Code:
    @EventHandler
        public void tutorialx(PlayerJoinEvent event){
            final Player p = event.getPlayer();
            this.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
                  public void run() {
                      p.setResourcePack("https://www.dropbox.com/sh/lk4v7eqtz6tjwyu/AAAxXMvDYhfzLzjcVKEjHPv6a?dl=0");
                  }
                }, 10);
        }
     
  6. Offline

    ipodtouch0218

    CraterHater likes this.
  7. Online

    timtower Administrator Administrator Moderator

  8. Offline

    CraterHater

    @timtower @ipodtouch0218
    That actually worked :D
    Thank you so much!

    @ipodtouch0218
    That link doesn't work, I do need it in .zip format cause else it loads way too long.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Nov 8, 2016
    timtower likes this.
  9. Offline

    ipodtouch0218

    CraterHater likes this.
  10. Offline

    CraterHater

    @ipodtouch0218
    Awesome!
    I can't thank you enough for your quick, and good responses!

    @ipodtouch0218
    I am very sorry to ask again but I messed it up...
    Code:
    https://www.dropbox.com/s/vuc54l5joq1hahw/GyldorPack.zip?dl=1
    What is wrong with that?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Nov 8, 2016
Thread Status:
Not open for further replies.

Share This Page