Skip to content

Commit

Permalink
small fix for command help
Browse files Browse the repository at this point in the history
  • Loading branch information
Mooy1 committed Sep 6, 2021
1 parent d2b41e3 commit 07f02da
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.mooy1</groupId>
<artifactId>InfinityLib</artifactId>
<version>1.3.3</version>
<version>1.3.4</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
public final class AddonCommand extends ParentCommand implements TabExecutor, Listener {

private final String help;
private final String slashHelp;

public AddonCommand(String command) {
this(Objects.requireNonNull(AbstractAddon.instance().getCommand(command),
Expand All @@ -44,7 +45,8 @@ public AddonCommand(PluginCommand command) {

Events.registerListener(this);

help = "help" + command.getName();
help = "help " + command.getName();
slashHelp = "/" + help;

addSub(new InfoCommand(AbstractAddon.instance()));
addSub(new AliasesCommand(command));
Expand All @@ -59,8 +61,8 @@ private void onServerCommand(ServerCommandEvent e) {

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
private void onPlayerCommand(PlayerCommandPreprocessEvent e) {
if (e.getMessage().toLowerCase(Locale.ROOT).startsWith(help)) {
e.setMessage(name());
if (e.getMessage().toLowerCase(Locale.ROOT).startsWith(slashHelp)) {
e.setMessage("/" + name());
}
}

Expand Down

0 comments on commit 07f02da

Please sign in to comment.