Skip to content

Commit

Permalink
show which mod adds commands in command overview
Browse files Browse the repository at this point in the history
Signed-off-by: Lyfts <[email protected]>
  • Loading branch information
Lyfts committed Oct 22, 2024
1 parent c8b39a8 commit 73fccae
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/serverutils/net/MessageCommandsResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.minecraft.command.ICommand;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IChatComponent;

import cpw.mods.fml.relauncher.Side;
Expand All @@ -17,6 +18,7 @@
import serverutils.lib.io.DataOut;
import serverutils.lib.net.MessageToClient;
import serverutils.lib.net.NetworkWrapper;
import serverutils.ranks.ICommandWithPermission;

public class MessageCommandsResponse extends MessageToClient {

Expand All @@ -42,6 +44,11 @@ public MessageCommandsResponse(EntityPlayerMP player) {
IChatComponent subCommands = new ChatComponentText(builder.toString());
usage.appendSibling(subCommands);
}
if (command instanceof ICommandWithPermission cmd) {
usage.appendText("\n").appendSibling(
new ChatComponentText(
("Added by: " + EnumChatFormatting.GOLD + cmd.serverutilities$getModName())));
}
commands.put(command.getCommandName(), usage);
}
}
Expand Down

0 comments on commit 73fccae

Please sign in to comment.