package com.ptsmods.morecommands.commands.server.unelevated;

import com.mojang.brigadier.CommandDispatcher;
import com.ptsmods.morecommands.miscellaneous.Command;
import net.minecraft.server.command.ServerCommandSource;

public class SilentCommand extends Command {
    @Override
    public void register(CommandDispatcher<ServerCommandSource> dispatcher) throws Exception {
        dispatcher.register(literal("silent")
                .redirect(dispatcher.getRoot(), ctx -> ctx.getSource().withSilent()));
    }

    @Override
    public String getDocsPath() {
        return "/unelevated/silent";
    }
}

@@ -70,42 +70,136 @@
 com.
-mojang.brigadier.CommandDispatcher
+google.common.collect.ImmutableList;%0Aimport com.mojang.brigadier.CommandDispatcher;%0Aimport com.ptsmods.morecommands.MoreCommands
 ;%0Aim
@@ -251,16 +251,61 @@
 ommand;%0A
+import net.minecraft.server.MinecraftServer;%0A
 import n
@@ -354,16 +354,46 @@
 ource;%0A%0A
+import java.util.Collection;%0A%0A
 public c
@@ -537,21 +537,471 @@
 eption %7B
+%7D%0A
 %0A    
+@Override%0A    public void init(boolean serverOnly, MinecraftServer server) throws Exception %7B%0A        // Dispatcher passed to the register method is a temporary empty dispatcher.%0A        CommandDispatcher%3CServerCommandSource%3E dispatcher = server.getCommandManager().getDispatcher();%0A        MoreCommands.removeNode(dispatcher, dispatcher.getRoot().getChild(%22silent%22)); // Remove old node as merging only merges the command, not the redirects.%0A%0A    
     disp
@@ -1037,25 +1037,8 @@
 nt%22)
-%0A                
 .red
@@ -1201,11 +1201,128 @@
 %22;%0A    %7D
+%0A%0A    @Override%0A    public Collection%3CString%3E getRegisteredNodes() %7B%0A        return ImmutableList.of(%22silent%22);%0A    %7D
 %0A%7D%0A

Fix silent command