mirror of
https://github.com/GTNewHorizons/BloodMagic.git
synced 2026-11-18 03:15:08 +00:00
Rework commands to be sub commands of /bloodmagic
This commit is contained in:
1 parent
fa78706fca
commit
731f92a7fd
7 files changed
+461
-3
No files matched your search
@@ -0,0 +1,43 @@
|
||||
package WayofTime.alchemicalWizardry.common.commands.sub;
|
||||
|
||||
import WayofTime.alchemicalWizardry.api.command.ISubCommand;
|
||||
import WayofTime.alchemicalWizardry.api.command.SubCommandBase;
|
||||
import WayofTime.alchemicalWizardry.common.commands.CommandBloodMagic;
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.ChatStyle;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public class SubCommandHelp extends SubCommandBase {
|
||||
|
||||
public SubCommandHelp(ICommand parent) {
|
||||
super(parent, "help");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArgUsage(ICommandSender commandSender) {
|
||||
return "/bloodmagic help";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelpText() {
|
||||
return "Displays the help information for the \"/bloodmagic\" command.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRequiredPermissionLevel() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processSubCommand(ICommandSender commandSender, String[] args) {
|
||||
super.processSubCommand(commandSender, args);
|
||||
|
||||
if (args.length > 0)
|
||||
return;
|
||||
|
||||
for (ISubCommand subCommand : ((CommandBloodMagic)getParentCommand()).getSubCommands().values())
|
||||
commandSender.addChatMessage(new ChatComponentText(String.format("%s - %s", capitalizeFirstLetter(subCommand.getSubCommandName()), subCommand.getArgUsage(commandSender))).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GREEN)));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user