Set a server icon by code

Discussion in 'Spigot Plugin Development' started by GABBOGA99, Sep 20, 2015.

  1. Hi how can i set a server icon by code? I want to set a server icon from a link like this how can i do this? Thanks!
  2. You could do this with a plugin. Though, It would be much simpler to do it with a basic custom script/jar/program (Which you could then modify your file to execute prior to starting the server). As your server icon is loaded during server start. You would need to take that into consideration. So you would want to ensure the icon is updated prior to a restart for example. The script could be in the form of a batch script or, any other script supported by your host. You would just have to run it prior to re/starting the server.
    #2 MidnightShadow, Sep 20, 2015
    Last edited: Sep 20, 2015
  3. I wanna do this by code Example max slots is 10 if the player count is 0 the server icon is gree, if the player count is 5 the server icon is yellow and if the server is full the server icon is red!
  4. You can use ProtocolLib for this. Here's an example of using a players face for the favicon. The part that actually sets the favicon is line 96 called by line 47. Hope that helps.
  5. There is a way to do this with the bukkit api?
  6. I have a plugin called Pl3xMOTD that does this. In fact, it sends out a random icon every time the server receives the motd ping. ^_^

    No need for packets, NMS, or ProtocolLib, etc. Just pure Bukkit API is all you need.
  7. Bukkit.getServer.setServerIcon
    #7 SystemUpdate_, Sep 20, 2015
    Last edited: Sep 20, 2015