Skip to content

Commit

Permalink
Added examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro270707 committed Sep 25, 2023
1 parent 51817d6 commit 723b880
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@
import net.minecraft.core.lang.I18n;
import net.pedroricardo.commander.mixin.StatNameAccessor;

import java.util.Arrays;
import java.util.Collection;
import java.util.concurrent.CompletableFuture;

public class AchievementArgumentType implements ArgumentType<Achievement> {
private static final Collection<String> EXAMPLES = Arrays.asList("achievement.acquireIron", "acquireIron");

public static ArgumentType<Achievement> achievement() {
return new AchievementArgumentType();
}
Expand Down Expand Up @@ -48,4 +52,9 @@ public <S> CompletableFuture<Suggestions> listSuggestions(final CommandContext<S
}
return builder.buildFuture();
}

@Override
public Collection<String> getExamples() {
return EXAMPLES;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.util.concurrent.CompletableFuture;

public class BlockArgumentType implements ArgumentType<Pair<Block, Integer>> {
private static final List<String> EXAMPLES = Arrays.asList("tile.stone", "stone", "dirt");
private static final List<String> EXAMPLES = Arrays.asList("tile.stone", "stone", "tile.log[1]");

public static ArgumentType<Pair<Block, Integer>> block() {
return new BlockArgumentType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@
import net.pedroricardo.commander.content.helpers.EntitySelector;
import net.pedroricardo.commander.content.helpers.EntitySelectorParser;

import java.util.Arrays;
import java.util.Collection;
import java.util.concurrent.CompletableFuture;

public class EntityArgumentType implements ArgumentType<EntitySelector> {
private static final Collection<String> EXAMPLES = Arrays.asList("Player", "0123", "@e", "@e[type=foo]", "entity.11203");

private final boolean singleEntity, playerOnly;

private EntityArgumentType(boolean singleEntity, boolean playerOnly) {
Expand Down Expand Up @@ -78,4 +81,9 @@ public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> cont
}
return Suggestions.empty();
}

@Override
public Collection<String> getExamples() {
return EXAMPLES;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

@SuppressWarnings("unchecked")
public class SeedCommand {
private static final SimpleCommandExceptionType PLAYER_ALREADY_HAS_ACHIEVEMENT = new SimpleCommandExceptionType(() -> I18n.getInstance().translateKey("commands.commander.achievement.grant.exception_already_has_achievement"));

public static void register(CommandDispatcher<CommanderCommandSource> dispatcher) {
dispatcher.register((LiteralArgumentBuilder) LiteralArgumentBuilder.literal("seed")
.requires(source -> ((CommanderCommandSource)source).hasAdmin())
Expand Down

0 comments on commit 723b880

Please sign in to comment.