add help shortcut. add wiki to help message. add gunpowder tags to default ignored tags
This commit is contained in:
parent
a57f5ab33f
commit
38ad375f20
@ -126,6 +126,7 @@ public class CommandClaim {
|
|||||||
builder.then(CommandManager.literal("help").executes(ctx -> CommandHelp.helpMessage(ctx, 0, builder.getArguments()))
|
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.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))));
|
.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);
|
dispatcher.register(builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ public class CommandHelp {
|
|||||||
|
|
||||||
public static int helpMessage(CommandContext<ServerCommandSource> context, int page, Collection<CommandNode<ServerCommandSource>> nodes) {
|
public static int helpMessage(CommandContext<ServerCommandSource> context, int page, Collection<CommandNode<ServerCommandSource>> nodes) {
|
||||||
List<String> subCommands = registeredCommands(context, nodes);
|
List<String> subCommands = registeredCommands(context, nodes);
|
||||||
|
subCommands.remove("?");
|
||||||
int max = subCommands.size() / 8;
|
int max = subCommands.size() / 8;
|
||||||
if (page > max)
|
if (page > max)
|
||||||
page = max;
|
page = max;
|
||||||
@ -52,6 +53,10 @@ public class CommandHelp {
|
|||||||
|
|
||||||
public static int helpCmd(CommandContext<ServerCommandSource> context) {
|
public static int helpCmd(CommandContext<ServerCommandSource> context) {
|
||||||
String command = StringArgumentType.getString(context, "command");
|
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);
|
String[] cmdHelp = ConfigHandler.lang.cmdLang.getCommandHelp(command);
|
||||||
context.getSource().sendFeedback(PermHelper.simpleColoredText(ConfigHandler.lang.helpCmdHeader, Formatting.DARK_GREEN), false);
|
context.getSource().sendFeedback(PermHelper.simpleColoredText(ConfigHandler.lang.helpCmdHeader, Formatting.DARK_GREEN), false);
|
||||||
for (int i = 0; i < cmdHelp.length; i++) {
|
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);
|
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;
|
return Command.SINGLE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,8 @@ public class Config {
|
|||||||
public boolean lenientBlockEntityCheck;
|
public boolean lenientBlockEntityCheck;
|
||||||
public List<String> ignoredBlocks = new ArrayList<>();
|
public List<String> ignoredBlocks = new ArrayList<>();
|
||||||
public List<String> blockEntityTagIgnore = Lists.newArrayList(
|
public List<String> blockEntityTagIgnore = Lists.newArrayList(
|
||||||
"IsDeathChest" //vanilla death chest
|
"IsDeathChest", //vanilla death chest
|
||||||
|
"gunpowder.owner" //gunpowder
|
||||||
);
|
);
|
||||||
public List<String> entityTagIgnore = Lists.newArrayList(
|
public List<String> entityTagIgnore = Lists.newArrayList(
|
||||||
"graves.marker" //vanilla tweaks
|
"graves.marker" //vanilla tweaks
|
||||||
|
@ -140,6 +140,8 @@ public class LangConfig {
|
|||||||
public String teleportHome = "Teleporting to claim home. Don't move for 5 seconds";
|
public String teleportHome = "Teleporting to claim home. Don't move for 5 seconds";
|
||||||
public String teleportHomeFail = "Teleport already happening";
|
public String teleportHomeFail = "Teleport already happening";
|
||||||
|
|
||||||
|
public String wiki = "For more info check out the wiki:";
|
||||||
|
|
||||||
public LangCommands cmdLang = new LangCommands();
|
public LangCommands cmdLang = new LangCommands();
|
||||||
|
|
||||||
public LangConfig(MinecraftServer server) {
|
public LangConfig(MinecraftServer server) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user