use of anticope.rejects.utils.seeds.Seed in project meteor-rejects by AntiCope.
the class SeedCommand method build.
@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
builder.executes(ctx -> {
Seed seed = Seeds.get().getSeed();
if (seed == null)
throw NO_SEED.create();
info(seed.toText());
return SINGLE_SUCCESS;
});
builder.then(literal("list").executes(ctx -> {
Seeds.get().seeds.forEach((name, seed) -> {
BaseText text = new LiteralText(name + " ");
text.append(seed.toText());
info(text);
});
return SINGLE_SUCCESS;
}));
builder.then(literal("delete").executes(ctx -> {
Seed seed = Seeds.get().getSeed();
if (seed != null) {
BaseText text = new LiteralText("Deleted ");
text.append(seed.toText());
info(text);
}
Seeds.get().seeds.remove(Utils.getWorldName());
return SINGLE_SUCCESS;
}));
builder.then(argument("seed", StringArgumentType.string()).executes(ctx -> {
Seeds.get().setSeed(StringArgumentType.getString(ctx, "seed"));
return SINGLE_SUCCESS;
}));
builder.then(argument("seed", StringArgumentType.string()).then(argument("version", EnumArgumentType.enumArgument(MCVersion.latest())).executes(ctx -> {
Seeds.get().setSeed(StringArgumentType.getString(ctx, "seed"), EnumArgumentType.getEnum(ctx, "version", MCVersion.latest()));
return SINGLE_SUCCESS;
})));
}
Aggregations