3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-13 22:50:06 +01:00
Dieser Commit ist enthalten in:
dordsor21 2021-09-17 17:12:14 +01:00
Ursprung 07be1c6a44
Commit 90aeb48040
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B

Datei anzeigen

@ -50,10 +50,10 @@ import com.fastasyncworldedit.core.command.tool.sweep.SweepBrush;
import com.fastasyncworldedit.core.configuration.Caption;
import com.fastasyncworldedit.core.configuration.Settings;
import com.fastasyncworldedit.core.extent.clipboard.MultiClipboardHolder;
import com.fastasyncworldedit.core.math.heightmap.ScalableHeightMap;
import com.fastasyncworldedit.core.math.heightmap.ScalableHeightMap.Shape;
import com.fastasyncworldedit.core.function.mask.IdMask;
import com.fastasyncworldedit.core.function.mask.SingleBlockTypeMask;
import com.fastasyncworldedit.core.math.heightmap.ScalableHeightMap;
import com.fastasyncworldedit.core.math.heightmap.ScalableHeightMap.Shape;
import com.fastasyncworldedit.core.object.FaweLimit;
import com.fastasyncworldedit.core.util.MainUtil;
import com.fastasyncworldedit.core.util.MathMan;
@ -179,7 +179,7 @@ public class BrushCommands {
Expression radius
) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
set(context, new BlendBall()).setSize(radius);
set(context, new BlendBall(), "worldedit.brush.blendball").setSize(radius);
}
@Command(
@ -201,7 +201,7 @@ public class BrushCommands {
int fillRec
) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
set(context, new ErodeBrush(erodefaces, erodeRec, fillFaces, fillRec)).setSize(radius);
set(context, new ErodeBrush(erodefaces, erodeRec, fillFaces, fillRec), "worldedit.brush.erode").setSize(radius);
}
@Command(
@ -223,7 +223,7 @@ public class BrushCommands {
int fillRec
) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
set(context, new RaiseBrush(erodefaces, erodeRec, fillFaces, fillRec)).setSize(radius);
set(context, new RaiseBrush(erodefaces, erodeRec, fillFaces, fillRec), "worldedit.brush.pull").setSize(radius);
}
@Command(
@ -241,7 +241,7 @@ public class BrushCommands {
boolean filled
) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
set(context, new CircleBrush(filled)).setSize(radius).setFill(fill);
set(context, new CircleBrush(filled), "worldedit.brush.sphere").setSize(radius).setFill(fill);
}
@Command(
@ -265,7 +265,7 @@ public class BrushCommands {
boolean depthFirst
) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
set(context, new RecurseBrush(depthFirst)).setSize(radius).setFill(fill)
set(context, new RecurseBrush(depthFirst), "worldedit.brush.recursive").setSize(radius).setFill(fill)
.setMask(new IdMask(editSession));
}
@ -288,7 +288,7 @@ public class BrushCommands {
boolean flat
) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
set(context, new LineBrush(shell, select, flat)).setSize(radius).setFill(fill);
set(context, new LineBrush(shell, select, flat), "worldedit.brush.line").setSize(radius).setFill(fill);
}
@Command(
@ -316,7 +316,7 @@ public class BrushCommands {
throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
player.print(Caption.of("fawe.worldedit.brush.brush.spline", (radius)));
set(context, new SplineBrush(player)).setSize(radius).setFill(fill);
set(context, new SplineBrush(player), "worldedit.brush.spline").setSize(radius).setFill(fill);
}
@Command(
@ -337,7 +337,7 @@ public class BrushCommands {
int copies
) throws WorldEditException {
player.print(Caption.of("fawe.worldedit.brush.brush.spline"));
set(context, new SweepBrush(copies));
set(context, new SweepBrush(copies), "worldedit.brush.sweep");
}
@Command(
@ -367,7 +367,7 @@ public class BrushCommands {
boolean facingDirection
) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
set(context, new CatenaryBrush(shell, select, facingDirection, lengthFactor))
set(context, new CatenaryBrush(shell, select, facingDirection, lengthFactor), "worldedit.brush.spline")
.setSize(radius).setFill(fill);
}
@ -399,7 +399,7 @@ public class BrushCommands {
) throws WorldEditException {
player.print(Caption.of("fawe.worldedit.brush.brush.spline", (radius)));
worldEdit.checkMaxBrushRadius(radius);
set(context, new SurfaceSpline(tension, bias, continuity, quality)).setSize(radius)
set(context, new SurfaceSpline(tension, bias, continuity, quality), "surfacespline").setSize(radius)
.setFill(fill);
}
@ -426,7 +426,7 @@ public class BrushCommands {
worldEdit.checkMaxBrushRadius(max);
Brush brush =
new BlobBrush(radius.divide(max), frequency / 100, amplitude / 100, sphericity / 100);
set(context, brush).setSize(max).setFill(fill);
set(context, brush, "worldedit.brush.rock").setSize(max).setFill(fill);
}
@Command(
@ -447,7 +447,7 @@ public class BrushCommands {
int count
) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
set(context, new ShatterBrush(count)).setSize(radius).setFill(fill)
set(context, new ShatterBrush(count), "worldedit.brush.shatter").setSize(radius).setFill(fill)
.setMask(new ExistingBlockMask(editSession));
}
@ -493,7 +493,7 @@ public class BrushCommands {
if (randomRotate) {
brush.setRandomRotate(true);
}
set(context, brush).setSize(radius).setFill(fill);
set(context, brush, "worldedit.brush.stencil").setSize(radius).setFill(fill);
}
@Command(name = "image",
@ -525,7 +525,7 @@ public class BrushCommands {
alpha = true;
}
ImageBrush brush = new ImageBrush(image, session, alpha);
set(context, brush).setSize(radius);
set(context, brush, "worldedit.brush.image").setSize(radius);
}
@Command(
@ -543,7 +543,7 @@ public class BrushCommands {
Expression radius
) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
set(context, new SurfaceSphereBrush()).setFill(fill).setSize(radius);
set(context, new SurfaceSphereBrush(), "worldedit.brush.surface").setFill(fill).setSize(radius);
}
@Command(
@ -574,7 +574,7 @@ public class BrushCommands {
} else {
brush = new ScatterBrush((int) points, (int) distance);
}
set(context, brush).setSize(radius).setFill(fill);
set(context, brush, "worldedit.brush.scatter").setSize(radius).setFill(fill);
}
@Command(
@ -615,7 +615,8 @@ public class BrushCommands {
return;
}
set(context, new PopulateSchem(mask, holders, (int) density, rotate)).setSize(radius);
set(context, new PopulateSchem(mask, holders, (int) density, rotate), "worldedit.brush.populateschematic").setSize(
radius);
} catch (IOException e) {
throw new RuntimeException(e);
}
@ -640,7 +641,7 @@ public class BrushCommands {
)
throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
set(context, new LayerBrush(patternLayers.toArray(new Pattern[0]))).setSize(radius);
set(context, new LayerBrush(patternLayers.toArray(new Pattern[0])), "worldedit.brush.layer").setSize(radius);
}
@Command(
@ -667,7 +668,7 @@ public class BrushCommands {
boolean solid
) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
set(context, new SplatterBrush((int) points, (int) recursion, solid)).setSize(radius)
set(context, new SplatterBrush((int) points, (int) recursion, solid), "worldedit.brush.splatter").setSize(radius)
.setFill(fill);
}
@ -699,7 +700,8 @@ public class BrushCommands {
worldEdit.checkMaxBrushRadius(radius);
set(
context,
new ScatterCommand((int) points, (int) distance, StringMan.join(commandStr, " "))
new ScatterCommand((int) points, (int) distance, StringMan.join(commandStr, " ")),
"worldedit.brush.scattercommand"
)
.setSize(radius);
}
@ -848,7 +850,7 @@ public class BrushCommands {
if (randomRotate) {
brush.setRandomRotate(true);
}
set(context, brush).setSize(radius);
set(context, brush, "worldedit.brush.height").setSize(radius);
}
private InputStream getHeightmapStream(String filename) throws FileNotFoundException {
@ -892,7 +894,7 @@ public class BrushCommands {
worldEdit.checkMaxBrushRadius(radius);
player.print(Caption.of("fawe.worldedit.brush.brush.copy", (radius)));
set(context, new CopyPastaBrush(player, session, randomRotate, autoRotate)).setSize(radius);
set(context, new CopyPastaBrush(player, session, randomRotate, autoRotate), "worldedit.brush.copy").setSize(radius);
}
@Command(
@ -913,7 +915,7 @@ public class BrushCommands {
) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
String cmd = StringMan.join(input, " ");
set(context, new CommandBrush(cmd)).setSize(radius);
set(context, new CommandBrush(cmd), "worldedit.brush.command").setSize(radius);
}
@Command(
@ -1202,7 +1204,7 @@ public class BrushCommands {
}
//FAWE end
set(context, brush).setSize(radius).setFill(pattern);
set(context, brush, "worldedit.brush.sphere").setSize(radius).setFill(pattern);
}
@Command(
@ -1233,10 +1235,10 @@ public class BrushCommands {
BrushSettings settings;
if (hollow) {
//FAWE start - hcyl thickness
settings = set(context, new HollowCylinderBrush(height, thickness));
settings = set(context, new HollowCylinderBrush(height, thickness), "worldedit.brush.cylinder");
//FAWE end
} else {
settings = set(context, new CylinderBrush(height));
settings = set(context, new CylinderBrush(height), "worldedit.brush.cylinder");
}
settings.setSize(radius).setFill(pattern);
}
@ -1281,7 +1283,8 @@ public class BrushCommands {
context,
new ClipboardBrush(newHolder, ignoreAir, usingOrigin, pasteEntities, pasteBiomes,
sourceMask
)
),
"worldedit.brush.clipboard"
);
}
@ -1310,7 +1313,7 @@ public class BrushCommands {
iterations = Math.min(limit.MAX_ITERATIONS, iterations);
//FAWE end
set(context, new SmoothBrush(iterations, mask)).setSize(radius);
set(context, new SmoothBrush(iterations, mask), "worldedit.brush.smooth").setSize(radius);
player.print(Caption.of(
"worldedit.brush.smooth.equip",
radius,
@ -1345,7 +1348,7 @@ public class BrushCommands {
iterations = Math.min(limit.MAX_ITERATIONS, iterations);
//FAWE end
set(context, new SnowSmoothBrush(iterations, mask)).setSize(radius);
set(context, new SnowSmoothBrush(iterations, mask), "worldedit.brush.snowsmooth").setSize(radius);
player.print(Caption.of(
"worldedit.brush.smooth.equip",
radius,
@ -1367,7 +1370,7 @@ public class BrushCommands {
) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
set(context, new SphereBrush()).setSize(radius).setFill(BlockTypes.AIR.getDefaultState())
set(context, new SphereBrush(), "worldedit.brush.ex").setSize(radius).setFill(BlockTypes.AIR.getDefaultState())
.setMask(new SingleBlockTypeMask(editSession, BlockTypes.FIRE));
}
@ -1386,7 +1389,7 @@ public class BrushCommands {
) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
set(context, new GravityBrush(fromMaxY)).setSize(radius);
set(context, new GravityBrush(fromMaxY), "worldedit.brush.gravity").setSize(radius);
}
@Command(
@ -1434,7 +1437,7 @@ public class BrushCommands {
flags.or(CreatureButcher.Flags.ARMOR_STAND, killArmorStands, "worldedit.butcher.armorstands");
flags.or(CreatureButcher.Flags.WATER, killWater, "worldedit.butcher.water");
set(context, new ButcherBrush(flags)).setSize(radius);
set(context, new ButcherBrush(flags), "worldedit.brush.butcher").setSize(radius);
}
//FAWE start
@ -1454,7 +1457,7 @@ public class BrushCommands {
return settings;
}
public BrushSettings set(InjectedValueAccess context, Brush brush)
public BrushSettings set(InjectedValueAccess context, Brush brush, String permission)
throws InvalidToolBindException {
Player player = context.injectedValue(Key.of(Player.class))
.orElseThrow(() -> new IllegalStateException("No player"));
@ -1475,11 +1478,7 @@ public class BrushCommands {
String args = arguments.get();
bs.addSetting(BrushSettings.SettingType.BRUSH, args.substring(args.indexOf(' ') + 1));
}
CommandPermissions perms =
context.injectedValue(Key.of(CommandPermissions.class)).orElse(null);
if (perms != null) {
bs.addPermissions(perms.value());
}
bs.addPermission(permission);
bs.setBrush(brush);
return process(player, arguments, bs);
}