1ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
2String commandShowDeathMessages = "gamerule showDeathMessages false";
3Bukkit.dispatchCommand(console, commandShowDeathMessages);
4
5// But don't forget to write them by yourself in PlayerDeathEvent
6
7// PS: btw if you plan to run that command on plugin onEnable,
8//you shouhld use it in BukkitRunnable.runTaskLater()