3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-26 02: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.Caption;
import com.fastasyncworldedit.core.configuration.Settings; import com.fastasyncworldedit.core.configuration.Settings;
import com.fastasyncworldedit.core.extent.clipboard.MultiClipboardHolder; 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.IdMask;
import com.fastasyncworldedit.core.function.mask.SingleBlockTypeMask; 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.object.FaweLimit;
import com.fastasyncworldedit.core.util.MainUtil; import com.fastasyncworldedit.core.util.MainUtil;
import com.fastasyncworldedit.core.util.MathMan; import com.fastasyncworldedit.core.util.MathMan;
@ -179,7 +179,7 @@ public class BrushCommands {
Expression radius Expression radius
) throws WorldEditException { ) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
set(context, new BlendBall()).setSize(radius); set(context, new BlendBall(), "worldedit.brush.blendball").setSize(radius);
} }
@Command( @Command(
@ -201,7 +201,7 @@ public class BrushCommands {
int fillRec int fillRec
) throws WorldEditException { ) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); 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( @Command(
@ -223,7 +223,7 @@ public class BrushCommands {
int fillRec int fillRec
) throws WorldEditException { ) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); 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( @Command(
@ -241,7 +241,7 @@ public class BrushCommands {
boolean filled boolean filled
) throws WorldEditException { ) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); 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( @Command(
@ -265,7 +265,7 @@ public class BrushCommands {
boolean depthFirst boolean depthFirst
) throws WorldEditException { ) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); 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)); .setMask(new IdMask(editSession));
} }
@ -288,7 +288,7 @@ public class BrushCommands {
boolean flat boolean flat
) throws WorldEditException { ) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); 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( @Command(
@ -316,7 +316,7 @@ public class BrushCommands {
throws WorldEditException { throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
player.print(Caption.of("fawe.worldedit.brush.brush.spline", (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( @Command(
@ -337,7 +337,7 @@ public class BrushCommands {
int copies int copies
) throws WorldEditException { ) throws WorldEditException {
player.print(Caption.of("fawe.worldedit.brush.brush.spline")); player.print(Caption.of("fawe.worldedit.brush.brush.spline"));
set(context, new SweepBrush(copies)); set(context, new SweepBrush(copies), "worldedit.brush.sweep");
} }
@Command( @Command(
@ -367,7 +367,7 @@ public class BrushCommands {
boolean facingDirection boolean facingDirection
) throws WorldEditException { ) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); 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); .setSize(radius).setFill(fill);
} }
@ -399,7 +399,7 @@ public class BrushCommands {
) throws WorldEditException { ) throws WorldEditException {
player.print(Caption.of("fawe.worldedit.brush.brush.spline", (radius))); player.print(Caption.of("fawe.worldedit.brush.brush.spline", (radius)));
worldEdit.checkMaxBrushRadius(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); .setFill(fill);
} }
@ -426,7 +426,7 @@ public class BrushCommands {
worldEdit.checkMaxBrushRadius(max); worldEdit.checkMaxBrushRadius(max);
Brush brush = Brush brush =
new BlobBrush(radius.divide(max), frequency / 100, amplitude / 100, sphericity / 100); 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( @Command(
@ -447,7 +447,7 @@ public class BrushCommands {
int count int count
) throws WorldEditException { ) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); 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)); .setMask(new ExistingBlockMask(editSession));
} }
@ -493,7 +493,7 @@ public class BrushCommands {
if (randomRotate) { if (randomRotate) {
brush.setRandomRotate(true); brush.setRandomRotate(true);
} }
set(context, brush).setSize(radius).setFill(fill); set(context, brush, "worldedit.brush.stencil").setSize(radius).setFill(fill);
} }
@Command(name = "image", @Command(name = "image",
@ -525,7 +525,7 @@ public class BrushCommands {
alpha = true; alpha = true;
} }
ImageBrush brush = new ImageBrush(image, session, alpha); ImageBrush brush = new ImageBrush(image, session, alpha);
set(context, brush).setSize(radius); set(context, brush, "worldedit.brush.image").setSize(radius);
} }
@Command( @Command(
@ -543,7 +543,7 @@ public class BrushCommands {
Expression radius Expression radius
) throws WorldEditException { ) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
set(context, new SurfaceSphereBrush()).setFill(fill).setSize(radius); set(context, new SurfaceSphereBrush(), "worldedit.brush.surface").setFill(fill).setSize(radius);
} }
@Command( @Command(
@ -574,7 +574,7 @@ public class BrushCommands {
} else { } else {
brush = new ScatterBrush((int) points, (int) distance); 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( @Command(
@ -615,7 +615,8 @@ public class BrushCommands {
return; 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) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@ -640,7 +641,7 @@ public class BrushCommands {
) )
throws WorldEditException { throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); 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( @Command(
@ -667,7 +668,7 @@ public class BrushCommands {
boolean solid boolean solid
) throws WorldEditException { ) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); 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); .setFill(fill);
} }
@ -699,7 +700,8 @@ public class BrushCommands {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
set( set(
context, context,
new ScatterCommand((int) points, (int) distance, StringMan.join(commandStr, " ")) new ScatterCommand((int) points, (int) distance, StringMan.join(commandStr, " ")),
"worldedit.brush.scattercommand"
) )
.setSize(radius); .setSize(radius);
} }
@ -848,7 +850,7 @@ public class BrushCommands {
if (randomRotate) { if (randomRotate) {
brush.setRandomRotate(true); brush.setRandomRotate(true);
} }
set(context, brush).setSize(radius); set(context, brush, "worldedit.brush.height").setSize(radius);
} }
private InputStream getHeightmapStream(String filename) throws FileNotFoundException { private InputStream getHeightmapStream(String filename) throws FileNotFoundException {
@ -892,7 +894,7 @@ public class BrushCommands {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
player.print(Caption.of("fawe.worldedit.brush.brush.copy", (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( @Command(
@ -913,7 +915,7 @@ public class BrushCommands {
) throws WorldEditException { ) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
String cmd = StringMan.join(input, " "); String cmd = StringMan.join(input, " ");
set(context, new CommandBrush(cmd)).setSize(radius); set(context, new CommandBrush(cmd), "worldedit.brush.command").setSize(radius);
} }
@Command( @Command(
@ -1202,7 +1204,7 @@ public class BrushCommands {
} }
//FAWE end //FAWE end
set(context, brush).setSize(radius).setFill(pattern); set(context, brush, "worldedit.brush.sphere").setSize(radius).setFill(pattern);
} }
@Command( @Command(
@ -1233,10 +1235,10 @@ public class BrushCommands {
BrushSettings settings; BrushSettings settings;
if (hollow) { if (hollow) {
//FAWE start - hcyl thickness //FAWE start - hcyl thickness
settings = set(context, new HollowCylinderBrush(height, thickness)); settings = set(context, new HollowCylinderBrush(height, thickness), "worldedit.brush.cylinder");
//FAWE end //FAWE end
} else { } else {
settings = set(context, new CylinderBrush(height)); settings = set(context, new CylinderBrush(height), "worldedit.brush.cylinder");
} }
settings.setSize(radius).setFill(pattern); settings.setSize(radius).setFill(pattern);
} }
@ -1281,7 +1283,8 @@ public class BrushCommands {
context, context,
new ClipboardBrush(newHolder, ignoreAir, usingOrigin, pasteEntities, pasteBiomes, new ClipboardBrush(newHolder, ignoreAir, usingOrigin, pasteEntities, pasteBiomes,
sourceMask sourceMask
) ),
"worldedit.brush.clipboard"
); );
} }
@ -1310,7 +1313,7 @@ public class BrushCommands {
iterations = Math.min(limit.MAX_ITERATIONS, iterations); iterations = Math.min(limit.MAX_ITERATIONS, iterations);
//FAWE end //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( player.print(Caption.of(
"worldedit.brush.smooth.equip", "worldedit.brush.smooth.equip",
radius, radius,
@ -1345,7 +1348,7 @@ public class BrushCommands {
iterations = Math.min(limit.MAX_ITERATIONS, iterations); iterations = Math.min(limit.MAX_ITERATIONS, iterations);
//FAWE end //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( player.print(Caption.of(
"worldedit.brush.smooth.equip", "worldedit.brush.smooth.equip",
radius, radius,
@ -1367,7 +1370,7 @@ public class BrushCommands {
) throws WorldEditException { ) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); 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)); .setMask(new SingleBlockTypeMask(editSession, BlockTypes.FIRE));
} }
@ -1386,7 +1389,7 @@ public class BrushCommands {
) throws WorldEditException { ) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
set(context, new GravityBrush(fromMaxY)).setSize(radius); set(context, new GravityBrush(fromMaxY), "worldedit.brush.gravity").setSize(radius);
} }
@Command( @Command(
@ -1434,7 +1437,7 @@ public class BrushCommands {
flags.or(CreatureButcher.Flags.ARMOR_STAND, killArmorStands, "worldedit.butcher.armorstands"); flags.or(CreatureButcher.Flags.ARMOR_STAND, killArmorStands, "worldedit.butcher.armorstands");
flags.or(CreatureButcher.Flags.WATER, killWater, "worldedit.butcher.water"); 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 //FAWE start
@ -1454,7 +1457,7 @@ public class BrushCommands {
return settings; return settings;
} }
public BrushSettings set(InjectedValueAccess context, Brush brush) public BrushSettings set(InjectedValueAccess context, Brush brush, String permission)
throws InvalidToolBindException { throws InvalidToolBindException {
Player player = context.injectedValue(Key.of(Player.class)) Player player = context.injectedValue(Key.of(Player.class))
.orElseThrow(() -> new IllegalStateException("No player")); .orElseThrow(() -> new IllegalStateException("No player"));
@ -1475,11 +1478,7 @@ public class BrushCommands {
String args = arguments.get(); String args = arguments.get();
bs.addSetting(BrushSettings.SettingType.BRUSH, args.substring(args.indexOf(' ') + 1)); bs.addSetting(BrushSettings.SettingType.BRUSH, args.substring(args.indexOf(' ') + 1));
} }
CommandPermissions perms = bs.addPermission(permission);
context.injectedValue(Key.of(CommandPermissions.class)).orElse(null);
if (perms != null) {
bs.addPermissions(perms.value());
}
bs.setBrush(brush); bs.setBrush(brush);
return process(player, arguments, bs); return process(player, arguments, bs);
} }