some codestyle application

This commit is contained in:
dordsor21
2021-09-08 16:39:43 +01:00
parent dc11b74020
commit 195a13a23c
92 changed files with 465 additions and 291 deletions

View File

@ -1500,4 +1500,5 @@ public class BrushCommands {
player.print(Caption.of("worldedit.brush.operation.equip", TextComponent.of(factory.toString())));
ToolCommands.sendUnbindInstruction(player, UNBIND_COMMAND_COMPONENT);
}
}

View File

@ -28,7 +28,6 @@ import com.fastasyncworldedit.core.extent.clipboard.DiskOptimizedClipboard;
import com.fastasyncworldedit.core.extent.clipboard.MultiClipboardHolder;
import com.fastasyncworldedit.core.extent.clipboard.ReadOnlyClipboard;
import com.fastasyncworldedit.core.extent.clipboard.URIClipboardHolder;
import com.fastasyncworldedit.core.internal.exception.FaweException;
import com.fastasyncworldedit.core.internal.io.FastByteArrayOutputStream;
import com.fastasyncworldedit.core.object.FaweLimit;
import com.fastasyncworldedit.core.util.ImgurUtility;

View File

@ -75,9 +75,9 @@ public class ExpandCommands {
command.condition(new PermissionCondition(ImmutableSet.of("worldedit.selection.expand")));
command.addPart(SubCommandPart.builder(
Caption.of("vert"),
TextComponent.of("Vertical expansion sub-command")
)
Caption.of("vert"),
TextComponent.of("Vertical expansion sub-command")
)
.withCommands(ImmutableSet.of(createVertCommand(commandManager)))
.optional()
.build());

View File

@ -51,7 +51,6 @@ import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockType;
import org.enginehub.piston.annotation.Command;
@ -637,11 +636,14 @@ public class GenerationCommands {
((AbstractExtentMask) mask).setExtent(editSession);
}
checkCommandArgument(minY >= editSession.getMinY(), Caption.of("fawe.error.outside-range-lower", "miny",
editSession.getMinY()));
editSession.getMinY()
));
checkCommandArgument(maxY <= editSession.getMaxY(), Caption.of("fawe.error.outside-range-upper", "maxy",
editSession.getMaxY()));
editSession.getMaxY()
));
checkCommandArgument(minY < maxY, Caption.of("fawe.error.argument-size-mismatch", "miny",
"maxy"));
"maxy"
));
editSession.addOre(region, mask, material, size, freq, rarity, minY, maxY);
actor.print(Caption.of("fawe.worldedit.visitor.visitor.block", editSession.getBlockChangeCount()));
}

View File

@ -147,8 +147,8 @@ class LegacySnapshotCommands {
if (snapshot == null) {
actor.print(Caption.of(
"worldedit.snapshot.none-before",
TextComponent.of(dateFormat.withZone(session.getTimeZone()).format(date))
"worldedit.snapshot.none-before",
TextComponent.of(dateFormat.withZone(session.getTimeZone()).format(date))
)
);
} else {
@ -167,8 +167,8 @@ class LegacySnapshotCommands {
Snapshot snapshot = config.snapshotRepo.getSnapshotAfter(date, world.getName());
if (snapshot == null) {
actor.print(Caption.of(
"worldedit.snapshot.none-after",
TextComponent.of(dateFormat.withZone(session.getTimeZone()).format(date))
"worldedit.snapshot.none-after",
TextComponent.of(dateFormat.withZone(session.getTimeZone()).format(date))
)
);
} else {

View File

@ -320,10 +320,10 @@ public class RegionCommands {
) throws WorldEditException {
if (from == null) {
from = new ExistingBlockMask(editSession);
//FAWE start > the mask will have been initialised with a WorldWrapper extent (very bad/slow
//FAWE start > the mask will have been initialised with a WorldWrapper extent (very bad/slow
} else if (from instanceof AbstractExtentMask) {
((AbstractExtentMask) from).setExtent(editSession);
//FAWE end
//FAWE end
}
if (from instanceof AbstractExtentMask) {
((AbstractExtentMask) from).setExtent(editSession);

View File

@ -272,8 +272,8 @@ public class SnapshotCommands {
if (snapshot == null) {
actor.print(Caption.of(
"worldedit.snapshot.none-before",
TextComponent.of(dateFormat.withZone(session.getTimeZone()).format(date))
"worldedit.snapshot.none-before",
TextComponent.of(dateFormat.withZone(session.getTimeZone()).format(date))
)
);
} else {
@ -314,8 +314,8 @@ public class SnapshotCommands {
}
if (snapshot == null) {
actor.print(Caption.of(
"worldedit.snapshot.none-after",
TextComponent.of(dateFormat.withZone(session.getTimeZone()).format(date))
"worldedit.snapshot.none-after",
TextComponent.of(dateFormat.withZone(session.getTimeZone()).format(date))
)
);
} else {

View File

@ -122,9 +122,9 @@ public class ToolCommands {
.collect(Collectors.toSet());
commandManager.register("tool", command -> {
command.addPart(SubCommandPart.builder(
Caption.of("tool"),
TextComponent.of("The tool to bind")
)
Caption.of("tool"),
TextComponent.of("The tool to bind")
)
.withCommands(nonGlobalCommands)
.required()
.build());

View File

@ -367,11 +367,13 @@ public class ToolUtilCommands {
desc = "Set the brush transform"
)
@CommandPermissions({"worldedit.brush.options.transform", "worldedit.transform.brush"})
public void transform(Player player, LocalSession session, EditSession editSession,
@Arg(desc = "The transform", def = "") ResettableExtent transform,
@Switch(name = 'h', desc = "Whether the offhand should be considered or not")
boolean offHand,
Arguments arguments) throws WorldEditException {
public void transform(
Player player, LocalSession session, EditSession editSession,
@Arg(desc = "The transform", def = "") ResettableExtent transform,
@Switch(name = 'h', desc = "Whether the offhand should be considered or not")
boolean offHand,
Arguments arguments
) throws WorldEditException {
BrushTool tool = session.getBrushTool(player, false);
if (tool == null) {
player.print(Caption.of("fawe.worldedit.brush.brush.none"));

View File

@ -414,7 +414,9 @@ public class UtilityCommands {
size = Math.max(1, size);
we.checkMaxRadius(size);
height = height != null ? Math.min((world.getMaxY() - world.getMinY() + 1), height + 1) : (world.getMaxY() - world.getMinY() + 1);
height = height != null
? Math.min((world.getMaxY() - world.getMinY() + 1), height + 1)
: (world.getMaxY() - world.getMinY() + 1);
int affected = editSession.removeAbove(session.getPlacementPosition(actor), size, height);
actor.print(Caption.of("worldedit.removeabove.removed", TextComponent.of(affected)));
return affected;
@ -437,7 +439,9 @@ public class UtilityCommands {
size = Math.max(1, size);
we.checkMaxRadius(size);
height = height != null ? Math.min((world.getMaxY() - world.getMinY() + 1), height + 1) : (world.getMaxY() - world.getMinY() + 1);
height = height != null
? Math.min((world.getMaxY() - world.getMinY() + 1), height + 1)
: (world.getMaxY() - world.getMinY() + 1);
int affected = editSession.removeBelow(session.getPlacementPosition(actor), size, height);
actor.print(Caption.of("worldedit.removebelow.removed", TextComponent.of(affected)));
return affected;

View File

@ -30,11 +30,11 @@ public class BooleanConverter {
commandManager.registerConverter(
Key.of(Boolean.class),
MultiKeyConverter.builder(
ImmutableSetMultimap.<Boolean, String>builder()
.putAll(false, "off", "f", "false", "n", "no")
.putAll(true, "on", "t", "true", "y", "yes")
.build()
)
ImmutableSetMultimap.<Boolean, String>builder()
.putAll(false, "off", "f", "false", "n", "no")
.putAll(true, "on", "t", "true", "y", "yes")
.build()
)
.errorMessage(arg -> "Not a boolean value: " + arg)
.build()
);

View File

@ -60,6 +60,7 @@ public class FactoryConverter<T> implements ArgumentConverter<T> {
private final String description;
@Nullable
private final Consumer<ParserContext> contextTweaker;
private FactoryConverter(
WorldEdit worldEdit,
Function<WorldEdit, AbstractFactory<T>> factoryExtractor,

View File

@ -34,12 +34,12 @@ public class RegionFactoryConverter {
commandManager.registerConverter(
Key.of(RegionFactory.class),
MultiKeyConverter.builder(
ImmutableSetMultimap.<RegionFactory, String>builder()
.put(new CuboidRegionFactory(), "cuboid")
.put(new SphereRegionFactory(), "sphere")
.putAll(new CylinderRegionFactory(1), "cyl", "cylinder")
.build()
)
ImmutableSetMultimap.<RegionFactory, String>builder()
.put(new CuboidRegionFactory(), "cuboid")
.put(new SphereRegionFactory(), "sphere")
.putAll(new CylinderRegionFactory(1), "cyl", "cylinder")
.build()
)
.errorMessage(arg -> "Not a known region type: " + arg)
.build()
);

View File

@ -53,17 +53,17 @@ public final class RegistryConverter<V extends Keyed> implements ArgumentConvert
@SuppressWarnings("unchecked")
public static void register(CommandManager commandManager) {
ImmutableList.of(
BlockType.class,
BlockCategory.class,
ItemType.class,
ItemCategory.class,
BiomeType.class,
EntityType.class,
FluidType.class,
FluidCategory.class,
GameMode.class,
WeatherType.class
)
BlockType.class,
BlockCategory.class,
ItemType.class,
ItemCategory.class,
BiomeType.class,
EntityType.class,
FluidType.class,
FluidCategory.class,
GameMode.class,
WeatherType.class
)
.stream()
.map(c -> (Class<Keyed>) c)
.forEach(registryType ->

View File

@ -88,7 +88,8 @@ public class FloodFillTool implements BlockTool {
Mask mask = initialType.toMask(editSession);
BlockReplace function = new BlockReplace(editSession, pattern);
RecursiveVisitor visitor = new RecursiveVisitor(mask, function, range, editSession.getMinY(),
editSession.getMaxY(), editSession);
editSession.getMaxY(), editSession
);
visitor.visit(origin);
Operations.completeLegacy(visitor);
//FAWE end

View File

@ -77,7 +77,7 @@ public class QueryTool implements BlockTool {
}
builder.append(TextComponent.of(" (" + world.getBlockLightLevel(blockPoint) + "/"
+ world.getBlockLightLevel(blockPoint.add(0, 1, 0)) + ")", TextColor.WHITE)
+ world.getBlockLightLevel(blockPoint.add(0, 1, 0)) + ")", TextColor.WHITE)
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, Caption.of("worldedit.tool.info.light.hover"))));
player.print(builder.build());

View File

@ -235,6 +235,7 @@ public final class SuggestionHelper {
}
//FAWE start
/**
* Returns a stream of suggestions for booleans.
*