-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ 添加列出所有自定义cmd的命令
- Loading branch information
Showing
4 changed files
with
46 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/main/java/cn/evolvefield/mods/botapi/common/command/ListCustomCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package cn.evolvefield.mods.botapi.common.command; | ||
|
||
|
||
import cn.evolvefield.mods.botapi.init.handler.CustomCmdHandler; | ||
import com.mojang.brigadier.context.CommandContext; | ||
import com.mojang.brigadier.exceptions.CommandSyntaxException; | ||
import net.minecraft.commands.CommandSourceStack; | ||
import net.minecraft.network.chat.Component; | ||
|
||
public class ListCustomCommand { | ||
|
||
public static int execute(CommandContext<CommandSourceStack> context) throws CommandSyntaxException { | ||
StringBuilder out = new StringBuilder(); | ||
for (String s : CustomCmdHandler.INSTANCE.getCustomCmdMap().keySet()) { | ||
out.append(s).append("\n"); | ||
} | ||
context.getSource().sendSuccess(Component.literal(out.toString()), true); | ||
return 1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters