chore: make code style consistent

This commit is contained in:
Citymonstret 2022-06-10 10:24:50 +02:00 committed by Jason
parent a2cea2f33e
commit 89ec3fbf29
380 changed files with 479 additions and 936 deletions

View file

@ -315,5 +315,4 @@ public final class BukkitBrigadierMapper<C> {
) {
this.brigadierManager.registerDefaultArgumentTypeSupplier(type, argumentTypeSupplier);
}
}

View file

@ -128,5 +128,4 @@ public final class BukkitCaptionKeys {
public static @NonNull Collection<@NonNull Caption> getBukkitCaptionKeys() {
return Collections.unmodifiableCollection(RECOGNIZED_CAPTIONS);
}
}

View file

@ -169,5 +169,4 @@ public class BukkitCaptionRegistry<C> extends SimpleCaptionRegistry<C> {
(caption, sender) -> ARGUMENT_PARSE_FAILURE_NAMESPACED_KEY_NEED_NAMESPACE
);
}
}

View file

@ -40,5 +40,4 @@ public final class BukkitCaptionRegistryFactory<C> {
public @NonNull BukkitCaptionRegistry<C> create() {
return new BukkitCaptionRegistry<>();
}
}

View file

@ -59,5 +59,4 @@ public final class BukkitCommandContextKeys {
private BukkitCommandContextKeys() {
}
}

View file

@ -454,7 +454,5 @@ public class BukkitCommandManager<C> extends CommandManager<C> implements Brigad
this.getCause() == null ? "" : this.getCause().getMessage()
);
}
}
}

View file

@ -42,5 +42,4 @@ public class BukkitCommandMeta extends SimpleCommandMeta {
public BukkitCommandMeta(final @NonNull SimpleCommandMeta simpleCommandMeta) {
super(simpleCommandMeta);
}
}

View file

@ -62,7 +62,6 @@ public final class BukkitCommandMetaBuilder {
public @NonNull BuilderStage2 withDescription(final @NonNull String description) {
return new BuilderStage2(description);
}
}
@ -82,7 +81,5 @@ public final class BukkitCommandMetaBuilder {
public @NonNull BukkitCommandMeta build() {
return new BukkitCommandMeta(CommandMeta.simple().with(CommandMeta.DESCRIPTION, this.description).build());
}
}
}

View file

@ -77,5 +77,4 @@ final class BukkitCommandPreprocessor<C> implements CommandPreprocessor<C> {
this.commandManager.queryCapabilities()
);
}
}

View file

@ -127,5 +127,4 @@ public abstract class BukkitCommandSender {
public void sendMessage(final @NonNull String message) {
this.internalSender.sendMessage(message);
}
}

View file

@ -43,5 +43,4 @@ final class BukkitConsoleSender extends BukkitCommandSender {
public @NonNull Player asPlayer() {
throw new UnsupportedOperationException("Cannot convert console to player");
}
}

View file

@ -61,5 +61,4 @@ public final class BukkitParserParameters {
) {
return new ParserParameter<>(key, expectedType);
}
}

View file

@ -42,5 +42,4 @@ final class BukkitPlayerSender extends BukkitCommandSender {
public @NonNull Player asPlayer() {
return (Player) this.getInternalSender();
}
}

View file

@ -82,8 +82,9 @@ public class BukkitPluginRegistrationHandler<C> implements CommandRegistrationHa
final String label = commandArgument.getName();
final String namespacedLabel = this.getNamespacedLabel(label);
@SuppressWarnings("unchecked")
final List<String> aliases = new ArrayList<>(((StaticArgument<C>) commandArgument).getAlternativeAliases());
@SuppressWarnings("unchecked") final List<String> aliases = new ArrayList<>(
((StaticArgument<C>) commandArgument).getAlternativeAliases()
);
@SuppressWarnings("unchecked") final BukkitCommand<C> bukkitCommand = new BukkitCommand<>(
label,
@ -226,5 +227,4 @@ public class BukkitPluginRegistrationHandler<C> implements CommandRegistrationHa
}
return command != null;
}
}

View file

@ -79,5 +79,4 @@ public final class BukkitSynchronizer implements TaskSynchronizer {
this.plugin.getServer().getScheduler().runTaskAsynchronously(this.plugin, () -> future.complete(function.apply(input)));
return future;
}
}

View file

@ -35,7 +35,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
*/
public enum CloudBukkitCapabilities implements CloudCapability {
BRIGADIER(CraftBukkitReflection.classExists("com.mojang.brigadier.tree.CommandNode")
&& CraftBukkitReflection.findOBCClass("command.BukkitCommandWrapper") != null),
&& CraftBukkitReflection.findOBCClass("command.BukkitCommandWrapper") != null),
NATIVE_BRIGADIER(CraftBukkitReflection.classExists(
"com.destroystokyo.paper.event.brigadier.CommandRegisteredEvent")),

View file

@ -118,7 +118,9 @@ class CloudCommodoreManager<C> extends BukkitPluginRegistrationHandler<C> {
}
try {
final Class<? extends Commodore> commodoreImpl = (Class<? extends Commodore>) Class.forName("me.lucko.commodore.CommodoreImpl");
final Class<? extends Commodore> commodoreImpl = (Class<? extends Commodore>) Class.forName(
"me.lucko.commodore.CommodoreImpl"
);
final Method removeChild = commodoreImpl.getDeclaredMethod("removeChild", RootCommandNode.class, String.class);
removeChild.setAccessible(true);
@ -148,5 +150,4 @@ class CloudCommodoreManager<C> extends BukkitPluginRegistrationHandler<C> {
}
}
}
}

View file

@ -199,7 +199,6 @@ public final class NamespacedKeyArgument<C> extends CommandArgument<C, Namespace
this.defaultNamespace
);
}
}
/**
@ -286,7 +285,6 @@ public final class NamespacedKeyArgument<C> extends CommandArgument<C, Namespace
}
return ret;
}
}
@ -348,7 +346,6 @@ public final class NamespacedKeyArgument<C> extends CommandArgument<C, Namespace
public int hashCode() {
return Objects.hash(this.input, this.errorCaption());
}
}
/**
@ -365,5 +362,4 @@ public final class NamespacedKeyArgument<C> extends CommandArgument<C, Namespace
params.get(BukkitParserParameters.DEFAULT_NAMESPACE, NamespacedKey.MINECRAFT)
));
}
}

View file

@ -76,5 +76,4 @@ public abstract class EntitySelector {
public boolean hasAny() {
return !this.entities.isEmpty();
}
}

View file

@ -39,5 +39,4 @@ public class MultipleEntitySelector extends EntitySelector {
) {
super(selector, entities);
}
}

View file

@ -63,5 +63,4 @@ public class MultiplePlayerSelector extends MultipleEntitySelector {
public final @NonNull List<@NonNull Player> getPlayers() {
return Collections.unmodifiableList(this.players);
}
}

View file

@ -57,5 +57,4 @@ public final class SingleEntitySelector extends MultipleEntitySelector {
}
return this.getEntities().get(0);
}
}

View file

@ -58,5 +58,4 @@ public final class SinglePlayerSelector extends MultiplePlayerSelector {
}
return this.getPlayers().get(0);
}
}

View file

@ -50,5 +50,4 @@ public interface BlockPredicate extends Predicate<Block> {
* @since 1.5.0
*/
@NonNull BlockPredicate loadChunks();
}

View file

@ -61,5 +61,4 @@ public interface ProtoItemStack {
*/
@NonNull ItemStack createItemStack(int stackSize, boolean respectMaximumStackSize)
throws IllegalArgumentException;
}

View file

@ -56,5 +56,4 @@ public final class BukkitBackwardsBrigadierSenderMapper<C, S> implements Functio
throw new RuntimeException(e);
}
}
}

View file

@ -65,5 +65,4 @@ public final class CommandBuildContextSupplier {
throw new RuntimeException(e);
}
}
}

View file

@ -209,5 +209,4 @@ public final class CraftBukkitReflection {
private CraftBukkitReflection() {
}
}

View file

@ -95,11 +95,13 @@ public final class MinecraftArgumentTypes {
}
private interface ArgumentTypeGetter {
Class<? extends ArgumentType<?>> getClassByKey(@NonNull NamespacedKey key) throws IllegalArgumentException;
}
@SuppressWarnings("unchecked")
private static final class ArgumentTypeGetterImpl implements MinecraftArgumentTypes.ArgumentTypeGetter {
private final Object argumentRegistry;
private final Map<?, ?> byClassMap;
@ -129,6 +131,7 @@ public final class MinecraftArgumentTypes {
@SuppressWarnings("unchecked")
private static final class LegacyArgumentTypeGetter implements ArgumentTypeGetter {
private static final Constructor<?> MINECRAFT_KEY_CONSTRUCTOR;
private static final Method ARGUMENT_REGISTRY_GET_BY_KEY_METHOD;
private static final Field BY_CLASS_MAP_FIELD;
@ -201,5 +204,4 @@ public final class MinecraftArgumentTypes {
}
}
}
}

View file

@ -36,6 +36,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
*/
@Beta
public final class RegistryReflection {
public static final @Nullable Field REGISTRY_REGISTRY;
public static final @Nullable Method REGISTRY_GET;

View file

@ -132,7 +132,6 @@ public final class BlockPredicateArgument<C> extends CommandArgument<C, BlockPre
this.getDefaultDescription()
);
}
}
/**
@ -325,9 +324,7 @@ public final class BlockPredicateArgument<C> extends CommandArgument<C, BlockPre
}
};
}
}
}
/**
@ -341,5 +338,4 @@ public final class BlockPredicateArgument<C> extends CommandArgument<C, BlockPre
commandManager.getParserRegistry()
.registerParserSupplier(TypeToken.get(BlockPredicate.class), params -> new BlockPredicateArgument.Parser<>());
}
}

View file

@ -55,8 +55,16 @@ public class EnchantmentArgument<C> extends CommandArgument<C, Enchantment> {
final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String,
@NonNull List<@NonNull String>> suggestionsProvider,
final @NonNull ArgumentDescription defaultDescription
) {
super(required, name, new EnchantmentParser<>(), defaultValue, Enchantment.class, suggestionsProvider, defaultDescription);
) {
super(
required,
name,
new EnchantmentParser<>(),
defaultValue,
Enchantment.class,
suggestionsProvider,
defaultDescription
);
}
/**
@ -123,7 +131,6 @@ public class EnchantmentArgument<C> extends CommandArgument<C, Enchantment> {
this.getDefaultDescription()
);
}
}
public static final class EnchantmentParser<C> implements ArgumentParser<C, Enchantment> {
@ -177,7 +184,6 @@ public class EnchantmentArgument<C> extends CommandArgument<C, Enchantment> {
}
return completions;
}
}
@ -213,7 +219,5 @@ public class EnchantmentArgument<C> extends CommandArgument<C, Enchantment> {
public @NonNull String getInput() {
return this.input;
}
}
}

View file

@ -136,7 +136,6 @@ public final class ItemStackArgument<C> extends CommandArgument<C, ProtoItemStac
this.getDefaultDescription()
);
}
}
/**
@ -177,7 +176,6 @@ public final class ItemStackArgument<C> extends CommandArgument<C, ProtoItemStac
) {
return this.parser.suggestions(commandContext, input);
}
}
private static @Nullable Class<?> findItemInputClass() {
@ -332,9 +330,7 @@ public final class ItemStackArgument<C> extends CommandArgument<C, ProtoItemStac
throw new RuntimeException(e);
}
}
}
}
private static final class LegacyParser<C> implements ArgumentParser<C, ProtoItemStack> {
@ -391,9 +387,6 @@ public final class ItemStackArgument<C> extends CommandArgument<C, ProtoItemStac
}
return new ItemStack(this.material, stackSize);
}
}
}
}

View file

@ -133,7 +133,6 @@ public final class ItemStackPredicateArgument<C> extends CommandArgument<C, Item
this.getDefaultDescription()
);
}
}
/**
@ -261,9 +260,7 @@ public final class ItemStackPredicateArgument<C> extends CommandArgument<C, Item
throw new RuntimeException(ex);
}
}
}
}
/**
@ -279,5 +276,4 @@ public final class ItemStackPredicateArgument<C> extends CommandArgument<C, Item
params -> new ItemStackPredicateArgument.Parser<>()
);
}
}

View file

@ -54,7 +54,7 @@ public class MaterialArgument<C> extends CommandArgument<C, Material> {
final @Nullable BiFunction<@NonNull CommandContext<C>, @NonNull String,
@NonNull List<@NonNull String>> suggestionsProvider,
final @NonNull ArgumentDescription defaultDescription
) {
) {
super(required, name, new MaterialParser<>(), defaultValue, Material.class, suggestionsProvider, defaultDescription);
}
@ -122,7 +122,6 @@ public class MaterialArgument<C> extends CommandArgument<C, Material> {
this.getDefaultDescription()
);
}
}
public static final class MaterialParser<C> implements ArgumentParser<C, Material> {
@ -160,7 +159,6 @@ public class MaterialArgument<C> extends CommandArgument<C, Material> {
}
return completions;
}
}
@ -196,7 +194,5 @@ public class MaterialArgument<C> extends CommandArgument<C, Material> {
public @NonNull String getInput() {
return this.input;
}
}
}

View file

@ -140,7 +140,6 @@ public final class OfflinePlayerArgument<C> extends CommandArgument<C, OfflinePl
this.getSuggestionsProvider(), this.getDefaultDescription()
);
}
}
@ -187,7 +186,6 @@ public final class OfflinePlayerArgument<C> extends CommandArgument<C, OfflinePl
return output;
}
}
@ -226,7 +224,5 @@ public final class OfflinePlayerArgument<C> extends CommandArgument<C, OfflinePl
public @NonNull String getInput() {
return this.input;
}
}
}

View file

@ -132,7 +132,6 @@ public final class PlayerArgument<C> extends CommandArgument<C, Player> {
this.getDefaultDescription()
);
}
}
@ -179,7 +178,6 @@ public final class PlayerArgument<C> extends CommandArgument<C, Player> {
return output;
}
}
@ -218,7 +216,5 @@ public final class PlayerArgument<C> extends CommandArgument<C, Player> {
public @NonNull String getInput() {
return this.input;
}
}
}

View file

@ -123,7 +123,6 @@ public class WorldArgument<C> extends CommandArgument<C, World> {
this.getDefaultDescription()
);
}
}
@ -155,7 +154,6 @@ public class WorldArgument<C> extends CommandArgument<C, World> {
public @NonNull List<String> suggestions(final @NonNull CommandContext<C> commandContext, final @NonNull String input) {
return Bukkit.getWorlds().stream().map(World::getName).collect(Collectors.toList());
}
}
@ -191,7 +189,5 @@ public class WorldArgument<C> extends CommandArgument<C, World> {
public @NonNull String getInput() {
return this.input;
}
}
}

View file

@ -50,5 +50,4 @@ public class Location2D extends Location {
public static @NonNull Location2D from(final @Nullable World world, final double x, final double z) {
return new Location2D(world, x, z);
}
}

View file

@ -141,7 +141,6 @@ public final class Location2DArgument<C> extends CommandArgument<C, Location2D>
new LinkedList<>()
);
}
}
@ -246,7 +245,5 @@ public final class Location2DArgument<C> extends CommandArgument<C, Location2D>
public int getRequestedArgumentCount() {
return EXPECTED_PARAMETER_COUNT;
}
}
}

View file

@ -146,7 +146,6 @@ public final class LocationArgument<C> extends CommandArgument<C, Location> {
new LinkedList<>()
);
}
}
@ -303,7 +302,6 @@ public final class LocationArgument<C> extends CommandArgument<C, Location> {
public int getRequestedArgumentCount() {
return EXPECTED_PARAMETER_COUNT;
}
}
@ -348,9 +346,6 @@ public final class LocationArgument<C> extends CommandArgument<C, Location> {
public @NonNull Caption getCaption() {
return this.caption;
}
}
}
}

View file

@ -98,5 +98,4 @@ public final class LocationCoordinate {
public String toString() {
return String.format("LocationCoordinate{type=%s, coordinate=%f}", this.type.name().toLowerCase(), this.coordinate);
}
}

View file

@ -88,5 +88,4 @@ public final class LocationCoordinateParser<C> implements ArgumentParser<C, Loca
)
);
}
}

View file

@ -121,7 +121,6 @@ public final class MultipleEntitySelectorArgument<C> extends CommandArgument<C,
this.getSuggestionsProvider(), this.getDefaultDescription()
);
}
}
@ -164,7 +163,5 @@ public final class MultipleEntitySelectorArgument<C> extends CommandArgument<C,
inputQueue.remove();
return ArgumentParseResult.success(new MultipleEntitySelector(input, entities));
}
}
}

View file

@ -126,7 +126,6 @@ public final class MultiplePlayerSelectorArgument<C> extends CommandArgument<C,
this.getSuggestionsProvider(), this.getDefaultDescription()
);
}
}
@ -201,7 +200,5 @@ public final class MultiplePlayerSelectorArgument<C> extends CommandArgument<C,
return output;
}
}
}

View file

@ -110,7 +110,5 @@ public final class SelectorParseException extends ParserException {
public @NonNull Caption getCaption() {
return this.caption;
}
}
}

View file

@ -127,7 +127,6 @@ public final class SingleEntitySelectorArgument<C> extends CommandArgument<C, Si
this.getSuggestionsProvider(), this.getDefaultDescription()
);
}
}
@ -179,7 +178,5 @@ public final class SingleEntitySelectorArgument<C> extends CommandArgument<C, Si
inputQueue.remove();
return ArgumentParseResult.success(new SingleEntitySelector(input, entities));
}
}
}

View file

@ -132,7 +132,6 @@ public final class SinglePlayerSelectorArgument<C> extends CommandArgument<C, Si
this.getSuggestionsProvider(), this.getDefaultDescription()
);
}
}
@ -215,7 +214,5 @@ public final class SinglePlayerSelectorArgument<C> extends CommandArgument<C, Si
return output;
}
}
}