Util Change server motd (the real one)

Discussion in 'Resources' started by Maxx_Qc, Jan 10, 2018.

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

    Maxx_Qc

    Hey guys, based on this thread I made a function to change the server motd.
    It isn't using the ServerListPing event, it is the "official" server's motd.

    Show Spoiler
    Code:
    public static void setMotd(String motd) throws ReflectiveOperationException {
            String bukkitversion = Bukkit.getServer().getClass().getPackage().getName().substring(23);
            Object minecraftserver = Class.forName("org.bukkit.craftbukkit." + bukkitversion + ".CraftServer").getDeclaredMethod("getServer", null).invoke(Bukkit.getServer(), null);
            Field f = minecraftserver.getClass().getSuperclass().getDeclaredField("motd");
            f.setAccessible(true);
            f.set(minecraftserver, motd);
        }


    Enjoy :)
     
    Last edited: Jan 10, 2018
    Horsey and Zombie_Striker like this.
Thread Status:
Not open for further replies.

Share This Page