chore: make code style consistent
This commit is contained in:
parent
a2cea2f33e
commit
89ec3fbf29
380 changed files with 479 additions and 936 deletions
|
|
@ -73,5 +73,4 @@ public final class FabricCaptionKeys {
|
|||
public static @NonNull Collection<@NonNull Caption> fabricCaptionKeys() {
|
||||
return Collections.unmodifiableCollection(RECOGNIZED_CAPTIONS);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,6 +60,4 @@ public class FabricCaptionRegistry<C> extends SimpleCaptionRegistry<C> {
|
|||
(caption, sender) -> ARGUMENT_PARSE_FAILURE_TEAM_UNKNOWN
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ public final class FabricClientCommandManager<C> extends FabricCommandManager<C,
|
|||
return allowOnMultiplayer;
|
||||
}
|
||||
return Minecraft.getInstance().getSingleplayerServer().getPlayerList().isAllowCheatsForAllPlayers()
|
||||
|| Minecraft.getInstance().getSingleplayerServer().getWorldData().getAllowCommands();
|
||||
|| Minecraft.getInstance().getSingleplayerServer().getWorldData().getAllowCommands();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -200,8 +200,7 @@ public final class FabricClientCommandManager<C> extends FabricCommandManager<C,
|
|||
return allowOnMultiplayer;
|
||||
}
|
||||
return !Minecraft.getInstance().getSingleplayerServer().getPlayerList().isAllowCheatsForAllPlayers()
|
||||
&& !Minecraft.getInstance().getSingleplayerServer().getWorldData().getAllowCommands();
|
||||
&& !Minecraft.getInstance().getSingleplayerServer().getWorldData().getAllowCommands();
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,5 +48,4 @@ public final class FabricCommandContextKeys {
|
|||
"cloud:fabric_command_source",
|
||||
TypeToken.get(SharedSuggestionProvider.class)
|
||||
);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,7 +165,10 @@ public abstract class FabricCommandManager<C, S extends SharedSuggestionProvider
|
|||
this.registerRegistryEntryMappings();
|
||||
brigadier.registerMapping(new TypeToken<TeamArgument.TeamParser<C>>() {
|
||||
}, builder -> builder.toConstant(net.minecraft.commands.arguments.TeamArgument.team()));
|
||||
this.getParserRegistry().registerParserSupplier(TypeToken.get(PlayerTeam.class), params -> new TeamArgument.TeamParser<>());
|
||||
this.getParserRegistry().registerParserSupplier(
|
||||
TypeToken.get(PlayerTeam.class),
|
||||
params -> new TeamArgument.TeamParser<>()
|
||||
);
|
||||
|
||||
/* Wrapped/Constant Brigadier types, native value type */
|
||||
this.registerConstantNativeParserSupplier(ChatFormatting.class, ColorArgument.color());
|
||||
|
|
@ -176,7 +179,8 @@ public abstract class FabricCommandManager<C, S extends SharedSuggestionProvider
|
|||
this.registerConstantNativeParserSupplier(OperationArgument.Operation.class, OperationArgument.operation());
|
||||
this.registerConstantNativeParserSupplier(ParticleOptions.class, ParticleArgument.particle());
|
||||
this.registerConstantNativeParserSupplier(AngleArgument.SingleAngle.class, AngleArgument.angle());
|
||||
this.registerConstantNativeParserSupplier(new TypeToken<EnumSet<Direction.Axis>>() {}, SwizzleArgument.swizzle());
|
||||
this.registerConstantNativeParserSupplier(new TypeToken<EnumSet<Direction.Axis>>() {
|
||||
}, SwizzleArgument.swizzle());
|
||||
this.registerConstantNativeParserSupplier(ResourceLocation.class, ResourceLocationArgument.id());
|
||||
this.registerConstantNativeParserSupplier(EntityAnchorArgument.Anchor.class, EntityAnchorArgument.anchor());
|
||||
this.registerConstantNativeParserSupplier(MinMaxBounds.Ints.class, RangeArgument.intRange());
|
||||
|
|
@ -186,16 +190,20 @@ public abstract class FabricCommandManager<C, S extends SharedSuggestionProvider
|
|||
|
||||
/* Wrapped/Constant Brigadier types, mapped value type */
|
||||
this.registerConstantNativeParserSupplier(MessageArgument.Message.class, MessageArgument.message());
|
||||
this.getParserRegistry().registerParserSupplier(TypeToken.get(MinecraftTime.class), params -> FabricArgumentParsers.time());
|
||||
this.getParserRegistry().registerParserSupplier(
|
||||
TypeToken.get(MinecraftTime.class),
|
||||
params -> FabricArgumentParsers.time()
|
||||
);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
private void registerRegistryEntryMappings() {
|
||||
this.brigadierManager.registerMapping(
|
||||
new TypeToken<RegistryEntryArgument.Parser<C, ?>>() {},
|
||||
builder -> {
|
||||
builder.to(argument -> ResourceOrTagLocationArgument.<Object>resourceOrTag((ResourceKey) argument.registryKey()));
|
||||
}
|
||||
new TypeToken<RegistryEntryArgument.Parser<C, ?>>() {
|
||||
},
|
||||
builder -> {
|
||||
builder.to(argument -> ResourceOrTagLocationArgument.<Object>resourceOrTag((ResourceKey) argument.registryKey()));
|
||||
}
|
||||
);
|
||||
|
||||
/* Find all fields of RegistryKey<? extends Registry<?>> and register those */
|
||||
|
|
@ -259,10 +267,13 @@ public abstract class FabricCommandManager<C, S extends SharedSuggestionProvider
|
|||
* @since 1.7.0
|
||||
*/
|
||||
final <T> void registerContextualNativeParserSupplier(
|
||||
final @NonNull Class<T> type,
|
||||
final @NonNull Function<CommandBuildContext, @NonNull ArgumentType<T>> argument
|
||||
final @NonNull Class<T> type,
|
||||
final @NonNull Function<CommandBuildContext, @NonNull ArgumentType<T>> argument
|
||||
) {
|
||||
this.getParserRegistry().registerParserSupplier(TypeToken.get(type), params -> FabricArgumentParsers.contextual(argument));
|
||||
this.getParserRegistry().registerParserSupplier(
|
||||
TypeToken.get(type),
|
||||
params -> FabricArgumentParsers.contextual(argument)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -339,5 +350,4 @@ public abstract class FabricCommandManager<C, S extends SharedSuggestionProvider
|
|||
.apply(sender)
|
||||
.hasPermission(permissionLevel);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
|||
|
||||
final class FabricCommandPreprocessor<C> implements CommandPreprocessor<C> {
|
||||
|
||||
private final FabricCommandManager<C, ?> manager;
|
||||
private final FabricCommandManager<C, ?> manager;
|
||||
|
||||
FabricCommandPreprocessor(final FabricCommandManager<C, ?> manager) {
|
||||
this.manager = manager;
|
||||
|
|
@ -38,9 +38,8 @@ final class FabricCommandPreprocessor<C> implements CommandPreprocessor<C> {
|
|||
@Override
|
||||
public void accept(@NonNull final CommandPreprocessingContext<C> context) {
|
||||
context.getCommandContext().store(
|
||||
FabricCommandContextKeys.NATIVE_COMMAND_SOURCE,
|
||||
this.manager.backwardsCommandSourceMapper().apply(context.getCommandContext().getSender())
|
||||
FabricCommandContextKeys.NATIVE_COMMAND_SOURCE,
|
||||
this.manager.backwardsCommandSourceMapper().apply(context.getCommandContext().getSender())
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,8 +139,8 @@ abstract class FabricCommandRegistrationHandler<C, S extends SharedSuggestionPro
|
|||
}
|
||||
|
||||
public void registerCommands(
|
||||
final CommandDispatcher<FabricClientCommandSource> dispatcher,
|
||||
final CommandBuildContext commandBuildContext
|
||||
final CommandDispatcher<FabricClientCommandSource> dispatcher,
|
||||
final CommandBuildContext commandBuildContext
|
||||
) {
|
||||
this.registerEventFired = true;
|
||||
FabricArgumentParsers.ContextualArgumentTypeProvider.withBuildContext(
|
||||
|
|
@ -157,8 +157,8 @@ abstract class FabricCommandRegistrationHandler<C, S extends SharedSuggestionPro
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void registerClientCommand(
|
||||
final CommandDispatcher<FabricClientCommandSource> dispatcher,
|
||||
final Command<C> command
|
||||
final CommandDispatcher<FabricClientCommandSource> dispatcher,
|
||||
final Command<C> command
|
||||
) {
|
||||
final RootCommandNode<FabricClientCommandSource> rootNode = dispatcher.getRoot();
|
||||
final StaticArgument<C> first = ((StaticArgument<C>) command.getArguments().get(0));
|
||||
|
|
@ -204,36 +204,35 @@ abstract class FabricCommandRegistrationHandler<C, S extends SharedSuggestionPro
|
|||
}
|
||||
|
||||
private void registerAllCommands(
|
||||
final CommandDispatcher<CommandSourceStack> dispatcher,
|
||||
final CommandBuildContext access,
|
||||
final Commands.CommandSelection side
|
||||
final CommandDispatcher<CommandSourceStack> dispatcher,
|
||||
final CommandBuildContext access,
|
||||
final Commands.CommandSelection side
|
||||
) {
|
||||
this.commandManager().registrationCalled();
|
||||
FabricArgumentParsers.ContextualArgumentTypeProvider.withBuildContext(
|
||||
this.commandManager(),
|
||||
access,
|
||||
true,
|
||||
() -> {
|
||||
for (final Command<C> command : this.registeredCommands) {
|
||||
/* Only register commands in the declared environment */
|
||||
final Commands.CommandSelection env = command.getCommandMeta().getOrDefault(
|
||||
FabricServerCommandManager.META_REGISTRATION_ENVIRONMENT,
|
||||
Commands.CommandSelection.ALL
|
||||
);
|
||||
access,
|
||||
true,
|
||||
() -> {
|
||||
for (final Command<C> command : this.registeredCommands) {
|
||||
/* Only register commands in the declared environment */
|
||||
final Commands.CommandSelection env = command.getCommandMeta().getOrDefault(
|
||||
FabricServerCommandManager.META_REGISTRATION_ENVIRONMENT,
|
||||
Commands.CommandSelection.ALL
|
||||
);
|
||||
|
||||
if ((env == Commands.CommandSelection.INTEGRATED && !side.includeIntegrated)
|
||||
|| (env == Commands.CommandSelection.DEDICATED && !side.includeDedicated)) {
|
||||
continue;
|
||||
if ((env == Commands.CommandSelection.INTEGRATED && !side.includeIntegrated)
|
||||
|| (env == Commands.CommandSelection.DEDICATED && !side.includeDedicated)) {
|
||||
continue;
|
||||
}
|
||||
this.registerCommand(dispatcher.getRoot(), command);
|
||||
}
|
||||
this.registerCommand(dispatcher.getRoot(), command);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private void registerCommand(final RootCommandNode<CommandSourceStack> dispatcher, final Command<C> command) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final StaticArgument<C> first = ((StaticArgument<C>) command.getArguments().get(0));
|
||||
@SuppressWarnings("unchecked") final StaticArgument<C> first = ((StaticArgument<C>) command.getArguments().get(0));
|
||||
final CommandNode<CommandSourceStack> baseNode = this.commandManager().brigadierManager().createLiteralCommandNode(
|
||||
first.getName(),
|
||||
command,
|
||||
|
|
@ -251,7 +250,5 @@ abstract class FabricCommandRegistrationHandler<C, S extends SharedSuggestionPro
|
|||
dispatcher.addChild(buildRedirect(alias, baseNode));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
|||
import org.slf4j.Logger;
|
||||
|
||||
final class FabricExecutor<C, S extends SharedSuggestionProvider> implements Command<S> {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
|
||||
private static final Component NEWLINE = Component.literal("\n");
|
||||
|
|
@ -192,5 +193,4 @@ final class FabricExecutor<C, S extends SharedSuggestionProvider> implements Com
|
|||
stackTrace
|
||||
)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,5 +50,4 @@ public final class FabricParserParameters {
|
|||
) {
|
||||
return new ParserParameter<>(key, expectedType);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -201,5 +201,4 @@ public final class FabricServerCommandManager<C> extends FabricCommandManager<C,
|
|||
final CommandSourceStack source = this.backwardsCommandSourceMapper().apply(sender);
|
||||
return Permissions.check(source, permission, source.getServer().getOperatorUserPermissionLevel());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,7 +117,8 @@ public final class AngleArgument<C> extends CommandArgument<C, net.minecraft.com
|
|||
* @param <C> sender type
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public static final class Builder<C> extends TypedBuilder<C, net.minecraft.commands.arguments.AngleArgument.SingleAngle, Builder<C>> {
|
||||
public static final class Builder<C> extends
|
||||
TypedBuilder<C, net.minecraft.commands.arguments.AngleArgument.SingleAngle, Builder<C>> {
|
||||
|
||||
Builder(final @NonNull String name) {
|
||||
super(net.minecraft.commands.arguments.AngleArgument.SingleAngle.class, name);
|
||||
|
|
@ -151,7 +152,5 @@ public final class AngleArgument<C> extends CommandArgument<C, net.minecraft.com
|
|||
public @NonNull Builder<C> asOptionalWithDefault(final float defaultValue) {
|
||||
return this.asOptionalWithDefault(Float.toString(defaultValue));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,7 +166,5 @@ public final class AxisArgument<C> extends CommandArgument<C, EnumSet<Direction.
|
|||
}
|
||||
return this.asOptionalWithDefault(builder.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,7 +152,5 @@ public final class CompoundTagArgument<C> extends CommandArgument<C, CompoundTag
|
|||
public @NonNull Builder<C> asOptionalWithDefault(final @NonNull CompoundTag defaultValue) {
|
||||
return this.asOptionalWithDefault(defaultValue.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,8 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
|||
* @param <C> the sender type
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public final class EntityAnchorArgument<C> extends CommandArgument<C, net.minecraft.commands.arguments.EntityAnchorArgument.Anchor> {
|
||||
public final class EntityAnchorArgument<C> extends
|
||||
CommandArgument<C, net.minecraft.commands.arguments.EntityAnchorArgument.Anchor> {
|
||||
|
||||
EntityAnchorArgument(
|
||||
final boolean required,
|
||||
|
|
@ -117,7 +118,8 @@ public final class EntityAnchorArgument<C> extends CommandArgument<C, net.minecr
|
|||
* @param <C> sender type
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public static final class Builder<C> extends TypedBuilder<C, net.minecraft.commands.arguments.EntityAnchorArgument.Anchor, Builder<C>> {
|
||||
public static final class Builder<C> extends
|
||||
TypedBuilder<C, net.minecraft.commands.arguments.EntityAnchorArgument.Anchor, Builder<C>> {
|
||||
|
||||
Builder(final @NonNull String name) {
|
||||
super(net.minecraft.commands.arguments.EntityAnchorArgument.Anchor.class, name);
|
||||
|
|
@ -149,10 +151,9 @@ public final class EntityAnchorArgument<C> extends CommandArgument<C, net.minecr
|
|||
* @since 1.5.0
|
||||
*/
|
||||
public @NonNull Builder<C> asOptionalWithDefault(
|
||||
final net.minecraft.commands.arguments.EntityAnchorArgument.@NonNull Anchor defaultValue) {
|
||||
final net.minecraft.commands.arguments.EntityAnchorArgument.@NonNull Anchor defaultValue
|
||||
) {
|
||||
return this.asOptionalWithDefault(defaultValue.name());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,8 +80,9 @@ public final class FabricArgumentParsers {
|
|||
|
||||
/**
|
||||
* A parser that wraps Brigadier argument types which need a {@link CommandBuildContext}
|
||||
* @param <C> sender type
|
||||
* @param <V> argument value type
|
||||
*
|
||||
* @param <C> sender type
|
||||
* @param <V> argument value type
|
||||
* @param factory factory that creates these arguments
|
||||
* @return the parser
|
||||
*/
|
||||
|
|
@ -132,7 +133,8 @@ public final class FabricArgumentParsers {
|
|||
* @return a parser instance
|
||||
*/
|
||||
public static <C> @NonNull ArgumentParser<C, Coordinates.CoordinatesXZ> vec2(final boolean centerIntegers) {
|
||||
return new WrappedBrigadierParser<C, net.minecraft.commands.arguments.coordinates.Coordinates>(new Vec2Argument(centerIntegers))
|
||||
return new WrappedBrigadierParser<C, net.minecraft.commands.arguments.coordinates.Coordinates>(new Vec2Argument(
|
||||
centerIntegers))
|
||||
.map(FabricArgumentParsers::mapToCoordinates);
|
||||
}
|
||||
|
||||
|
|
@ -144,7 +146,8 @@ public final class FabricArgumentParsers {
|
|||
* @return a parser instance
|
||||
*/
|
||||
public static <C> @NonNull ArgumentParser<C, Coordinates> vec3(final boolean centerIntegers) {
|
||||
return new WrappedBrigadierParser<C, net.minecraft.commands.arguments.coordinates.Coordinates>(Vec3Argument.vec3(centerIntegers))
|
||||
return new WrappedBrigadierParser<C, net.minecraft.commands.arguments.coordinates.Coordinates>(Vec3Argument.vec3(
|
||||
centerIntegers))
|
||||
.map(FabricArgumentParsers::mapToCoordinates);
|
||||
}
|
||||
|
||||
|
|
@ -271,7 +274,6 @@ public final class FabricArgumentParsers {
|
|||
private interface CommandSyntaxExceptionThrowingParseResultSupplier<O> {
|
||||
|
||||
@NonNull ArgumentParseResult<O> result() throws CommandSyntaxException;
|
||||
|
||||
}
|
||||
|
||||
private static <O> @NonNull ArgumentParseResult<O> handleCommandSyntaxExceptionAsFailure(
|
||||
|
|
@ -341,7 +343,6 @@ public final class FabricArgumentParsers {
|
|||
public @NonNull Component contents() {
|
||||
return this.contents;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static final class CoordinatesImpl implements Coordinates,
|
||||
|
|
@ -389,7 +390,6 @@ public final class FabricArgumentParsers {
|
|||
public net.minecraft.commands.arguments.coordinates.@NonNull Coordinates wrappedCoordinates() {
|
||||
return this.posArgument;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static final class SingleEntitySelectorImpl implements SingleEntitySelector {
|
||||
|
|
@ -422,7 +422,6 @@ public final class FabricArgumentParsers {
|
|||
public @NonNull Entity getSingle() {
|
||||
return this.selectedEntity;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static final class MultipleEntitySelectorImpl implements MultipleEntitySelector {
|
||||
|
|
@ -455,7 +454,6 @@ public final class FabricArgumentParsers {
|
|||
public @NonNull Collection<Entity> get() {
|
||||
return this.selectedEntities;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static final class SinglePlayerSelectorImpl implements SinglePlayerSelector {
|
||||
|
|
@ -488,7 +486,6 @@ public final class FabricArgumentParsers {
|
|||
public @NonNull ServerPlayer getSingle() {
|
||||
return this.selectedPlayer;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static final class MultiplePlayerSelectorImpl implements MultiplePlayerSelector {
|
||||
|
|
@ -521,14 +518,14 @@ public final class FabricArgumentParsers {
|
|||
public @NonNull Collection<ServerPlayer> get() {
|
||||
return this.selectedPlayers;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
public static final class ContextualArgumentTypeProvider<V> implements Supplier<ArgumentType<V>> {
|
||||
|
||||
private static final ThreadLocal<ThreadLocalContext> CONTEXT = new ThreadLocal<>();
|
||||
private static final Map<FabricCommandManager<?, ?>, Set<ContextualArgumentTypeProvider<?>>> INSTANCES =
|
||||
new WeakHashMap<>();
|
||||
new WeakHashMap<>();
|
||||
|
||||
private final Function<CommandBuildContext, ArgumentType<V>> provider;
|
||||
private volatile ArgumentType<V> provided;
|
||||
|
|
@ -536,17 +533,17 @@ public final class FabricArgumentParsers {
|
|||
/**
|
||||
* Temporarily expose a command build context to providers called from this thread.
|
||||
*
|
||||
* @param ctx the context
|
||||
* @param ctx the context
|
||||
* @param commandManager command manager to use
|
||||
* @param resetExisting whether to clear cached state from existing provider instances for this command type
|
||||
* @param action an action to perform while the context is exposed
|
||||
* @param resetExisting whether to clear cached state from existing provider instances for this command type
|
||||
* @param action an action to perform while the context is exposed
|
||||
* @since 1.7.0
|
||||
*/
|
||||
public static void withBuildContext(
|
||||
final FabricCommandManager<?, ?> commandManager,
|
||||
final CommandBuildContext ctx,
|
||||
final boolean resetExisting,
|
||||
final Runnable action
|
||||
final FabricCommandManager<?, ?> commandManager,
|
||||
final CommandBuildContext ctx,
|
||||
final boolean resetExisting,
|
||||
final Runnable action
|
||||
) {
|
||||
final ThreadLocalContext context = new ThreadLocalContext(commandManager, ctx);
|
||||
CONTEXT.set(context);
|
||||
|
|
@ -567,6 +564,7 @@ public final class FabricArgumentParsers {
|
|||
}
|
||||
|
||||
private static final class ThreadLocalContext {
|
||||
|
||||
private final FabricCommandManager<?, ?> commandManager;
|
||||
private final CommandBuildContext commandBuildContext;
|
||||
|
||||
|
|
@ -602,7 +600,8 @@ public final class FabricArgumentParsers {
|
|||
synchronized (this) {
|
||||
if (this.provided == null) {
|
||||
if (ctx == null) {
|
||||
throw new IllegalStateException("No build context was available while trying to compute an argument type");
|
||||
throw new IllegalStateException(
|
||||
"No build context was available while trying to compute an argument type");
|
||||
}
|
||||
provided = this.provider.apply(ctx.commandBuildContext);
|
||||
this.provided = provided;
|
||||
|
|
@ -611,7 +610,5 @@ public final class FabricArgumentParsers {
|
|||
}
|
||||
return provided;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -162,7 +162,5 @@ public final class FloatRangeArgument<C> extends CommandArgument<C, MinMaxBounds
|
|||
}
|
||||
return this.asOptionalWithDefault(value.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -162,7 +162,5 @@ public final class IntRangeArgument<C> extends CommandArgument<C, MinMaxBounds.I
|
|||
}
|
||||
return this.asOptionalWithDefault(value.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,7 +108,6 @@ public final class ItemInputArgument<C> extends CommandArgument<C, ItemInput> {
|
|||
*/
|
||||
public static <C> @NonNull ItemInputArgument<C> optional(final @NonNull String name, final @NonNull ItemStack defaultValue) {
|
||||
return ItemInputArgument.<C>builder(name).asOptionalWithDefault(defaultValue).build();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -157,7 +156,5 @@ public final class ItemInputArgument<C> extends CommandArgument<C, ItemInput> {
|
|||
}
|
||||
return this.asOptionalWithDefault(serializedDefault);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,7 +153,5 @@ public final class MobEffectArgument<C> extends CommandArgument<C, MobEffect> {
|
|||
public @NonNull Builder<C> asOptionalWithDefault(final @NonNull MobEffect defaultValue) {
|
||||
return this.asOptionalWithDefault(Registry.MOB_EFFECT.getKey(defaultValue).toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,7 +155,5 @@ public final class NamedColorArgument<C> extends CommandArgument<C, ChatFormatti
|
|||
}
|
||||
return this.asOptionalWithDefault(defaultColor.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,7 +118,8 @@ public final class NbtPathArgument<C> extends CommandArgument<C, net.minecraft.c
|
|||
* @param <C> sender type
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public static final class Builder<C> extends TypedBuilder<C, net.minecraft.commands.arguments.NbtPathArgument.NbtPath, Builder<C>> {
|
||||
public static final class Builder<C> extends
|
||||
TypedBuilder<C, net.minecraft.commands.arguments.NbtPathArgument.NbtPath, Builder<C>> {
|
||||
|
||||
Builder(final @NonNull String name) {
|
||||
super(net.minecraft.commands.arguments.NbtPathArgument.NbtPath.class, name);
|
||||
|
|
@ -150,10 +151,9 @@ public final class NbtPathArgument<C> extends CommandArgument<C, net.minecraft.c
|
|||
* @since 1.5.0
|
||||
*/
|
||||
public @NonNull Builder<C> asOptionalWithDefault(
|
||||
final net.minecraft.commands.arguments.NbtPathArgument.@NonNull NbtPath defaultValue) {
|
||||
final net.minecraft.commands.arguments.NbtPathArgument.@NonNull NbtPath defaultValue
|
||||
) {
|
||||
return this.asOptionalWithDefault(defaultValue.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,7 +149,5 @@ public final class NbtTagArgument<C> extends CommandArgument<C, Tag> {
|
|||
public @NonNull Builder<C> asOptionalWithDefault(final @NonNull Tag defaultValue) {
|
||||
return this.asOptionalWithDefault(defaultValue.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,7 +152,5 @@ public final class ObjectiveCriteriaArgument<C> extends CommandArgument<C, Objec
|
|||
public @NonNull Builder<C> asOptionalWithDefault(final @NonNull ObjectiveCriteria defaultValue) {
|
||||
return this.asOptionalWithDefault(defaultValue.getName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,7 +152,5 @@ public final class ParticleArgument<C> extends CommandArgument<C, ParticleOption
|
|||
public @NonNull Builder<C> asOptionalWithDefault(final @NonNull ParticleOptions defaultValue) {
|
||||
return this.asOptionalWithDefault(defaultValue.writeToString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -277,7 +277,6 @@ public class RegistryEntryArgument<C, V> extends CommandArgument<C, V> {
|
|||
public ResourceKey<? extends Registry<?>> registryKey() {
|
||||
return this.registryIdent;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -333,7 +332,6 @@ public class RegistryEntryArgument<C, V> extends CommandArgument<C, V> {
|
|||
public @NonNull Builder<C, V> asOptionalWithDefault(final @NonNull ResourceKey<V> defaultValue) {
|
||||
return this.asOptionalWithDefault(defaultValue.location().toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -358,7 +356,5 @@ public class RegistryEntryArgument<C, V> extends CommandArgument<C, V> {
|
|||
CaptionVariable.of("registry", registry.toString())
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,7 +152,5 @@ public final class ResourceLocationArgument<C> extends CommandArgument<C, Resour
|
|||
public @NonNull Builder<C> asOptionalWithDefault(final @NonNull ResourceLocation defaultValue) {
|
||||
return this.asOptionalWithDefault(defaultValue.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,7 +126,5 @@ public final class ScoreboardOperationArgument<C> extends CommandArgument<C, Ope
|
|||
this.getDefaultDescription()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,5 +96,4 @@ abstract class SidedArgumentParser<C, I, R> implements ArgumentParser<C, R> {
|
|||
@NonNull CommandSourceStack source,
|
||||
@NonNull I value
|
||||
);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,7 +173,6 @@ public final class TeamArgument<C> extends CommandArgument<C, PlayerTeam> {
|
|||
}
|
||||
return ArgumentParseResult.success(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -216,7 +215,6 @@ public final class TeamArgument<C> extends CommandArgument<C, PlayerTeam> {
|
|||
public @NonNull Builder<C> asOptionalWithDefault(final @NonNull PlayerTeam defaultValue) {
|
||||
return this.asOptionalWithDefault(defaultValue.getName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -239,7 +237,5 @@ public final class TeamArgument<C> extends CommandArgument<C, PlayerTeam> {
|
|||
CaptionVariable.of("input", input)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,7 +151,5 @@ public final class TimeArgument<C> extends CommandArgument<C, MinecraftTime> {
|
|||
public @NonNull Builder<C> asOptionalWithDefault(final @NonNull MinecraftTime defaultValue) {
|
||||
return this.asOptionalWithDefault(defaultValue.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,7 +156,5 @@ public final class BlockPosArgument<C> extends CommandArgument<C, BlockCoordinat
|
|||
defaultValue.getZ()
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,7 +155,5 @@ public final class ColumnPosArgument<C> extends CommandArgument<C, ColumnCoordin
|
|||
defaultValue.getZ()
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,7 +140,5 @@ public final class MessageArgument<C> extends CommandArgument<C, Message> {
|
|||
this.getDefaultDescription()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,7 +124,5 @@ public final class MultipleEntitySelectorArgument<C> extends CommandArgument<C,
|
|||
this.getDefaultDescription()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,7 +124,5 @@ public final class MultiplePlayerSelectorArgument<C> extends CommandArgument<C,
|
|||
this.getDefaultDescription()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,7 +124,5 @@ public final class SingleEntitySelectorArgument<C> extends CommandArgument<C, Si
|
|||
this.getDefaultDescription()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,7 +124,5 @@ public final class SinglePlayerSelectorArgument<C> extends CommandArgument<C, Si
|
|||
this.getDefaultDescription()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -236,7 +236,5 @@ public final class Vec2dArgument<C> extends CommandArgument<C, Coordinates.Coord
|
|||
this.centerIntegers()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -237,7 +237,5 @@ public final class Vec3dArgument<C> extends CommandArgument<C, Coordinates> {
|
|||
this.centerIntegers()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,5 +112,4 @@ public interface Coordinates {
|
|||
interface ColumnCoordinates extends Coordinates {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,5 +50,4 @@ public interface Message {
|
|||
* @since 1.5.0
|
||||
*/
|
||||
@NonNull Component contents();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,5 +151,4 @@ public final class MinecraftTime {
|
|||
public String toString() {
|
||||
return Long.toString(this.ticks);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,7 +83,5 @@ public interface Selector<V> {
|
|||
* @since 1.5.0
|
||||
*/
|
||||
@NonNull V getSingle();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,5 +41,4 @@ public final class CloudStringReader extends StringReader {
|
|||
public CloudStringReader(final String input) {
|
||||
super(input);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,5 +40,4 @@ public interface EntitySelectorAccess {
|
|||
* @param inputString input string
|
||||
*/
|
||||
void inputString(@NonNull String inputString);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,5 +49,4 @@ public final class LateRegistrationCatcher implements ModInitializer {
|
|||
public static boolean hasServerAlreadyStarted() {
|
||||
return LateRegistrationCatcher.serverStartingCalled;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,5 +38,4 @@ public class CommandsMixin {
|
|||
private StringReader cloud$newStringReader(final String arguments) {
|
||||
return new CloudStringReader(arguments);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,5 +45,4 @@ abstract class EntitySelectorMixin {
|
|||
public void cloud$inputString(final @NonNull String inputString) {
|
||||
this.inputString = inputString;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,5 +51,4 @@ abstract class EntitySelectorParserMixin {
|
|||
final String inputString = this.reader.getString().substring(this.startPosition, this.reader.getCursor());
|
||||
((EntitySelectorAccess) selector).inputString(inputString);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,5 +29,7 @@ import org.spongepowered.asm.mixin.gen.Accessor;
|
|||
|
||||
@Mixin(MessageArgument.Message.class)
|
||||
public interface MessageArgumentMessageAccess {
|
||||
@Accessor("parts") MessageArgument.Part[] accessor$parts();
|
||||
|
||||
@Accessor("parts")
|
||||
MessageArgument.Part[] accessor$parts();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,5 +30,7 @@ import org.spongepowered.asm.mixin.gen.Accessor;
|
|||
|
||||
@Mixin(MessageArgument.Part.class)
|
||||
public interface MessageArgumentPartAccess {
|
||||
@Accessor("selector") EntitySelector accessor$selector();
|
||||
|
||||
@Accessor("selector")
|
||||
EntitySelector accessor$selector();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,5 +143,4 @@ public final class FabricClientExample implements ClientModInitializer {
|
|||
client.setScreen(new JoinMultiplayerScreen(new TitleScreen()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,9 +108,9 @@ public final class FabricExample implements ModInitializer {
|
|||
final Collection<ServerPlayer> selected = selector.get();
|
||||
selected.forEach(selectedPlayer ->
|
||||
selectedPlayer.sendSystemMessage(
|
||||
Component.literal("Wave from ")
|
||||
.withStyle(style -> style.withColor(ctx.get(textColor)))
|
||||
.append(ctx.getSender().getDisplayName())
|
||||
Component.literal("Wave from ")
|
||||
.withStyle(style -> style.withColor(ctx.get(textColor)))
|
||||
.append(ctx.getSender().getDisplayName())
|
||||
));
|
||||
ctx.getSender().sendSuccess(
|
||||
Component.literal(String.format("Waved at %d players (%s)", selected.size(),
|
||||
|
|
@ -163,7 +163,9 @@ public final class FabricExample implements ModInitializer {
|
|||
HoverEvent.Action.SHOW_TEXT,
|
||||
Component.literal("Click for more info")
|
||||
)))
|
||||
.append(Component.literal(mod.getName()).withStyle(style -> style.withColor(ChatFormatting.GREEN)))
|
||||
.append(Component
|
||||
.literal(mod.getName())
|
||||
.withStyle(style -> style.withColor(ChatFormatting.GREEN)))
|
||||
.append(Component.literal(String.format(" (%s) ", mod.getId()))
|
||||
.withStyle(style -> style
|
||||
.withColor(ChatFormatting.GRAY)
|
||||
|
|
@ -251,5 +253,4 @@ public final class FabricExample implements ModInitializer {
|
|||
player.teleportToWithTicket(pos.getMinBlockX(), 128, pos.getMinBlockZ());
|
||||
}));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,5 +44,4 @@ public interface GiveCommandAccess {
|
|||
) {
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue