add help shortcut. add wiki to help message. add gunpowder tags to default ignored tags

This commit is contained in:
Flemmli97 2021-07-02 16:36:42 +02:00
parent a57f5ab33f
commit 38ad375f20
4 changed files with 16 additions and 1 deletions

View File

@ -126,6 +126,7 @@ public class CommandClaim {
builder.then(CommandManager.literal("help").executes(ctx -> CommandHelp.helpMessage(ctx, 0, builder.getArguments()))
.then(CommandManager.argument("page", IntegerArgumentType.integer()).executes(ctx -> CommandHelp.helpMessage(ctx, builder.getArguments())))
.then(CommandManager.literal("cmd").then(CommandManager.argument("command", StringArgumentType.word()).suggests((ctx, sb) -> CommandSource.suggestMatching(CommandHelp.registeredCommands(ctx, builder.getArguments()), sb)).executes(CommandHelp::helpCmd))));
builder.then(CommandManager.literal("?").executes(ctx -> CommandHelp.helpCmd(ctx, "help")));
dispatcher.register(builder);
}

View File

@ -26,6 +26,7 @@ public class CommandHelp {
public static int helpMessage(CommandContext<ServerCommandSource> context, int page, Collection<CommandNode<ServerCommandSource>> nodes) {
List<String> subCommands = registeredCommands(context, nodes);
subCommands.remove("?");
int max = subCommands.size() / 8;
if (page > max)
page = max;
@ -52,6 +53,10 @@ public class CommandHelp {
public static int helpCmd(CommandContext<ServerCommandSource> context) {
String command = StringArgumentType.getString(context, "command");
return helpCmd(context, command);
}
public static int helpCmd(CommandContext<ServerCommandSource> context, String command) {
String[] cmdHelp = ConfigHandler.lang.cmdLang.getCommandHelp(command);
context.getSource().sendFeedback(PermHelper.simpleColoredText(ConfigHandler.lang.helpCmdHeader, Formatting.DARK_GREEN), false);
for (int i = 0; i < cmdHelp.length; i++) {
@ -62,6 +67,12 @@ public class CommandHelp {
context.getSource().sendFeedback(PermHelper.simpleColoredText(cmdHelp[i], Formatting.GOLD), false);
}
}
if (command.equals("help")) {
context.getSource().sendFeedback(PermHelper.simpleColoredText(ConfigHandler.lang.wiki, Formatting.GOLD), false);
MutableText wiki = PermHelper.simpleColoredText("https://github.com/Flemmli97/Flan/wiki", Formatting.GREEN);
wiki.setStyle(wiki.getStyle().withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://github.com/Flemmli97/Flan/wiki")));
context.getSource().sendFeedback(wiki, false);
}
return Command.SINGLE_SUCCESS;
}

View File

@ -36,7 +36,8 @@ public class Config {
public boolean lenientBlockEntityCheck;
public List<String> ignoredBlocks = new ArrayList<>();
public List<String> blockEntityTagIgnore = Lists.newArrayList(
"IsDeathChest" //vanilla death chest
"IsDeathChest", //vanilla death chest
"gunpowder.owner" //gunpowder
);
public List<String> entityTagIgnore = Lists.newArrayList(
"graves.marker" //vanilla tweaks

View File

@ -140,6 +140,8 @@ public class LangConfig {
public String teleportHome = "Teleporting to claim home. Don't move for 5 seconds";
public String teleportHomeFail = "Teleport already happening";
public String wiki = "For more info check out the wiki:";
public LangCommands cmdLang = new LangCommands();
public LangConfig(MinecraftServer server) {