New hex colors for MOTD?

Discussion in 'Spigot Discussion' started by andrew121410, Jun 26, 2020.

  1. I was wondering if you could use the new hex colors for the MOTD because I heard you could use them for scoreboards?
  2. Well, apparently you can, but it's not the same format as in-game.
    I tried setting the motd to the lastest coloured chat message with the rainbow colour plugin I made for fun earlier lol
  3. But wait - you can!

    This can be accomplished by registering a PacketAdapter with ProtocolLib:
    Code (Java):
    new PacketAdapter(plugin, PacketType.Status.Server.SERVER_INFO)
        public void onPacketSending(PacketEvent event)
            BaseComponent[] components =
                new ComponentBuilder()
                    .append("You ").bold(true).color(ChatColor.of("#cf1f8e"))
                    .append(" actually!").underlined(false).color(ChatColor.of("#8dc743"))
                    .append("wow ").color(ChatColor.of("#e64500"))
            WrappedChatComponent wrappedComponent =
            WrappedServerPing ping = event.getPacket().getServerPings().read(0);
    The distinction between using the above and simply listening for the standard ServerListPingEvent is that the event version only accepts a legacy-style string, whereas the packet version is capable of setting the MOTD to a chat component.
    • Like Like x 3
    • Informative Informative x 3
  4. See that is truly epic, thanks for sharing.
  5. Choco


    I would consider this a bug. Report it on the JIRA. Though worth noting that these only display to 1.16 clients. :)
  6. This has been fixed in 7560f5f5a69 so you can use the hex colors with ServerListPingEvent. @Creeprr

    So that's good.
    • Informative Informative x 1
  7. Epic, thanks.
  8. Could someone show me how you achieve it?
    I am using the correct event but my colors still default to the classic ones.
    Code (Java):
    private final String MOTD = ChatColor.of("#A686DB") + "y" + ChatColor.of("#D994CF") + "o";
  9. This is how I did it and it works. Annotation 2020-06-30 171240.png Annotation 2020-06-30 171225.png
    • Useful Useful x 1