Use 'shape' instead of 'regionFactory' in user-facing ctx

This commit is contained in:
Kenzie Togami 2019-04-28 17:30:58 -07:00
parent 6255ccce38
commit 2580a0cf97
No known key found for this signature in database
GPG Key ID: 5D200B325E157A81
3 changed files with 14 additions and 14 deletions

View File

@ -56,7 +56,7 @@ import static org.enginehub.piston.part.CommandParts.arg;
@CommandContainer @CommandContainer
public class ApplyBrushCommands { public class ApplyBrushCommands {
private static final CommandArgument REGION_FACTORY = arg(TranslatableComponent.of("regionFactory"), TextComponent.of("The shape of the region")) private static final CommandArgument REGION_FACTORY = arg(TranslatableComponent.of("shape"), TextComponent.of("The shape of the region"))
.defaultsTo(ImmutableList.of()) .defaultsTo(ImmutableList.of())
.ofTypes(ImmutableList.of(Key.of(RegionFactory.class))) .ofTypes(ImmutableList.of(Key.of(RegionFactory.class)))
.build(); .build();

View File

@ -296,7 +296,7 @@ public class BrushCommands {
@CommandPermissions("worldedit.brush.deform") @CommandPermissions("worldedit.brush.deform")
public void deform(Player player, LocalSession localSession, public void deform(Player player, LocalSession localSession,
@Arg(desc = "The shape of the region") @Arg(desc = "The shape of the region")
RegionFactory regionFactory, RegionFactory shape,
@Arg(desc = "The size of the brush", def = "5") @Arg(desc = "The size of the brush", def = "5")
double radius, double radius,
@Arg(desc = "Expression to apply", def = "y-=0.2") @Arg(desc = "Expression to apply", def = "y-=0.2")
@ -313,7 +313,7 @@ public class BrushCommands {
deform.setOffset(localSession.getPlacementPosition(player).toVector3()); deform.setOffset(localSession.getPlacementPosition(player).toVector3());
} }
setOperationBasedBrush(player, localSession, radius, setOperationBasedBrush(player, localSession, radius,
deform, regionFactory, "worldedit.brush.deform"); deform, shape, "worldedit.brush.deform");
} }
@Command( @Command(
@ -323,13 +323,13 @@ public class BrushCommands {
@CommandPermissions("worldedit.brush.set") @CommandPermissions("worldedit.brush.set")
public void set(Player player, LocalSession localSession, public void set(Player player, LocalSession localSession,
@Arg(desc = "The shape of the region") @Arg(desc = "The shape of the region")
RegionFactory regionFactory, RegionFactory shape,
@Arg(desc = "The size of the brush", def = "5") @Arg(desc = "The size of the brush", def = "5")
double radius, double radius,
@Arg(desc = "The pattern of blocks to set") @Arg(desc = "The pattern of blocks to set")
Pattern pattern) throws WorldEditException { Pattern pattern) throws WorldEditException {
setOperationBasedBrush(player, localSession, radius, setOperationBasedBrush(player, localSession, radius,
new Apply(new ReplaceFactory(pattern)), regionFactory, "worldedit.brush.set"); new Apply(new ReplaceFactory(pattern)), shape, "worldedit.brush.set");
} }
@Command( @Command(
@ -339,7 +339,7 @@ public class BrushCommands {
@CommandPermissions("worldedit.brush.forest") @CommandPermissions("worldedit.brush.forest")
public void forest(Player player, LocalSession localSession, public void forest(Player player, LocalSession localSession,
@Arg(desc = "The shape of the region") @Arg(desc = "The shape of the region")
RegionFactory regionFactory, RegionFactory shape,
@Arg(desc = "The size of the brush", def = "5") @Arg(desc = "The size of the brush", def = "5")
double radius, double radius,
@Arg(desc = "The density of the brush", def = "20") @Arg(desc = "The density of the brush", def = "20")
@ -347,7 +347,7 @@ public class BrushCommands {
@Arg(desc = "The type of tree to use") @Arg(desc = "The type of tree to use")
TreeGenerator.TreeType type) throws WorldEditException { TreeGenerator.TreeType type) throws WorldEditException {
setOperationBasedBrush(player, localSession, radius, setOperationBasedBrush(player, localSession, radius,
new Paint(new TreeGeneratorFactory(type), density / 100), regionFactory, "worldedit.brush.forest"); new Paint(new TreeGeneratorFactory(type), density / 100), shape, "worldedit.brush.forest");
} }
@Command( @Command(
@ -357,11 +357,11 @@ public class BrushCommands {
@CommandPermissions("worldedit.brush.raise") @CommandPermissions("worldedit.brush.raise")
public void raise(Player player, LocalSession localSession, public void raise(Player player, LocalSession localSession,
@Arg(desc = "The shape of the region") @Arg(desc = "The shape of the region")
RegionFactory regionFactory, RegionFactory shape,
@Arg(desc = "The size of the brush", def = "5") @Arg(desc = "The size of the brush", def = "5")
double radius) throws WorldEditException { double radius) throws WorldEditException {
setOperationBasedBrush(player, localSession, radius, setOperationBasedBrush(player, localSession, radius,
new Deform("y-=1"), regionFactory, "worldedit.brush.raise"); new Deform("y-=1"), shape, "worldedit.brush.raise");
} }
@Command( @Command(
@ -371,22 +371,22 @@ public class BrushCommands {
@CommandPermissions("worldedit.brush.lower") @CommandPermissions("worldedit.brush.lower")
public void lower(Player player, LocalSession localSession, public void lower(Player player, LocalSession localSession,
@Arg(desc = "The shape of the region") @Arg(desc = "The shape of the region")
RegionFactory regionFactory, RegionFactory shape,
@Arg(desc = "The size of the brush", def = "5") @Arg(desc = "The size of the brush", def = "5")
double radius) throws WorldEditException { double radius) throws WorldEditException {
setOperationBasedBrush(player, localSession, radius, setOperationBasedBrush(player, localSession, radius,
new Deform("y+=1"), regionFactory, "worldedit.brush.lower"); new Deform("y+=1"), shape, "worldedit.brush.lower");
} }
static void setOperationBasedBrush(Player player, LocalSession session, double radius, static void setOperationBasedBrush(Player player, LocalSession session, double radius,
Contextual<? extends Operation> factory, Contextual<? extends Operation> factory,
RegionFactory regionFactory, RegionFactory shape,
String permission) throws WorldEditException { String permission) throws WorldEditException {
WorldEdit.getInstance().checkMaxBrushRadius(radius); WorldEdit.getInstance().checkMaxBrushRadius(radius);
BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType());
tool.setSize(radius); tool.setSize(radius);
tool.setFill(null); tool.setFill(null);
tool.setBrush(new OperationFactoryBrush(factory, regionFactory, session), permission); tool.setBrush(new OperationFactoryBrush(factory, shape, session), permission);
player.print("Set brush to " + factory); player.print("Set brush to " + factory);
} }

View File

@ -56,7 +56,7 @@ import static org.enginehub.piston.part.CommandParts.arg;
@CommandContainer @CommandContainer
public class PaintBrushCommands { public class PaintBrushCommands {
private static final CommandArgument REGION_FACTORY = arg(TranslatableComponent.of("regionFactory"), TextComponent.of("The shape of the region")) private static final CommandArgument REGION_FACTORY = arg(TranslatableComponent.of("shape"), TextComponent.of("The shape of the region"))
.defaultsTo(ImmutableList.of()) .defaultsTo(ImmutableList.of())
.ofTypes(ImmutableList.of(Key.of(RegionFactory.class))) .ofTypes(ImmutableList.of(Key.of(RegionFactory.class)))
.build(); .build();