death messages spigot code example
Example: spigot wolf death message
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
String commandShowDeathMessages = "gamerule showDeathMessages false";
Bukkit.dispatchCommand(console, commandShowDeathMessages);
// But don't forget to write them by yourself in PlayerDeathEvent
// PS: btw if you plan to run that command on plugin onEnable,
//you shouhld use it in BukkitRunnable.runTaskLater()