1.17.x Black Server Icon

Discussion in 'Spigot Plugin Development' started by Askyyy, Jul 19, 2021.

  1. I'm trying to set my server's favicon through ServerListPingEvent#setServerIcon with a URL, but the image turns black ingame. I first used ProtocolLib, it did the same thing. I then switched to normal spigot, it did the same thing. I have no idea what I'm doing wrong, here's my code:
    Code (Java):
    try {
                    URL asset = new URL(Main.getInstance().config.getString("favicon"));
                    BufferedImage img = ImageIO.read(asset);
                    File file = new File("icon.png");
                    ImageIO.write(img, "png", file);
                    ping.setServerIcon(Bukkit.loadServerIcon(file));
                } catch (IllegalArgumentException e) {
                    e.printStackTrace();
                } catch (UnsupportedOperationException e) {
                    e.printStackTrace();
                } catch (Exception e) {
                    e.printStackTrace();
                }
    Any help would be appreciated. Thanks!

    NOTE: There's no error in the console.
     
  2. I'm pretty sure it's "server-icon.png".
     
    • Agree Agree x 2
  3. Bungee/Spigot has an inbuilt function for this so why need set up an extra plugin to do so? you can just drag your server-icon.png (which has to be named server-icon.png with a size of 64x64) into the bungee/spigot root folder and it will automatically apply it. You can view further details here.