Solved Cache file

Discussion in 'Spigot Plugin Development' started by MadMaxCookie, Jun 9, 2016.

  1. Hello how do I set the server's icon using the event ServerPingList or something like that if I'm mistaken or is there any wiki about this ? thanks in advance.
     
  2. You can do loadServerIcon(BufferedImage) or loadServerIcon(File) to get a CachedServerIcon instance. It can be used in ServerListPingEvent#setServerIcon
     
  3. really I can use File ? let me try.
     
  4. bump how do I do this thing ?
     
  5. thats your answer... other than that you havent provided us with what you have tried nor what errors or bugs you have encountered, without it we cant help you and it looks more just like asking for code radther than asking for help.

    Edit: I know your not looking for code, dont make me out to be someone insulting you
     
  6. I set the server Icon like this

    Code (Java):
    File file = new File(p.getDataFolder(), "icon.png");
    e.setServerIcon((CachedFile) file);
    then the error is cannot cast cached file to file. // I'm on my phone.
     
  7. @LeePMC oops my bad I don't based with javadoc :p

    Code (Java):
    private CachedServerIcon icon;
        this.icon = Bukkit.loadServerIcon(new File(p.getDataFolder(), "icon.png");
        if(this.icon != null){
        e.setServerIcon(this.icon);
       }