From 4db192c9b8d81e92c436eb60331bb5bddc465f67 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Sat, 17 Aug 2019 18:50:06 -0400 Subject: [PATCH 01/24] fixes and brush command tweaks --- .../worldedit/command/BrushCommands.java | 153 ++++++++---------- worldedit-libs/build.gradle | 16 +- 2 files changed, 79 insertions(+), 90 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java index 92a8a0e60..61b19247e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java @@ -53,6 +53,7 @@ import com.boydti.fawe.object.brush.StencilBrush; import com.boydti.fawe.object.brush.SurfaceSphereBrush; import com.boydti.fawe.object.brush.SurfaceSpline; import com.boydti.fawe.object.brush.heightmap.ScalableHeightMap; +import com.boydti.fawe.object.brush.heightmap.ScalableHeightMap.Shape; import com.boydti.fawe.object.brush.sweep.SweepBrush; import com.boydti.fawe.object.clipboard.MultiClipboardHolder; import com.boydti.fawe.object.mask.IdMask; @@ -152,11 +153,11 @@ public class BrushCommands { "Pic: https://i.imgur.com/cNUQUkj.png -> https://i.imgur.com/hFOFsNf.png" ) @CommandPermissions("worldedit.brush.blendball") - public BrushSettings blendBallBrush(Player player, LocalSession session, + public void blendBallBrush(Player player, LocalSession session, @Arg(desc = "The radius to sample for blending", def = "5") Expression radius, InjectedValueAccess context) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); - return set(session, context, new BlendBall()).setSize(radius); + set(session, context, new BlendBall()).setSize(radius); } @Command( @@ -164,11 +165,11 @@ public class BrushCommands { desc = "Erodes terrain" ) @CommandPermissions("worldedit.brush.erode") - public BrushSettings erodeBrush(Player player, LocalSession session, + public void erodeBrush(Player player, LocalSession session, @Arg(desc = "The radius for eroding", def = "5") Expression radius, InjectedValueAccess context) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); - return set(session, context, new ErodeBrush()).setSize(radius); + set(session, context, new ErodeBrush()).setSize(radius); } @Command( @@ -176,11 +177,11 @@ public class BrushCommands { desc = "Pull terrain towards you" ) @CommandPermissions("worldedit.brush.pull") - public BrushSettings pullBrush(Player player, LocalSession session, + public void pullBrush(Player player, LocalSession session, @Arg(desc = "The radius to sample for blending", def = "5") Expression radius, InjectedValueAccess context) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); - return set(session, context, new RaiseBrush()).setSize(radius); + set(session, context, new RaiseBrush()).setSize(radius); } @Command( @@ -188,11 +189,11 @@ public class BrushCommands { desc = "Creates a circle which revolves around your facing direction" ) @CommandPermissions("worldedit.brush.sphere") - public BrushSettings circleBrush(Player player, EditSession editSession, LocalSession session, Pattern fill, + public void circleBrush(Player player, EditSession editSession, LocalSession session, Pattern fill, @Arg(desc = "The radius to sample for blending", def = "5") Expression radius, InjectedValueAccess context) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); - return set(session, context, new CircleBrush(player)).setSize(radius).setFill(fill); + set(session, context, new CircleBrush(player)).setSize(radius).setFill(fill); } @Command( @@ -203,18 +204,15 @@ public class BrushCommands { "Note: Set a mask to recurse along specific blocks" ) @CommandPermissions("worldedit.brush.recursive") - public BrushSettings recursiveBrush(Player player, LocalSession session, EditSession editSession, Pattern fill, + public void recursiveBrush(Player player, LocalSession session, EditSession editSession, Pattern fill, @Arg(desc = "The radius to sample for blending", def = "5") Expression radius, @Switch(name = 'd', desc = "Apply in depth first order") boolean depthFirst, InjectedValueAccess context) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); - return set(session, context, - new RecurseBrush(depthFirst)) - .setSize(radius) - .setFill(fill) - .setMask(new IdMask(editSession)); + set(session, context, new RecurseBrush(depthFirst)) + .setSize(radius).setFill(fill).setMask(new IdMask(editSession)); } @Command( @@ -223,7 +221,7 @@ public class BrushCommands { desc = "Create lines" ) @CommandPermissions("worldedit.brush.line") - public BrushSettings lineBrush(Player player, LocalSession session, Pattern fill, + public void lineBrush(Player player, LocalSession session, Pattern fill, @Arg(desc = "The radius to sample for blending", def = "0") Expression radius, @Switch(name = 'h', desc = "Create only a shell") @@ -233,10 +231,7 @@ public class BrushCommands { @Switch(name = 'f', desc = "Create a flat line") boolean flat, InjectedValueAccess context) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); - return set(session, context, - new LineBrush(shell, select, flat)) - .setSize(radius) - .setFill(fill); + set(session, context, new LineBrush(shell, select, flat)).setSize(radius).setFill(fill); } @Command( @@ -250,12 +245,12 @@ public class BrushCommands { "Tutorial: https://www.planetminecraft.com/blog/fawe-tutorial/" ) @CommandPermissions("worldedit.brush.spline") - public BrushSettings splineBrush(Player player, EditSession editSession, LocalSession session, Pattern fill, + public void splineBrush(Player player, EditSession editSession, LocalSession session, Pattern fill, @Arg(desc = "The radius to sample for blending", def = "25") Expression radius, InjectedValueAccess context) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); player.print(BBC.BRUSH_SPLINE.format(radius)); - return set(session, context, + set(session, context, new SplineBrush(player, session)) .setSize(radius) .setFill(fill); @@ -270,9 +265,9 @@ public class BrushCommands { "Set [copies] to a value > 0 if you want to have your selection pasted a limited amount of times equally spaced on the curve" ) @CommandPermissions("worldedit.brush.sweep") - public BrushSettings sweepBrush(Player player, LocalSession session, @Arg(name = "copies", desc = "int", def = "-1") int copies, InjectedValueAccess context) throws WorldEditException { + public void sweepBrush(Player player, LocalSession session, @Arg(name = "copies", desc = "int", def = "-1") int copies, InjectedValueAccess context) throws WorldEditException { player.print(BBC.BRUSH_SPLINE.s()); - return set(session, context, new SweepBrush(copies)); + set(session, context, new SweepBrush(copies)); } @Command( @@ -281,7 +276,7 @@ public class BrushCommands { desc = "Create a hanging line between two points" ) @CommandPermissions("worldedit.brush.spline") - public BrushSettings catenaryBrush(LocalSession session, Pattern fill, @Arg(def = "1.2", desc = "Length of wire compared to distance between points") @Range(min = 1) double lengthFactor, + public void catenaryBrush(LocalSession session, Pattern fill, @Arg(def = "1.2", desc = "Length of wire compared to distance between points") @Range(min = 1) double lengthFactor, @Arg(desc = "The radius to sample for blending", def = "0") Expression radius, @Switch(name = 'h', desc = "Create only a shell") @@ -293,7 +288,7 @@ public class BrushCommands { InjectedValueAccess context) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); Brush brush = new CatenaryBrush(shell, select, facingDirection, lengthFactor); - return set(session, context, + set(session, context, new CatenaryBrush(shell, select, facingDirection, lengthFactor)) .setSize(radius) .setFill(fill); @@ -307,12 +302,12 @@ public class BrushCommands { "Video: https://www.youtube.com/watch?v=zSN-2jJxXlM" ) @CommandPermissions("worldedit.brush.surfacespline") // 0, 0, 0, 10, 0, - public BrushSettings surfaceSpline(Player player, LocalSession session, Pattern fill, + public void surfaceSpline(Player player, LocalSession session, Pattern fill, @Arg(desc = "The radius to sample for blending", def = "0") Expression radius, @Arg(name = "tension", desc = "double", def = "0") double tension, @Arg(name = "bias", desc = "double", def = "0") double bias, @Arg(name = "continuity", desc = "double", def = "0") double continuity, @Arg(name = "quality", desc = "double", def = "10") double quality, InjectedValueAccess context) throws WorldEditException { player.print(BBC.BRUSH_SPLINE.format(radius)); worldEdit.checkMaxBrushRadius(radius); - return set(session, context, + set(session, context, new SurfaceSpline(tension, bias, continuity, quality)) .setSize(radius) .setFill(fill); @@ -324,14 +319,11 @@ public class BrushCommands { desc = "Creates a distorted sphere" ) @CommandPermissions("worldedit.brush.rock") - public BrushSettings blobBrush(LocalSession session, Pattern fill, @Arg(name = "radius", desc = "Vector3", def = "10") Vector3 radius, @Arg(name = "sphericity", desc = "double", def = "100") double sphericity, @Arg(name = "frequency", desc = "double", def = "30") double frequency, @Arg(name = "amplitude", desc = "double", def = "50") double amplitude, InjectedValueAccess context) throws WorldEditException { + public void blobBrush(LocalSession session, Pattern fill, @Arg(name = "radius", desc = "Vector3", def = "10") Vector3 radius, @Arg(name = "sphericity", desc = "double", def = "100") double sphericity, @Arg(name = "frequency", desc = "double", def = "30") double frequency, @Arg(name = "amplitude", desc = "double", def = "50") double amplitude, InjectedValueAccess context) throws WorldEditException { double max = MathMan.max(radius.getX(), radius.getY(), radius.getZ()); worldEdit.checkMaxBrushRadius(max); Brush brush = new BlobBrush(radius.divide(max), frequency / 100, amplitude / 100, sphericity / 100); - return set(session, context, - brush) - .setSize(max) - .setFill(fill); + set(session, context, brush).setSize(max).setFill(fill); } @Command( @@ -340,7 +332,7 @@ public class BrushCommands { desc = "Choose the sphere brush" ) @CommandPermissions("worldedit.brush.sphere") - public BrushSettings sphereBrush(Player player, LocalSession session, + public void sphereBrush(Player player, LocalSession session, @Arg(desc = "The pattern of blocks to set") Pattern pattern, @Arg(desc = "The radius of the sphere", def = "2") @@ -370,7 +362,7 @@ public class BrushCommands { } } - return set(session, context, + set(session, context, brush) .setSize(radius) .setFill(pattern); @@ -384,12 +376,12 @@ public class BrushCommands { "Pic: https://i.imgur.com/2xKsZf2.png" ) @CommandPermissions("worldedit.brush.shatter") - public BrushSettings shatterBrush(Player player, EditSession editSession, LocalSession session, Pattern fill, + public void shatterBrush(Player player, EditSession editSession, LocalSession session, Pattern fill, @Arg(desc = "The radius to sample for blending", def = "10") Expression radius, @Arg(desc = "Lines", def = "10") int count, InjectedValueAccess context) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); - return set(session, context, + set(session, context, new ShatterBrush(count)) .setSize(radius) .setFill(fill) @@ -402,7 +394,7 @@ public class BrushCommands { descFooter = "Use a height map to paint any surface.\n" ) @CommandPermissions("worldedit.brush.stencil") - public BrushSettings stencilBrush(Player player, LocalSession session, Pattern fill, + public void stencilBrush(Player player, LocalSession session, Pattern fill, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") String image, @Arg(def = "0", desc = "rotation") @Range(min = 0, max = 360) int rotation, @@ -421,7 +413,7 @@ public class BrushCommands { if (randomRotate) { brush.setRandomRotate(true); } - return set(session, context, + set(session, context, brush) .setSize(radius) .setFill(fill); @@ -433,7 +425,7 @@ public class BrushCommands { desc = "Use a height map to paint a surface", descFooter = "Use a height map to paint any surface.\n") @CommandPermissions("worldedit.brush.stencil") - public BrushSettings imageBrush(LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, + public void imageBrush(LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, ProvideBindings.ImageUri imageUri, @Arg(def = "1", desc = "scale height") @Range(min = Double.MIN_NORMAL) double yscale, @Switch(name = 'a', desc = "Use image Alpha") boolean alpha, @@ -450,7 +442,7 @@ public class BrushCommands { alpha = true; } ImageBrush brush = new ImageBrush(image, session, alpha); - return set(session, context, + set(session, context, brush) .setSize(radius); } @@ -464,12 +456,12 @@ public class BrushCommands { "The -r flag will apply random rotation" ) @CommandPermissions("worldedit.brush.surface") - public BrushSettings surfaceBrush(LocalSession session, Pattern fill, + public void surfaceBrush(LocalSession session, Pattern fill, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, InjectedValueAccess context) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); - return set(session, context, new SurfaceSphereBrush()).setFill(fill).setSize(radius); + set(session, context, new SurfaceSphereBrush()).setFill(fill).setSize(radius); } @Command( @@ -479,7 +471,7 @@ public class BrushCommands { "Video: https://youtu.be/RPZIaTbqoZw?t=34s" ) @CommandPermissions("worldedit.brush.scatter") - public BrushSettings scatterBrush(LocalSession session, Pattern fill, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "points", desc = "double", def = "5") double pointsOpt, @Arg(name = "distance", desc = "double", def = "1") double distanceOpt, @Switch(name = 'o', desc = "Overlay the block") boolean overlay, InjectedValueAccess context) throws WorldEditException { + public void scatterBrush(LocalSession session, Pattern fill, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "points", desc = "double", def = "5") double pointsOpt, @Arg(name = "distance", desc = "double", def = "1") double distanceOpt, @Switch(name = 'o', desc = "Overlay the block") boolean overlay, InjectedValueAccess context) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); Brush brush; if (overlay) { @@ -487,7 +479,7 @@ public class BrushCommands { } else { brush = new ScatterBrush((int) pointsOpt, (int) distanceOpt); } - return set(session, context, + set(session, context, brush) .setSize(radius) .setFill(fill); @@ -499,21 +491,21 @@ public class BrushCommands { desc = "Scatter a schematic on a surface" ) @CommandPermissions("worldedit.brush.populateschematic") - public BrushSettings scatterSchemBrush(Player player, LocalSession session, Mask mask, @Arg(name = "clipboard", desc = "Clipboard uri") String clipboardStr, @Arg(name = "radius", desc = "Expression", def = "30") Expression radius, @Arg(name = "density", desc = "double", def = "50") double density, @Switch(name = 'r', desc = "Apply random rotation") boolean rotate, InjectedValueAccess context) throws WorldEditException { + public void scatterSchemBrush(Player player, LocalSession session, Mask mask, @Arg(name = "clipboard", desc = "Clipboard uri") String clipboardStr, @Arg(name = "radius", desc = "Expression", def = "30") Expression radius, @Arg(name = "density", desc = "double", def = "50") double density, @Switch(name = 'r', desc = "Apply random rotation") boolean rotate, InjectedValueAccess context) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); try { MultiClipboardHolder clipboards = ClipboardFormats.loadAllFromInput(player, clipboardStr, null, true); if (clipboards == null) { BBC.SCHEMATIC_NOT_FOUND.send(player, clipboardStr); - return null; + return; } List holders = clipboards.getHolders(); if (holders == null) { BBC.SCHEMATIC_NOT_FOUND.send(player, clipboardStr); - return null; + return; } - return set(session, context, + set(session, context, new PopulateSchem(mask, holders, (int) density, rotate)).setSize(radius); } catch (IOException e) { throw new RuntimeException(e); @@ -528,9 +520,9 @@ public class BrushCommands { "Pic: https://i.imgur.com/XV0vYoX.png" ) @CommandPermissions("worldedit.brush.layer") - public BrushSettings surfaceLayer(LocalSession session, @Arg(name = "radius", desc = "Expression") Expression radius, List blockLayers, InjectedValueAccess context) throws WorldEditException { + public void surfaceLayer(LocalSession session, @Arg(name = "radius", desc = "Expression") Expression radius, List blockLayers, InjectedValueAccess context) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); - return set(session, context, new LayerBrush(blockLayers.toArray(new BlockState[0]))).setSize(radius); + set(session, context, new LayerBrush(blockLayers.toArray(new BlockState[0]))).setSize(radius); } @Command( @@ -542,9 +534,9 @@ public class BrushCommands { "Note: The seeds define how many splotches there are, recursion defines how large, solid defines whether the pattern is applied per seed, else per block." ) @CommandPermissions("worldedit.brush.splatter") - public BrushSettings splatterBrush(LocalSession session, Pattern fill, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "points", desc = "double", def = "1") double pointsOpt, @Arg(name = "recursion", desc = "double", def = "5") double recursion, @Arg(name = "solid", desc = "boolean", def = "true") boolean solid, InjectedValueAccess context) throws WorldEditException { + public void splatterBrush(LocalSession session, Pattern fill, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "points", desc = "double", def = "1") double pointsOpt, @Arg(name = "recursion", desc = "double", def = "5") double recursion, @Arg(name = "solid", desc = "boolean", def = "true") boolean solid, InjectedValueAccess context) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); - return set(session, context, new SplatterBrush((int) pointsOpt, (int) recursion, solid)).setSize(radius).setFill(fill); + set(session, context, new SplatterBrush((int) pointsOpt, (int) recursion, solid)).setSize(radius).setFill(fill); } @Command( @@ -558,9 +550,9 @@ public class BrushCommands { " - Placeholders: {x}, {y}, {z}, {world}, {size}" ) @CommandPermissions("worldedit.brush.scattercommand") - public BrushSettings scatterCommandBrush(Player player, EditSession editSession, LocalSession session, @Arg(name = "radius", desc = "Expression") Expression radius, double points, double distance, List commandStr, InjectedValueAccess context) throws WorldEditException { + public void scatterCommandBrush(Player player, EditSession editSession, LocalSession session, @Arg(name = "radius", desc = "Expression") Expression radius, double points, double distance, List commandStr, InjectedValueAccess context) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); - return set(session, context, + set(session, context, new ScatterCommand((int) points, (int) distance, StringMan.join(commandStr, " "))) .setSize(radius); } @@ -571,7 +563,7 @@ public class BrushCommands { desc = "Choose the cylinder brush" ) @CommandPermissions("worldedit.brush.cylinder") - public BrushSettings cylinderBrush(Player player, LocalSession session, + public void cylinderBrush(Player player, LocalSession session, @Arg(desc = "The pattern of blocks to set") Pattern pattern, @Arg(desc = "The radius of the cylinder", def = "2") @@ -592,7 +584,6 @@ public class BrushCommands { } settings.setSize(radius) .setFill(pattern); - return settings; } @Command( @@ -605,7 +596,7 @@ public class BrushCommands { "stood relative to the copied area when you copied it." ) @CommandPermissions("worldedit.brush.clipboard") - public BrushSettings clipboardBrush(Player player,LocalSession session, + public void clipboardBrush(Player player,LocalSession session, @Switch(name = 'a', desc = "Don't paste air from the clipboard") boolean ignoreAir, @Switch(name = 'o', desc = "Paste starting at the target location, instead of centering on it") @@ -629,7 +620,7 @@ public class BrushCommands { worldEdit.checkMaxBrushRadius(size.getBlockY() / 2D - 1); worldEdit.checkMaxBrushRadius(size.getBlockZ() / 2D - 1); - return set(session, context, new ClipboardBrush(newHolder, ignoreAir, usingOrigin, !skipEntities, pasteBiomes, sourceMask)); + set(session, context, new ClipboardBrush(newHolder, ignoreAir, usingOrigin, !skipEntities, pasteBiomes, sourceMask)); } @Command( @@ -638,7 +629,7 @@ public class BrushCommands { descFooter = "Example: '/brush smooth 2 4 grass_block,dirt,stone'" ) @CommandPermissions("worldedit.brush.smooth") - public BrushSettings smoothBrush(Player player, LocalSession session, EditSession editSession, + public void smoothBrush(Player player, LocalSession session, EditSession editSession, @Arg(desc = "The radius to sample for softening", def = "2") Expression radius, @Arg(desc = "The number of iterations to perform", def = "4") @@ -651,7 +642,7 @@ public class BrushCommands { FaweLimit limit = Settings.IMP.getLimit(fp); iterations = Math.min(limit.MAX_ITERATIONS, iterations); - return set(session, context, + set(session, context, new SmoothBrush(iterations, maskOpt)) .setSize(radius); } @@ -662,14 +653,14 @@ public class BrushCommands { desc = "Shortcut fire extinguisher brush" ) @CommandPermissions("worldedit.brush.ex") - public BrushSettings extinguishBrush(Player player, LocalSession session, EditSession editSession, + public void extinguishBrush(Player player, LocalSession session, EditSession editSession, @Arg(desc = "The radius to extinguish", def = "5") Expression radius, InjectedValueAccess context) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); Pattern fill = BlockTypes.AIR.getDefaultState(); - return set(session, context, + set(session, context, new SphereBrush()) .setSize(radius) .setFill(fill) @@ -682,7 +673,7 @@ public class BrushCommands { desc = "Gravity brush, simulates the effect of gravity" ) @CommandPermissions("worldedit.brush.gravity") - public BrushSettings gravityBrush(Player player, LocalSession session, + public void gravityBrush(Player player, LocalSession session, @Arg(desc = "The radius to apply gravity in", def = "5") Expression radius, @Switch(name = 'h', desc = "Affect blocks starting at max Y, rather than the target location Y + radius") @@ -690,7 +681,7 @@ public class BrushCommands { InjectedValueAccess context) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); - return set(session, context, + set(session, context, new GravityBrush(fromMaxY)) .setSize(radius); } @@ -707,8 +698,8 @@ public class BrushCommands { "Snow Pic: https://i.imgur.com/Hrzn0I4.png" ) @CommandPermissions("worldedit.brush.height") - public BrushSettings heightBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") String image, @Arg(def = "0", desc = "rotation") @Range(min = 0, max = 360) int rotation, @Arg(name = "yscale", desc = "double", def = "1") double yscale, @Switch(name = 'r', desc = "TODO") boolean randomRotate, @Switch(name = 'l', desc = "TODO") boolean layers, @Switch(name = 's', desc = "TODO") boolean dontSmooth, InjectedValueAccess context) throws WorldEditException, FileNotFoundException { - return terrainBrush(player, session, radius, image, rotation, yscale, false, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CONE, context); + public void heightBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") String image, @Arg(def = "0", desc = "rotation") @Range(min = 0, max = 360) int rotation, @Arg(name = "yscale", desc = "double", def = "1") double yscale, @Switch(name = 'r', desc = "TODO") boolean randomRotate, @Switch(name = 'l', desc = "TODO") boolean layers, @Switch(name = 's', desc = "TODO") boolean dontSmooth, InjectedValueAccess context) throws WorldEditException, FileNotFoundException { + terrainBrush(player, session, radius, image, rotation, yscale, false, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CONE, context); } @Command( @@ -718,7 +709,7 @@ public class BrushCommands { descFooter = "This brush flattens terrain and creates cliffs." ) @CommandPermissions("worldedit.brush.height") - public BrushSettings cliffBrush(Player player, LocalSession session, + public void cliffBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") @@ -733,7 +724,7 @@ public class BrushCommands { boolean layers, @Switch(name = 's', desc = "Disables smoothing") boolean dontSmooth, InjectedValueAccess context) throws WorldEditException, FileNotFoundException { - return terrainBrush(player, session, radius, image, rotation, yscale, true, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CYLINDER, context); + terrainBrush(player, session, radius, image, rotation, yscale, true, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CYLINDER, context); } @Command( @@ -742,17 +733,17 @@ public class BrushCommands { desc = "This brush raises or lowers land towards the clicked point" ) @CommandPermissions("worldedit.brush.height") - public BrushSettings flattenBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") String image, @Arg(def = "0", desc = "rotation") @Step(90) @Range(min = 0, max = 360) int rotation, @Arg(name = "yscale", desc = "double", def = "1") double yscale, + public void flattenBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Arg(name = "image", desc = "String", def = "") String image, @Arg(def = "0", desc = "rotation") @Step(90) @Range(min = 0, max = 360) int rotation, @Arg(name = "yscale", desc = "double", def = "1") double yscale, @Switch(name = 'r', desc = "Enables random off-axis rotation") boolean randomRotate, @Switch(name = 'l', desc = "Will work on snow layers") boolean layers, @Switch(name = 's', desc = "Disables smoothing") boolean dontSmooth, InjectedValueAccess context) throws WorldEditException, FileNotFoundException { - return terrainBrush(player, session, radius, image, rotation, yscale, true, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CONE, context); + terrainBrush(player, session, radius, image, rotation, yscale, true, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CONE, context); } - private BrushSettings terrainBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression") Expression radius, String image, int rotation, double yscale, boolean flat, boolean randomRotate, boolean layers, boolean smooth, ScalableHeightMap.Shape shape, InjectedValueAccess context) throws WorldEditException, FileNotFoundException { + private void terrainBrush(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression") Expression radius, String image, int rotation, double yscale, boolean flat, boolean randomRotate, boolean layers, boolean smooth, Shape shape, InjectedValueAccess context) throws WorldEditException, FileNotFoundException { worldEdit.checkMaxBrushRadius(radius); InputStream stream = getHeightmapStream(image); HeightBrush brush; @@ -772,9 +763,9 @@ public class BrushCommands { if (randomRotate) { brush.setRandomRotate(true); } - return set(session, context, - brush) - .setSize(radius); + set(session, context, + brush) + .setSize(radius); } private InputStream getHeightmapStream(String filename) throws FileNotFoundException { @@ -797,11 +788,11 @@ public class BrushCommands { "Video: https://www.youtube.com/watch?v=RPZIaTbqoZw" ) @CommandPermissions("worldedit.brush.copy") - public BrushSettings copy(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Switch(name = 'r', desc = "Apply random rotation on paste") boolean randomRotate, @Switch(name = 'a', desc = "Apply auto view based rotation on paste") boolean autoRotate, InjectedValueAccess context) throws WorldEditException { + public void copy(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression", def = "5") Expression radius, @Switch(name = 'r', desc = "Apply random rotation on paste") boolean randomRotate, @Switch(name = 'a', desc = "Apply auto view based rotation on paste") boolean autoRotate, InjectedValueAccess context) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); player.print(BBC.BRUSH_COPY.format(radius)); - return set(session, context, + set(session, context, new CopyPastaBrush(player, session, randomRotate, autoRotate)) .setSize(radius); } @@ -815,10 +806,10 @@ public class BrushCommands { " - Placeholders: {x}, {y}, {z}, {world}, {size}" ) @CommandPermissions("worldedit.brush.command") - public BrushSettings command(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression") Expression radius, @Arg(desc = "Command to run") List input, InjectedValueAccess context) throws WorldEditException { + public void command(Player player, LocalSession session, @Arg(name = "radius", desc = "Expression") Expression radius, @Arg(desc = "Command to run") List input, InjectedValueAccess context) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); String cmd = StringMan.join(input, " "); - return set(session, context, + set(session, context, new CommandBrush(cmd)) .setSize(radius); } @@ -829,7 +820,7 @@ public class BrushCommands { desc = "Butcher brush, kills mobs within a radius" ) @CommandPermissions("worldedit.brush.butcher") - public BrushSettings butcherBrush(Player player, LocalSession session, InjectedValueAccess context, + public void butcherBrush(Player player, LocalSession session, InjectedValueAccess context, @Arg(desc = "Radius to kill mobs in", def = "5") Expression radius, @Switch(name = 'p', desc = "Also kill pets") @@ -860,9 +851,7 @@ public class BrushCommands { flags.or(CreatureButcher.Flags.TAGGED , killWithName, "worldedit.butcher.tagged"); flags.or(CreatureButcher.Flags.ARMOR_STAND , killArmorStands, "worldedit.butcher.armorstands"); - return set(session, context, - new ButcherBrush(flags)) - .setSize(radius); + set(session, context, new ButcherBrush(flags)).setSize(radius); } public BrushSettings process(CommandLocals locals, BrushSettings settings) throws WorldEditException { diff --git a/worldedit-libs/build.gradle b/worldedit-libs/build.gradle index ac6c32f98..af12cd5f4 100644 --- a/worldedit-libs/build.gradle +++ b/worldedit-libs/build.gradle @@ -104,21 +104,21 @@ project("core") { } shade 'com.thoughtworks.paranamer:paranamer:2.6' shade 'com.sk89q.lib:jlibnoise:1.0.0' - shade "FAWE-Piston:core/build/libs/core-$pistonVersion:lastSuccessfulBuild@jar" - shade "FAWE-Piston:core-ap/runtime/build/libs/runtime-$pistonVersion:lastSuccessfulBuild@jar" - shade "FAWE-Piston:default-impl/build/libs/default-impl-$pistonVersion:lastSuccessfulBuild@jar" + shade "FAWE-Piston:lastSuccessfulBuild:core/build/libs/core-$pistonVersion@jar" + shade "FAWE-Piston:lastSuccessfulBuild:core-ap/runtime/build/libs/runtime-$pistonVersion@jar" + shade "FAWE-Piston:lastSuccessfulBuild:default-impl/build/libs/default-impl-$pistonVersion@jar" } project("ap") { dependencies { // def avVersion = "1.6.5" // shade "com.google.auto.value:auto-value-annotations:$avVersion" - shade "FAWE-Piston:core/build/libs/core-$pistonVersion:lastSuccessfulBuild@jar" - shade "FAWE-Piston:core-ap/annotations/build/libs/annotations-$pistonVersion:lastSuccessfulBuild@jar" - shade "FAWE-Piston:core-ap/processor/build/libs/processor-$pistonVersion:lastSuccessfulBuild@jar" + shade "FAWE-Piston:lastSuccessfulBuild:core/build/libs/core-$pistonVersion@jar" + shade "FAWE-Piston:lastSuccessfulBuild:core-ap/annotations/build/libs/annotations-$pistonVersion@jar" + shade "FAWE-Piston:lastSuccessfulBuild:core-ap/processor/build/libs/processor-$pistonVersion@jar" - shade "org.enginehub.piston.core-ap:annotations:0.4.3" - shade "org.enginehub.piston.core-ap:processor:0.4.3" + shade "org.enginehub.piston.core-ap:annotations:$pistonVersion" + shade "org.enginehub.piston.core-ap:processor:$pistonVersion" } } } From 45f947a3b2fc3884a3d4363f43794170213e730c Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Mon, 19 Aug 2019 14:00:37 -0400 Subject: [PATCH 02/24] migrated settings.gradle to kotlin --- build.gradle | 75 ++++++++++++---------------- gradle.properties | 8 +-- settings.gradle | 9 ---- settings.gradle.kts | 9 ++++ worldedit-bukkit/build.gradle | 92 +++++++++++++++++------------------ worldedit-core/build.gradle | 64 ++++++++++++------------ worldedit-libs/build.gradle | 43 ++++++---------- 7 files changed, 135 insertions(+), 165 deletions(-) delete mode 100644 settings.gradle create mode 100644 settings.gradle.kts diff --git a/build.gradle b/build.gradle index a5f7a101c..b1036018a 100644 --- a/build.gradle +++ b/build.gradle @@ -9,13 +9,13 @@ buildscript { configurations.all { resolutionStrategy { - force 'commons-io:commons-io:2.4' + force "commons-io:commons-io:2.4" } } dependencies { - classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.4' - classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.8.1' + classpath "com.github.jengelman.gradle.plugins:shadow:2.0.4" + classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.8.1" } } @@ -29,8 +29,8 @@ println """ You are building FastAsyncWorldEdit! If you encounter trouble: - 1) Read COMPILING.md if you haven't yet - 2) Try running 'build' in a separate Gradle run + 1) Read COMPILING.md if you haven"t yet + 2) Try running "build" in a separate Gradle run 3) Use gradlew and not gradle 4) If you still need help, ask on Discord! https://discord.gg/ngZCzbU @@ -39,18 +39,18 @@ println """ """ allprojects { - group = 'com.boydti.fawe' + group = "com.boydti.fawe" def rootVersion = "1.13" def revision = "" def buildNumber = "" def date = "" ext { - git = Grgit.open(dir: new File(rootDir.toString()+'/.git')) + git = Grgit.open(dir: new File(rootDir.toString()+"/.git")) date = git.head().getDate().format("yy.MM.dd") revision = "-${git.head().abbreviatedId}" parents = git.head().parentIds; - if (project.hasProperty('buildnumber')) { + if (project.hasProperty("buildnumber")) { buildNumber = "$buildnumber" } else { index = -2109; // Offset to match CI @@ -87,33 +87,29 @@ subprojects { maven { url "http://dl.bintray.com/tastybento/maven-repo" } maven { url "http://ci.emc.gs/nexus/content/groups/aikar/" } ivy { - url 'https://ci.athion.net/job' - layout 'pattern', { - artifact '/[organisation]/[revision]/artifact/[module].[ext]' + url "https://ci.athion.net/job" + layout "pattern", { + artifact "/[organisation]/[revision]/artifact/[module].[ext]" } } } configurations.all { resolutionStrategy { - cacheChangingModulesFor 5, 'minutes' + cacheChangingModulesFor 5, "minutes" } } } -configure(['worldedit-core', 'worldedit-bukkit'].collect { project("$it") }) { - apply plugin: 'java' - apply plugin: 'maven' -// apply plugin: 'checkstyle' - apply plugin: 'com.github.johnrengelman.shadow' -// apply plugin: 'com.jfrog.artifactory' -// Enable this requires putting license header files in many, many FAWE files -// apply plugin: 'net.minecrell.licenser' - +configure(["worldedit-core", "worldedit-bukkit"].collect { project("$it") }) { + apply plugin: "java" + apply plugin: "maven" +// apply plugin: "checkstyle" + apply plugin: "com.github.johnrengelman.shadow" sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 // checkstyle.configFile = new File(rootProject.projectDir, "config/checkstyle/checkstyle.xml") -// checkstyle.toolVersion = '7.6.1' +// checkstyle.toolVersion = "7.6.1" clean.doFirst { delete "../target" @@ -122,13 +118,13 @@ configure(['worldedit-core', 'worldedit-bukkit'].collect { project("$it") }) { if (JavaVersion.current().isJava8Compatible()) { // Java 8 turns on doclint which we fail tasks.withType(Javadoc) { - options.addStringOption('Xdoclint:none', '-quiet') + options.addStringOption("Xdoclint:none", "-quiet") } } if (name == "worldedit-core" || name == "worldedit-bukkit") { task sourcesJar(type: Jar, dependsOn: classes) { - classifier = 'sources' + classifier = "sources" from sourceSets.main.allSource } @@ -141,46 +137,37 @@ configure(['worldedit-core', 'worldedit-bukkit'].collect { project("$it") }) { // build.dependsOn(checkstyleMain) // build.dependsOn(checkstyleTest) // build.dependsOn(javadocJar) -// -// artifactoryPublish { -// publishConfigs('archives') -// } dependencies { - compileOnly 'org.jetbrains:annotations:17.0.0' + compileOnly "org.jetbrains:annotations:17.0.0" } } -configure(['bukkit'].collect { project(":worldedit-$it") }) { +configure(["bukkit"].collect { project(":worldedit-$it") }) { shadowJar { - getArchiveClassifier().set('dist') + getArchiveClassifier().set("dist") dependencies { include(project(":worldedit-libs:core")) include(project(":worldedit-libs:${project.name.replace("worldedit-", "")}")) include(project(":worldedit-core")) - include(dependency('com.github.luben:zstd-jni:1.1.1')) - include(dependency('co.aikar:fastutil-lite:1.0')) + include(dependency("com.github.luben:zstd-jni:1.1.1")) + include(dependency("co.aikar:fastutil-lite:1.0")) } - exclude 'GradleStart**' - exclude '.cache' - exclude 'LICENSE*' + exclude "GradleStart**" + exclude ".cache" + exclude "LICENSE*" } - // Enable this requires putting license header files in many, many FAWE files - //license { - // header = rootProject.file("HEADER.txt") - // include '**/*.java' - //} } -task aggregatedJavadocs(type: Javadoc, description: 'Generate javadocs from all child projects as if it was a single project', group: 'Documentation') { +task aggregatedJavadocs(type: Javadoc, description: "Generate javadocs from all child projects as if it was a single project", group: "Documentation") { destinationDir = file("./docs/javadoc") title = "$project.name $version API" options.author true - options.links 'http://docs.spring.io/spring/docs/4.3.x/javadoc-api/', 'http://docs.oracle.com/javase/8/docs/api/', 'http://docs.spring.io/spring-ws/docs/2.3.0.RELEASE/api/', 'http://docs.spring.io/spring-security/site/docs/4.0.4.RELEASE/apidocs/' - options.addStringOption('Xdoclint:none', '-quiet') + options.links "http://docs.spring.io/spring/docs/4.3.x/javadoc-api/", "http://docs.oracle.com/javase/8/docs/api/", "http://docs.spring.io/spring-ws/docs/2.3.0.RELEASE/api/", "http://docs.spring.io/spring-security/site/docs/4.0.4.RELEASE/apidocs/" + options.addStringOption("Xdoclint:none", "-quiet") delete "./docs" diff --git a/gradle.properties b/gradle.properties index 878bf1f7e..69b35f7b8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -# Sets default memory used for gradle commands. Can be overridden by user or command line properties. -# This is required to provide enough memory for the Minecraft decompilation process. -org.gradle.jvmargs=-Xmx3G -org.gradle.daemon=false \ No newline at end of file +#group=com.sk89q.worldedit +#version=7.1.0-SNAPSHOT + +org.gradle.jvmargs=-Xmx1G diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index b29efe82f..000000000 --- a/settings.gradle +++ /dev/null @@ -1,9 +0,0 @@ -rootProject.name = 'FastAsyncWorldEdit' - -include 'worldedit-libs' - -['core', 'bukkit'].forEach { - include "worldedit-libs:$it" - include "worldedit-$it" -} -include "worldedit-libs:core:ap" diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 000000000..a16b0a82d --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,9 @@ +rootProject.name = "FastAsyncWorldEdit" + +include("worldedit-libs") + +listOf("core", "bukkit").forEach { + include("worldedit-libs:$it") + include("worldedit-$it") +} +include("worldedit-libs:core:ap") diff --git a/worldedit-bukkit/build.gradle b/worldedit-bukkit/build.gradle index 137ffd8b4..55e58ab3b 100644 --- a/worldedit-bukkit/build.gradle +++ b/worldedit-bukkit/build.gradle @@ -1,7 +1,7 @@ -apply plugin: 'eclipse' -apply plugin: 'idea' -apply plugin: 'maven' -apply plugin: 'java-library' +apply plugin: "eclipse" +apply plugin: "idea" +apply plugin: "maven" +apply plugin: "java-library" repositories { maven { url "https://hub.spigotmc.org/nexus/content/groups/public" } @@ -19,72 +19,68 @@ configurations.all { Configuration it -> } dependencies { - compile ('net.milkbowl.vault:VaultAPI:1.7') - api project(':worldedit-core') - api project(':worldedit-libs:core') // TODO remove once core can compile - api project(':worldedit-libs:bukkit') - compileOnly 'com.sk89q:dummypermscompat:1.10' + compile ("net.milkbowl.vault:VaultAPI:1.7") + api project(":worldedit-core") + api project(":worldedit-libs:core") // TODO remove once core can compile + api project(":worldedit-libs:bukkit") + compileOnly "com.sk89q:dummypermscompat:1.10" compile "it.unimi.dsi:fastutil:8.2.1" - testCompile 'org.mockito:mockito-core:1.9.0-rc1' - implementation('org.apache.logging.log4j:log4j-slf4j-impl:2.8.1'){transitive = false} - compile 'com.destroystokyo.paper:paper-api:1.14.4-R0.1-SNAPSHOT' - implementation('io.papermc:paperlib:1.0.2'){transitive = false} - compileOnly 'BuildTools:spigot-1.14.4:lastSuccessfulBuild@jar' - implementation('com.sk89q.worldguard:worldguard-core:7.0.0-20190215.210421-39'){transitive = false} - implementation('com.sk89q.worldguard:worldguard-legacy:7.0.0-20190215.210421-39'){transitive = false} - implementation('com.massivecraft:factions:2.8.0'){transitive = false} - implementation('com.drtshock:factions:1.6.9.5'){transitive = false} - implementation('com.factionsone:FactionsOne:1.2.2'){transitive = false} - implementation('me.ryanhamshire:GriefPrevention:11.5.2'){transitive = false} - implementation('com.massivecraft:mcore:7.0.1'){transitive = false} - implementation('net.sacredlabyrinth.Phaed:PreciousStones:10.0.4-SNAPSHOT'){transitive = false} - implementation('net.jzx7:regios:5.9.9'){transitive = false} - implementation('com.bekvon.bukkit.residence:Residence:4.5._13.1'){transitive = false} - implementation('com.palmergames.bukkit:towny:0.84.0.9'){transitive = false} - implementation('com.thevoxelbox.voxelsniper:voxelsniper:5.171.0'){transitive = false} - implementation('com.comphenix.protocol:ProtocolLib-API:4.4.0-SNAPSHOT'){transitive = false} - implementation('com.wasteofplastic:askyblock:3.0.8.2'){transitive = false} + testCompile "org.mockito:mockito-core:1.9.0-rc1" + implementation("org.apache.logging.log4j:log4j-slf4j-impl:2.8.1"){transitive = false} + compile "com.destroystokyo.paper:paper-api:1.14.4-R0.1-SNAPSHOT" + implementation("io.papermc:paperlib:1.0.2"){transitive = false} + compileOnly "BuildTools:spigot-1.14.4:lastSuccessfulBuild@jar" + implementation("com.sk89q.worldguard:worldguard-core:7.0.0-20190215.210421-39"){transitive = false} + implementation("com.sk89q.worldguard:worldguard-legacy:7.0.0-20190215.210421-39"){transitive = false} + implementation("com.massivecraft:factions:2.8.0"){transitive = false} + implementation("com.drtshock:factions:1.6.9.5"){transitive = false} + implementation("com.factionsone:FactionsOne:1.2.2"){transitive = false} + implementation("me.ryanhamshire:GriefPrevention:11.5.2"){transitive = false} + implementation("com.massivecraft:mcore:7.0.1"){transitive = false} + implementation("net.sacredlabyrinth.Phaed:PreciousStones:10.0.4-SNAPSHOT"){transitive = false} + implementation("net.jzx7:regios:5.9.9"){transitive = false} + implementation("com.bekvon.bukkit.residence:Residence:4.5._13.1"){transitive = false} + implementation("com.palmergames.bukkit:towny:0.84.0.9"){transitive = false} + implementation("com.thevoxelbox.voxelsniper:voxelsniper:5.171.0"){transitive = false} + implementation("com.comphenix.protocol:ProtocolLib-API:4.4.0-SNAPSHOT"){transitive = false} + implementation("com.wasteofplastic:askyblock:3.0.8.2"){transitive = false} } shadowJar { dependencies { relocate "org.slf4j", "com.sk89q.worldedit.slf4j" relocate "org.apache.logging.slf4j", "com.sk89q.worldedit.log4jbridge" - include(dependency(':worldedit-core')) - include(dependency(':worldedit-libs:core')) - include(dependency(':worldedit-libs:bukkit')) - include(dependency('org.slf4j:slf4j-api')) + include(dependency(":worldedit-core")) + include(dependency(":worldedit-libs:core")) + include(dependency(":worldedit-libs:bukkit")) + include(dependency("org.slf4j:slf4j-api")) include(dependency("org.apache.logging.log4j:log4j-slf4j-impl")) relocate("it.unimi.dsi.fastutil", "com.sk89q.worldedit.bukkit.fastutil") { include("it.unimi.dsi:fastutil") } } archiveName = "${parent.name}-${project.name.replaceAll("worldedit-", "")}-${parent.version}.jar" - destinationDir = file '../target' + destinationDir = file "../target" } processResources { - from('src/main/resources') { + from("src/main/resources") { expand( name: project.parent.name, version: project.parent.version ) - include 'plugin.yml' + include "plugin.yml" } -// from (zipTree('src/main/resources/worldedit-adapters.jar').matching { -// exclude 'META-INF/' -// }) -// exclude '**/worldedit-adapters.jar' } jar.archiveName="fawe-bukkit-${project.parent.version}.jar" -jar.destinationDir = file '../mvn/com/boydti/fawe-bukkit/' + project.parent.version +jar.destinationDir = file "../mvn/com/boydti/fawe-bukkit/" + project.parent.version task createPom { doLast { pom { project { - groupId 'com.boydti' - artifactId 'fawe-bukkit' + groupId "com.boydti" + artifactId "fawe-bukkit" version project.parent.version } } @@ -93,9 +89,9 @@ task createPom { .writeTo("../mvn/com/boydti/fawe-bukkit/${project.parent.version}/fawe-bukkit-${project.parent.version}.pom") pom { project { - groupId 'com.boydti' - artifactId 'fawe-bukkit' - version 'latest' + groupId "com.boydti" + artifactId "fawe-bukkit" + version "latest" } } .getEffectivePom() @@ -107,9 +103,9 @@ task copyFiles { doLast { copy { from "../mvn/com/boydti/fawe-bukkit/${project.parent.version}/" - into '../mvn/com/boydti/fawe-bukkit/latest/' - include('*.jar') - rename ("fawe-bukkit-${project.parent.version}.jar", 'fawe-bukkit-latest.jar') + into "../mvn/com/boydti/fawe-bukkit/latest/" + include("*.jar") + rename ("fawe-bukkit-${project.parent.version}.jar", "fawe-bukkit-latest.jar") } } } diff --git a/worldedit-core/build.gradle b/worldedit-core/build.gradle index 53e79bbda..34a27d0e2 100644 --- a/worldedit-core/build.gradle +++ b/worldedit-core/build.gradle @@ -21,35 +21,35 @@ configurations.all { Configuration it -> } dependencies { - compile project(':worldedit-libs:core') - compile 'de.schlichtherle:truezip:6.8.3' - compile 'rhino:js:1.7R2' - compile 'org.yaml:snakeyaml:1.23' - compile 'com.google.guava:guava:21.0' - compile 'com.google.code.findbugs:jsr305:1.3.9' - compile 'com.thoughtworks.paranamer:paranamer:2.6' - compile 'com.google.code.gson:gson:2.8.0' - compile 'com.googlecode.json-simple:json-simple:1.1.1' - compile 'org.slf4j:slf4j-api:1.7.26' + compile project(":worldedit-libs:core") + compile "de.schlichtherle:truezip:6.8.3" + compile "rhino:js:1.7R2" + compile "org.yaml:snakeyaml:1.23" + compile "com.google.guava:guava:21.0" + compile "com.google.code.findbugs:jsr305:1.3.9" + compile "com.thoughtworks.paranamer:paranamer:2.6" + compile "com.google.code.gson:gson:2.8.0" + compile "com.googlecode.json-simple:json-simple:1.1.1" + compile "org.slf4j:slf4j-api:1.7.26" compile "it.unimi.dsi:fastutil:8.2.1" - compileOnly project(':worldedit-libs:core:ap') - annotationProcessor project(':worldedit-libs:core:ap') + compileOnly project(":worldedit-libs:core:ap") + annotationProcessor project(":worldedit-libs:core:ap") annotationProcessor "com.google.guava:guava:21.0" def avVersion = "1.6.5" compileOnly "com.google.auto.value:auto-value-annotations:$avVersion" annotationProcessor "com.google.auto.value:auto-value:$avVersion" - //compile 'net.sf.trove4j:trove4j:3.0.3' - testCompile 'org.mockito:mockito-core:1.9.0-rc1' + //compile "net.sf.trove4j:trove4j:3.0.3" + testCompile "org.mockito:mockito-core:1.9.0-rc1" // Fawe depends - compileOnly 'net.fabiozumbi12:redprotect:1.9.6' + compileOnly "net.fabiozumbi12:redprotect:1.9.6" compileOnly ("com.github.intellectualsites.plotsquared:PlotSquared-API:latest") { transitive = false } - compile 'com.mojang:datafixerupper:1.0.20' - compile 'com.github.luben:zstd-jni:1.1.1' - compile 'co.aikar:fastutil-lite:1.0' + compile "com.mojang:datafixerupper:1.0.20" + compile "com.github.luben:zstd-jni:1.1.1" + compile "co.aikar:fastutil-lite:1.0" testImplementation ("org.junit.jupiter:junit-jupiter-api:5.5.0") testImplementation ("org.junit.jupiter:junit-jupiter-params:5.5.0") testImplementation ("org.mockito:mockito-core:3.0.0") @@ -66,18 +66,18 @@ tasks.withType(JavaCompile).configureEach { sourceSets { main { java { - srcDir 'src/main/java' - srcDir 'src/legacy/java' + srcDir "src/main/java" + srcDir "src/legacy/java" } resources { - srcDir 'src/main/resources' + srcDir "src/main/resources" } } } processResources { - from('src/main/resources') { - include 'fawe.properties' + from("src/main/resources") { + include "fawe.properties" expand( version: "${project.parent.version}", name: project.parent.name, @@ -88,13 +88,13 @@ processResources { } jar.archiveName="fawe-api-${project.parent.version}.jar" -jar.destinationDir = file '../mvn/com/boydti/fawe-api/' + project.parent.version +jar.destinationDir = file "../mvn/com/boydti/fawe-api/" + project.parent.version task createPom { doLast { pom { project { - groupId 'com.boydti' - artifactId 'fawe-api' + groupId "com.boydti" + artifactId "fawe-api" version project.parent.version } } @@ -103,9 +103,9 @@ task createPom { .writeTo("../mvn/com/boydti/fawe-api/${project.parent.version}/fawe-api-${project.parent.version}.pom") pom { project { - groupId 'com.boydti' - artifactId 'fawe-api' - version 'latest' + groupId "com.boydti" + artifactId "fawe-api" + version "latest" } } .getEffectivePom() @@ -117,9 +117,9 @@ task copyFiles { doLast { copy { from "../mvn/com/boydti/fawe-api/${project.parent.version}/" - into '../mvn/com/boydti/fawe-api/latest/' - include('*.jar') - rename ("fawe-api-${project.parent.version}.jar", 'fawe-api-latest.jar') + into "../mvn/com/boydti/fawe-api/latest/" + include("*.jar") + rename ("fawe-api-${project.parent.version}.jar", "fawe-api-latest.jar") } } } diff --git a/worldedit-libs/build.gradle b/worldedit-libs/build.gradle index af12cd5f4..bf7270421 100644 --- a/worldedit-libs/build.gradle +++ b/worldedit-libs/build.gradle @@ -9,13 +9,13 @@ those libraries whose classes are internally depended on. This is because the main reason for shading those libraries is for their internal usage in each platform, not because we need them available to -dependents of `-core` to compile and work with WorldEdit's API. +dependents of `-core` to compile and work with WorldEdit"s API. */ configure(subprojects + project("core:ap")) { - apply plugin: 'maven' - apply plugin: 'com.github.johnrengelman.shadow' - apply plugin: 'com.jfrog.artifactory' + apply plugin: "maven" + apply plugin: "com.github.johnrengelman.shadow" + apply plugin: "com.jfrog.artifactory" configurations { create("shade") getByName("archives").extendsFrom(getByName("default")) @@ -33,7 +33,7 @@ configure(subprojects + project("core:ap")) { exclude(dependency("org.checkerframework:checker-qual")) } - relocate('net.kyori.text', 'com.sk89q.worldedit.util.formatting.text') + relocate("net.kyori.text", "com.sk89q.worldedit.util.formatting.text") } def altConfigFiles = { String artifactType -> def deps = configurations.shade.incoming.dependencies @@ -42,7 +42,7 @@ configure(subprojects + project("core:ap")) { dependency.artifact { artifact -> artifact.name = dependency.name artifact.type = artifactType - artifact.extension = 'jar' + artifact.extension = "jar" artifact.classifier = artifactType } dependency @@ -55,15 +55,15 @@ configure(subprojects + project("core:ap")) { } tasks.register("sourcesJar", Jar) { from { - altConfigFiles('sources') + altConfigFiles("sources") } - def filePattern = ~'(.*)net/kyori/text((?:/|$).*)' + def filePattern = ~/(.*)net\/kyori\/text((?:\/|\u0024).*)/ def textPattern = ~/net\.kyori\.text/ eachFile { it.filter { String line -> - line.replaceFirst(textPattern, 'com.sk89q.worldedit.util.formatting.text') + line.replaceFirst(textPattern, "com.sk89q.worldedit.util.formatting.text") } - it.path = it.path.replaceFirst(filePattern, '$1com/sk89q/worldedit/util/formatting/text$2') + it.path = it.path.replaceFirst(filePattern, "\$1com/sk89q/worldedit/util/formatting/text\$2") } classifier = "sources" } @@ -82,7 +82,7 @@ configure(subprojects + project("core:ap")) { } artifactoryPublish { - publishConfigs('default') + publishConfigs("default") } build.dependsOn(jar, sourcesJar) @@ -91,7 +91,7 @@ configure(subprojects + project("core:ap")) { def textExtrasVersion = "3.0.2" project("core") { def textVersion = "3.0.2" - def pistonVersion = '0.4.4-SNAPSHOT' + def pistonVersion = "0.4.4-SNAPSHOT" dependencies { shade "net.kyori:text-api:$textVersion" @@ -99,11 +99,11 @@ project("core") { shade "net.kyori:text-serializer-legacy:$textVersion" shade "net.kyori:text-serializer-plain:$textVersion" shade "net.kyori:text-feature-pagination:$textVersion" - shade('com.sk89q:jchronic:0.2.4a') { + shade("com.sk89q:jchronic:0.2.4a") { exclude(group: "junit", module: "junit") } - shade 'com.thoughtworks.paranamer:paranamer:2.6' - shade 'com.sk89q.lib:jlibnoise:1.0.0' + shade "com.thoughtworks.paranamer:paranamer:2.6" + shade "com.sk89q.lib:jlibnoise:1.0.0" shade "FAWE-Piston:lastSuccessfulBuild:core/build/libs/core-$pistonVersion@jar" shade "FAWE-Piston:lastSuccessfulBuild:core-ap/runtime/build/libs/runtime-$pistonVersion@jar" shade "FAWE-Piston:lastSuccessfulBuild:default-impl/build/libs/default-impl-$pistonVersion@jar" @@ -133,19 +133,6 @@ project("bukkit") { shade "net.kyori:text-adapter-bukkit:$textExtrasVersion" } } -/* -project("sponge") { - repositories { - maven { - name = "Sponge" - url = "https://repo.spongepowered.org/maven" - } - } - dependencies { - shade "net.kyori:text-adapter-spongeapi:$textExtrasVersion" - } -} -*/ tasks.register("build") { dependsOn(subprojects.collect { it.tasks.named("build") }) From 1eec4884c855176463a9d4c0ec481a1467ff17b9 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Mon, 19 Aug 2019 14:12:28 -0400 Subject: [PATCH 03/24] Attempt at fixing NamespacedRegistry --- .../worldedit/bukkit/WorldEditPlugin.java | 23 ++++++++++++++----- .../registry/NamespacedRegistry.java | 11 ++++++--- .../worldedit/world/block/BlockType.java | 6 +++++ .../worldedit/world/block/BlockTypes.java | 5 ++-- 4 files changed, 33 insertions(+), 12 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java index 59b0217bf..ba29ee0fd 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java @@ -37,16 +37,24 @@ import com.sk89q.worldedit.bukkit.adapter.BukkitImplLoader; import com.sk89q.worldedit.event.platform.CommandEvent; import com.sk89q.worldedit.event.platform.CommandSuggestionEvent; import com.sk89q.worldedit.event.platform.PlatformReadyEvent; +import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.internal.command.CommandUtil; +import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockCategory; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.FuzzyBlockState; import com.sk89q.worldedit.world.entity.EntityType; +import com.sk89q.worldedit.world.gamemode.GameModes; import com.sk89q.worldedit.world.item.ItemCategory; import com.sk89q.worldedit.world.item.ItemType; +import com.sk89q.worldedit.world.weather.WeatherTypes; import io.papermc.lib.PaperLib; import org.bukkit.Bukkit; import org.bukkit.Material; @@ -214,7 +222,7 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter PaperLib.suggestPaper(this); } - public void setupRegistries() { + private void setupRegistries() { // Biome for (Biome biome : Biome.values()) { String lowerCaseBiomeName = biome.name().toLowerCase(Locale.ROOT); @@ -259,6 +267,9 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter EntityType.REGISTRY.register("minecraft:" + lowerCaseMcId, new EntityType("minecraft:" + lowerCaseMcId)); } } + // ... :| + GameModes.get(""); + WeatherTypes.get(""); } private void setupTags() { @@ -428,7 +439,7 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter // code of WorldEdit expects it String[] split = new String[args.length + 1]; System.arraycopy(args, 0, split, 1, args.length); - split[0] = "/" + cmd.getName(); + split[0] = "/" + commandLabel; CommandEvent event = new CommandEvent(wrapCommandSender(sender), Joiner.on(" ").join(split)); getWorldEdit().getEventBus().post(event); @@ -443,7 +454,7 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter // code of WorldEdit expects it String[] split = new String[args.length + 1]; System.arraycopy(args, 0, split, 1, args.length); - split[0] = "/" + cmd.getName(); + split[0] = "/" + commandLabel; String arguments = Joiner.on(" ").join(split); CommandSuggestionEvent event = new CommandSuggestionEvent(wrapCommandSender(sender), arguments); @@ -577,9 +588,9 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter if (!event.isCommand()) return; String buffer = event.getBuffer(); - final String[] parts = buffer.split(" "); - if (parts.length < 1) return; - final String label = parts[0]; + int firstSpace = buffer.indexOf(' '); + if (firstSpace < 0) return; + final String label = buffer.substring(0, firstSpace); final Optional command = WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().getCommandManager().getCommand(label); if (!command.isPresent()) return; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/NamespacedRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/NamespacedRegistry.java index 6c86fdb0c..ea72d9f69 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/NamespacedRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/NamespacedRegistry.java @@ -29,7 +29,7 @@ import java.util.List; import java.util.Set; import javax.annotation.Nullable; -public final class NamespacedRegistry extends Registry { +public final class NamespacedRegistry extends Registry { private static final String MINECRAFT_NAMESPACE = "minecraft"; private final Set knownNamespaces = new HashSet<>(); private final String defaultNamespace; @@ -60,7 +60,9 @@ public final class NamespacedRegistry extends Re if (existing != null) { throw new UnsupportedOperationException("Replacing existing registrations is not supported"); } - value.setInternalId(lastInternalId++); + if (value instanceof RegistryItem) { + ((RegistryItem)value).setInternalId(lastInternalId++); + } values.add(value); super.register(key, value); if (key.startsWith(defaultNamespace)) { @@ -78,7 +80,10 @@ public final class NamespacedRegistry extends Re } public int getInternalId(V value) { - return value.getInternalId(); + if (value instanceof RegistryItem) { + return ((RegistryItem)value).getInternalId(); + } + return 0; } public int size() { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java index 0465bc21d..2b6b1c155 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java @@ -29,6 +29,7 @@ import com.sk89q.worldedit.function.mask.SingleBlockTypeMask; import com.sk89q.worldedit.function.pattern.FawePattern; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.registry.Keyed; +import com.sk89q.worldedit.registry.NamespacedRegistry; import com.sk89q.worldedit.registry.state.AbstractProperty; import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.registry.state.PropertyKey; @@ -36,15 +37,20 @@ import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.world.registry.BlockMaterial; import com.sk89q.worldedit.world.registry.LegacyMapper; + import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.IntStream; import javax.annotation.Nullable; public class BlockType implements FawePattern, Keyed { + + public static final NamespacedRegistry REGISTRY = new NamespacedRegistry<>("block type"); + private final String id; private final BlockTypes.Settings settings; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java index 2abc4d052..215355dbe 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java @@ -954,15 +954,14 @@ public final class BlockTypes { try { Field field = BlockTypes.class.getDeclaredField(enumName); ReflectionUtils.setFailsafeFieldValue(field, null, existing); - } catch (NoSuchFieldException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { + } catch (NoSuchFieldException | IllegalAccessException e) { e.printStackTrace(); } // register states if (typeName.startsWith("minecraft:")) $REGISTRY.put(typeName.substring(10), existing); $REGISTRY.put(typeName, existing); + BlockType.REGISTRY.register(typeName,existing); String nameSpace = typeName.substring(0, typeName.indexOf(':')); $NAMESPACES.add(nameSpace); return existing; From 548683d50af87933d37dd4e7307578ed503b67f7 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Mon, 19 Aug 2019 14:16:02 -0400 Subject: [PATCH 04/24] enable build scanning This will be removed once we are done with the commanding branch --- build.gradle | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build.gradle b/build.gradle index b1036018a..5f346151f 100644 --- a/build.gradle +++ b/build.gradle @@ -22,6 +22,12 @@ buildscript { plugins { id "org.ajoberstar.grgit" version "3.1.1" id "com.github.johnrengelman.shadow" version "5.1.0" + id 'com.gradle.build-scan' version '1.16' +} + +buildScan { + licenseAgreementUrl = 'https://gradle.com/terms-of-service' + licenseAgree = 'yes' } println """ From 3638f4bfb7d7b41cdd8a1c48f1a35d761cd8a2cd Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Mon, 19 Aug 2019 20:32:30 +0200 Subject: [PATCH 05/24] Fix building --- build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 5f346151f..a3bbdf5ea 100644 --- a/build.gradle +++ b/build.gradle @@ -22,12 +22,12 @@ buildscript { plugins { id "org.ajoberstar.grgit" version "3.1.1" id "com.github.johnrengelman.shadow" version "5.1.0" - id 'com.gradle.build-scan' version '1.16' + id 'com.gradle.build-scan' version '2.1' } buildScan { - licenseAgreementUrl = 'https://gradle.com/terms-of-service' - licenseAgree = 'yes' + termsOfServiceUrl = 'https://gradle.com/terms-of-service' + termsOfServiceAgree = 'yes' } println """ From 8193eac8c8069af470127161f1e123eb020f874d Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Mon, 19 Aug 2019 15:11:29 -0400 Subject: [PATCH 06/24] Revert "revert ivy change" This reverts commit d1af07b6 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index a3bbdf5ea..d0ee7c47d 100644 --- a/build.gradle +++ b/build.gradle @@ -95,7 +95,7 @@ subprojects { ivy { url "https://ci.athion.net/job" layout "pattern", { - artifact "/[organisation]/[revision]/artifact/[module].[ext]" + artifact "/[organisation]/[module]/artifact/[revision].[ext]" } } } From 2a054b92209454aa079337de5ca9e7bc3772d293 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Mon, 19 Aug 2019 15:22:39 -0400 Subject: [PATCH 07/24] swapped core and bukkit --- settings.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.gradle.kts b/settings.gradle.kts index a16b0a82d..56f98fe6a 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -2,7 +2,7 @@ rootProject.name = "FastAsyncWorldEdit" include("worldedit-libs") -listOf("core", "bukkit").forEach { +listOf("bukkit", "core").forEach { include("worldedit-libs:$it") include("worldedit-$it") } From 64a1bfc9b3cbf27043d83489e237dcc32c86c7ad Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Tue, 20 Aug 2019 14:52:24 -0400 Subject: [PATCH 08/24] migrate to gradle to kotlin --- build.gradle | 188 ---- build.gradle.kts | 48 + buildSrc/build.gradle.kts | 29 + buildSrc/src/main/kotlin/CommonConfig.kt | 27 + buildSrc/src/main/kotlin/GradleExtras.kt | 12 + buildSrc/src/main/kotlin/LibsConfig.kt | 97 ++ buildSrc/src/main/kotlin/PlatformConfig.kt | 108 +++ buildSrc/src/main/kotlin/Versions.kt | 8 + worldedit-bukkit/build.gradle | 114 --- worldedit-bukkit/build.gradle.kts | 98 ++ worldedit-core/build.gradle | 129 --- worldedit-core/build.gradle.kts | 67 ++ .../fawe/util/DocumentationPrinter.java | 12 +- .../sk89q/worldedit/command/MaskCommands.java | 894 +++++++++--------- .../worldedit/command/PatternCommands.java | 754 +++++++-------- .../worldedit/command/TransformCommands.java | 208 ++-- .../factory/DefaultTransformParser.java | 2 +- .../parser/pattern/DefaultPatternParser.java | 2 +- .../platform/PlatformCommandManager.java | 56 +- worldedit-libs/build.gradle | 139 --- worldedit-libs/build.gradle.kts | 3 + worldedit-libs/bukkit/build.gradle.kts | 11 + worldedit-libs/core/ap/build.gradle.kts | 9 + worldedit-libs/core/build.gradle.kts | 16 + 24 files changed, 1496 insertions(+), 1535 deletions(-) delete mode 100644 build.gradle create mode 100644 build.gradle.kts create mode 100644 buildSrc/build.gradle.kts create mode 100644 buildSrc/src/main/kotlin/CommonConfig.kt create mode 100644 buildSrc/src/main/kotlin/GradleExtras.kt create mode 100644 buildSrc/src/main/kotlin/LibsConfig.kt create mode 100644 buildSrc/src/main/kotlin/PlatformConfig.kt create mode 100644 buildSrc/src/main/kotlin/Versions.kt delete mode 100644 worldedit-bukkit/build.gradle create mode 100644 worldedit-bukkit/build.gradle.kts delete mode 100644 worldedit-core/build.gradle create mode 100644 worldedit-core/build.gradle.kts delete mode 100644 worldedit-libs/build.gradle create mode 100644 worldedit-libs/build.gradle.kts create mode 100644 worldedit-libs/bukkit/build.gradle.kts create mode 100644 worldedit-libs/core/ap/build.gradle.kts create mode 100644 worldedit-libs/core/build.gradle.kts diff --git a/build.gradle b/build.gradle deleted file mode 100644 index d0ee7c47d..000000000 --- a/build.gradle +++ /dev/null @@ -1,188 +0,0 @@ -import org.ajoberstar.grgit.Grgit - -buildscript { - repositories { - mavenCentral() - maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" } - jcenter() - } - - configurations.all { - resolutionStrategy { - force "commons-io:commons-io:2.4" - } - } - - dependencies { - classpath "com.github.jengelman.gradle.plugins:shadow:2.0.4" - classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.8.1" - } -} - -plugins { - id "org.ajoberstar.grgit" version "3.1.1" - id "com.github.johnrengelman.shadow" version "5.1.0" - id 'com.gradle.build-scan' version '2.1' -} - -buildScan { - termsOfServiceUrl = 'https://gradle.com/terms-of-service' - termsOfServiceAgree = 'yes' -} - -println """ -******************************************* - You are building FastAsyncWorldEdit! - - If you encounter trouble: - 1) Read COMPILING.md if you haven"t yet - 2) Try running "build" in a separate Gradle run - 3) Use gradlew and not gradle - 4) If you still need help, ask on Discord! https://discord.gg/ngZCzbU - - Output files will be in /target -******************************************* -""" - -allprojects { - group = "com.boydti.fawe" - - def rootVersion = "1.13" - def revision = "" - def buildNumber = "" - def date = "" - ext { - git = Grgit.open(dir: new File(rootDir.toString()+"/.git")) - date = git.head().getDate().format("yy.MM.dd") - revision = "-${git.head().abbreviatedId}" - parents = git.head().parentIds; - if (project.hasProperty("buildnumber")) { - buildNumber = "$buildnumber" - } else { - index = -2109; // Offset to match CI - for (; parents != null && !parents.isEmpty(); index++) { - parents = git.getResolve().toCommit(parents.get(0)).getParentIds() - } - buildNumber = "${index}" - } - } - - version = String.format("%s.%s", rootVersion, buildNumber) -} - -description = rootProject.name - -subprojects { - repositories { - mavenCentral() - maven { url "http://maven.sk89q.com/repo/" } - maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } - maven { url "http://repo.maven.apache.org/maven2" } - // Fawe - maven { url "https://mvnrepository.com/artifact/" } - maven { url "http://repo.dmulloy2.net/content/groups/public/" } - maven { url "https://repo.destroystokyo.com/repository/maven-public//" } - maven { url "http://ci.athion.net/job/PlotSquared-Breaking/ws/mvn/" } - maven { url "https://libraries.minecraft.net" } - mavenLocal() - maven { url "http://empcraft.com/maven2" } - maven { url "https://hub.spigotmc.org/nexus/content/groups/public/" } - maven { url "http://ci.frostcast.net/plugin/repository/everything" } - maven { url "http://maven.sk89q.com/artifactory/repo" } - maven { url "http://repo.spongepowered.org/maven" } - maven { url "http://dl.bintray.com/tastybento/maven-repo" } - maven { url "http://ci.emc.gs/nexus/content/groups/aikar/" } - ivy { - url "https://ci.athion.net/job" - layout "pattern", { - artifact "/[organisation]/[module]/artifact/[revision].[ext]" - } - } - } - configurations.all { - resolutionStrategy { - cacheChangingModulesFor 5, "minutes" - } - } -} - -configure(["worldedit-core", "worldedit-bukkit"].collect { project("$it") }) { - apply plugin: "java" - apply plugin: "maven" -// apply plugin: "checkstyle" - apply plugin: "com.github.johnrengelman.shadow" - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - -// checkstyle.configFile = new File(rootProject.projectDir, "config/checkstyle/checkstyle.xml") -// checkstyle.toolVersion = "7.6.1" - - clean.doFirst { - delete "../target" - } - - if (JavaVersion.current().isJava8Compatible()) { - // Java 8 turns on doclint which we fail - tasks.withType(Javadoc) { - options.addStringOption("Xdoclint:none", "-quiet") - } - } - - if (name == "worldedit-core" || name == "worldedit-bukkit") { - task sourcesJar(type: Jar, dependsOn: classes) { - classifier = "sources" - from sourceSets.main.allSource - } - - artifacts { - archives sourcesJar - } - build.dependsOn(sourcesJar) - } - -// build.dependsOn(checkstyleMain) -// build.dependsOn(checkstyleTest) -// build.dependsOn(javadocJar) - - dependencies { - compileOnly "org.jetbrains:annotations:17.0.0" - } -} - -configure(["bukkit"].collect { project(":worldedit-$it") }) { - shadowJar { - getArchiveClassifier().set("dist") - dependencies { - include(project(":worldedit-libs:core")) - include(project(":worldedit-libs:${project.name.replace("worldedit-", "")}")) - include(project(":worldedit-core")) - include(dependency("com.github.luben:zstd-jni:1.1.1")) - include(dependency("co.aikar:fastutil-lite:1.0")) - } - exclude "GradleStart**" - exclude ".cache" - exclude "LICENSE*" - } - -} - - - -task aggregatedJavadocs(type: Javadoc, description: "Generate javadocs from all child projects as if it was a single project", group: "Documentation") { - destinationDir = file("./docs/javadoc") - title = "$project.name $version API" - options.author true - options.links "http://docs.spring.io/spring/docs/4.3.x/javadoc-api/", "http://docs.oracle.com/javase/8/docs/api/", "http://docs.spring.io/spring-ws/docs/2.3.0.RELEASE/api/", "http://docs.spring.io/spring-security/site/docs/4.0.4.RELEASE/apidocs/" - options.addStringOption("Xdoclint:none", "-quiet") - - delete "./docs" - - subprojects.each { proj -> - proj.tasks.withType(Javadoc).each { javadocTask -> - source += javadocTask.source - classpath += javadocTask.classpath - excludes += javadocTask.excludes - includes += javadocTask.includes - } - } -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 000000000..e8da05dd6 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,48 @@ +import org.ajoberstar.grgit.Grgit + +logger.lifecycle(""" +******************************************* + You are building WorldEdit! + + If you encounter trouble: + 1) Read COMPILING.md if you haven't yet + 2) Try running 'build' in a separate Gradle run + 3) Use gradlew and not gradle + 4) If you still need help, ask on Discord! https://discord.gg/enginehub + + Output files will be in [subproject]/build/libs +******************************************* +""") + +//def rootVersion = "1.13" +//def revision = "" +//def buildNumber = "" +//def date = "" +//ext { +// git = Grgit.open(dir: new File(rootDir.toString()+"/.git")) +// date = git.head().getDate().format("yy.MM.dd") +// revision = "-${git.head().abbreviatedId}" +// parents = git.head().parentIds; +// if (project.hasProperty("buildnumber")) { +// buildNumber = "$buildnumber" +// } else { +// index = -2109; // Offset to match CI +// for (; parents != null && !parents.isEmpty(); index++) { +// parents = git.getResolve().toCommit(parents.get(0)).getParentIds() +// } +// buildNumber = "${index}" +// } +//} +// +//version = String.format("%s.%s", rootVersion, buildNumber) + +if (!project.hasProperty("gitCommitHash")) { + apply(plugin = "org.ajoberstar.grgit") + ext["gitCommitHash"] = try { + (ext["grgit"] as Grgit?)?.head()?.abbreviatedId + } catch (e: Exception) { + logger.warn("Error getting commit hash", e) + + "no_git_id" + } +} diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 000000000..ed12dbe5b --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,29 @@ +plugins { + `kotlin-dsl` + kotlin("jvm") version embeddedKotlinVersion +} + +repositories { + jcenter() + gradlePluginPortal() +} + +configurations.all { + resolutionStrategy { + // Fabric needs this. + force( + "commons-io:commons-io:2.5", + "org.ow2.asm:asm:7.1", + "org.ow2.asm:asm-commons:7.1" + ) + } +} + +dependencies { + implementation(gradleApi()) + implementation("org.ajoberstar.grgit:grgit-gradle:3.1.1") + implementation("com.github.jengelman.gradle.plugins:shadow:5.1.0") + implementation("net.ltgt.apt-eclipse:net.ltgt.apt-eclipse.gradle.plugin:0.21") + implementation("net.ltgt.apt-idea:net.ltgt.apt-idea.gradle.plugin:0.21") + implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.9.7") +} diff --git a/buildSrc/src/main/kotlin/CommonConfig.kt b/buildSrc/src/main/kotlin/CommonConfig.kt new file mode 100644 index 000000000..8f2048586 --- /dev/null +++ b/buildSrc/src/main/kotlin/CommonConfig.kt @@ -0,0 +1,27 @@ +import org.gradle.api.Project +import org.gradle.kotlin.dsl.repositories + +fun Project.applyCommonConfiguration() { + group = rootProject.group + version = rootProject.version + + repositories { + mavenCentral() + mavenLocal() + maven { url = uri("http://ci.athion.net/job/PlotSquared-Breaking/ws/mvn/") } + maven { url = uri("https://maven.sk89q.com/repo/") } + maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") } + maven { url = uri("http://empcraft.com/maven2") } + maven { url = uri("https://repo.destroystokyo.com/repository/maven-public") } + maven { url = uri("https://ci.athion.net/job/FAWE-Piston/ws/") } + ivy { url = uri("https://ci.athion.net/job") + patternLayout { + artifact("/[organisation]/[module]/artifact/[revision].[ext]") + }} + } + configurations.all { + resolutionStrategy { + cacheChangingModulesFor(5, "minutes") + } + } +} diff --git a/buildSrc/src/main/kotlin/GradleExtras.kt b/buildSrc/src/main/kotlin/GradleExtras.kt new file mode 100644 index 000000000..e7d1e0ede --- /dev/null +++ b/buildSrc/src/main/kotlin/GradleExtras.kt @@ -0,0 +1,12 @@ +import org.gradle.api.Project +import org.gradle.api.plugins.ExtraPropertiesExtension +import org.gradle.api.plugins.JavaPluginConvention +import org.gradle.api.tasks.SourceSetContainer +import org.gradle.kotlin.dsl.getByType +import org.gradle.kotlin.dsl.the + +val Project.ext: ExtraPropertiesExtension + get() = extensions.getByType() + +val Project.sourceSets: SourceSetContainer + get() = the().sourceSets diff --git a/buildSrc/src/main/kotlin/LibsConfig.kt b/buildSrc/src/main/kotlin/LibsConfig.kt new file mode 100644 index 000000000..2ab16095b --- /dev/null +++ b/buildSrc/src/main/kotlin/LibsConfig.kt @@ -0,0 +1,97 @@ +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar +import org.gradle.api.Project +import org.gradle.api.artifacts.ModuleDependency +import org.gradle.api.internal.HasConvention +import org.gradle.api.plugins.MavenRepositoryHandlerConvention +import org.gradle.api.tasks.Upload +import org.gradle.api.tasks.bundling.Jar +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.get +import org.gradle.kotlin.dsl.getPlugin +import org.gradle.kotlin.dsl.invoke +import org.gradle.kotlin.dsl.register + +fun Project.applyLibrariesConfiguration() { + applyCommonConfiguration() + apply(plugin = "java-base") + apply(plugin = "maven") + apply(plugin = "com.github.johnrengelman.shadow") + apply(plugin = "com.jfrog.artifactory") + + configurations { + create("shade") + getByName("archives").extendsFrom(getByName("default")) + } + + group = "${rootProject.group}.worldedit-libs" + + tasks.register("jar") { + configurations = listOf(project.configurations["shade"]) + archiveClassifier.set("") + + dependencies { + exclude(dependency("com.google.guava:guava")) + exclude(dependency("com.google.code.gson:gson")) + exclude(dependency("org.checkerframework:checker-qual")) + } + + relocate("net.kyori.text", "com.sk89q.worldedit.util.formatting.text") + } + val altConfigFiles = { artifactType: String -> + val deps = configurations["shade"].incoming.dependencies + .filterIsInstance() + .map { it.copy() } + .map { dependency -> + dependency.artifact { + name = dependency.name + type = artifactType + extension = "jar" + classifier = artifactType + } + dependency + } + + files(configurations.detachedConfiguration(*deps.toTypedArray()) + .resolvedConfiguration.lenientConfiguration.artifacts + .filter { it.classifier == artifactType } + .map { zipTree(it.file) }) + } + tasks.register("sourcesJar") { + from({ + altConfigFiles("sources") + }) + val filePattern = Regex("(.*)net/kyori/text((?:/|$).*)") + val textPattern = Regex("net\\.kyori\\.text") + eachFile { + filter { + it.replaceFirst(textPattern, "com.sk89q.worldedit.util.formatting.text") + } + path = path.replaceFirst(filePattern, "$1com/sk89q/worldedit/util/formatting/text$2") + } + archiveClassifier.set("sources") + } + + tasks.named("assemble").configure { + dependsOn("jar", "sourcesJar") + } + + artifacts { + val jar = tasks.named("jar") + add("default", jar) { + builtBy(jar) + } + val sourcesJar = tasks.named("sourcesJar") + add("archives", sourcesJar) { + builtBy(sourcesJar) + } + } + + tasks.register("install") { + configuration = configurations["archives"] + (repositories as HasConvention).convention.getPlugin().mavenInstaller { + pom.version = project.version.toString() + pom.artifactId = project.name + } + } + +} diff --git a/buildSrc/src/main/kotlin/PlatformConfig.kt b/buildSrc/src/main/kotlin/PlatformConfig.kt new file mode 100644 index 000000000..7e0f2cf2b --- /dev/null +++ b/buildSrc/src/main/kotlin/PlatformConfig.kt @@ -0,0 +1,108 @@ +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar +import org.gradle.api.JavaVersion +import org.gradle.api.Project +import org.gradle.api.plugins.JavaPluginConvention +import org.gradle.api.plugins.quality.CheckstyleExtension +import org.gradle.api.tasks.bundling.Jar +import org.gradle.api.tasks.javadoc.Javadoc +import org.gradle.api.tasks.testing.Test +import org.gradle.external.javadoc.CoreJavadocOptions +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.configure +import org.gradle.kotlin.dsl.dependencies +import org.gradle.kotlin.dsl.get +import org.gradle.kotlin.dsl.getByName +import org.gradle.kotlin.dsl.named +import org.gradle.kotlin.dsl.register +import org.gradle.kotlin.dsl.withType + +fun Project.applyPlatformAndCoreConfiguration() { + applyCommonConfiguration() + apply(plugin = "java") + apply(plugin = "eclipse") + apply(plugin = "idea") + apply(plugin = "maven") + apply(plugin = "checkstyle") + apply(plugin = "com.github.johnrengelman.shadow") + apply(plugin = "com.jfrog.artifactory") + + ext["internalVersion"] = "$version;${rootProject.ext["gitCommitHash"]}" + + configure { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + configure { + configFile = rootProject.file("config/checkstyle/checkstyle.xml") + toolVersion = "7.6.1" + } + + tasks.withType().configureEach { + useJUnitPlatform() + } + + dependencies { + "compileOnly"("org.jetbrains:annotations:17.0.0") + "testImplementation"("org.junit.jupiter:junit-jupiter-api:${Versions.JUNIT}") + "testImplementation"("org.junit.jupiter:junit-jupiter-params:${Versions.JUNIT}") + "testImplementation"("org.mockito:mockito-core:${Versions.MOCKITO}") + "testImplementation"("org.mockito:mockito-junit-jupiter:${Versions.MOCKITO}") + "testRuntime"("org.junit.jupiter:junit-jupiter-engine:${Versions.JUNIT}") + } + + // Java 8 turns on doclint which we fail + tasks.withType().configureEach { + (options as CoreJavadocOptions).addStringOption("Xdoclint:none", "-quiet") + } + + tasks.register("javadocJar") { + dependsOn("javadoc") + archiveClassifier.set("javadoc") + from(tasks.getByName("javadoc").destinationDir) + } + + tasks.named("assemble").configure { + dependsOn("javadocJar") + } + + artifacts { + add("archives", tasks.named("jar")) + add("archives", tasks.named("javadocJar")) + } + + if (name == "worldedit-core" || name == "worldedit-bukkit") { + tasks.register("sourcesJar") { + dependsOn("classes") + archiveClassifier.set("sources") + from(sourceSets["main"].allSource) + } + + artifacts { + add("archives", tasks.named("sourcesJar")) + } + tasks.named("assemble").configure { + dependsOn("sourcesJar") + } + } + + tasks.named("check").configure { + dependsOn("checkstyleMain", "checkstyleTest") + } + +} + +fun Project.applyShadowConfiguration() { + tasks.named("shadowJar") { + archiveClassifier.set("dist") + dependencies { + include(project(":worldedit-libs:core")) + include(project(":worldedit-libs:${project.name.replace("worldedit-", "")}")) + include(project(":worldedit-core")) + } + exclude("GradleStart**") + exclude(".cache") + exclude("LICENSE*") + minimize() + } +} diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt new file mode 100644 index 000000000..a4570bd5a --- /dev/null +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -0,0 +1,8 @@ +object Versions { + const val TEXT = "3.0.1" + const val TEXT_EXTRAS = "3.0.2" + const val PISTON = "0.4.4-SNAPSHOT" + const val AUTO_VALUE = "1.6.5" + const val JUNIT = "5.5.0" + const val MOCKITO = "3.0.0" +} diff --git a/worldedit-bukkit/build.gradle b/worldedit-bukkit/build.gradle deleted file mode 100644 index 55e58ab3b..000000000 --- a/worldedit-bukkit/build.gradle +++ /dev/null @@ -1,114 +0,0 @@ -apply plugin: "eclipse" -apply plugin: "idea" -apply plugin: "maven" -apply plugin: "java-library" - -repositories { - maven { url "https://hub.spigotmc.org/nexus/content/groups/public" } - maven { url "https://repo.codemc.org/repository/maven-public" } - maven { url "https://papermc.io/repo/repository/maven-public/" } -} - -configurations.all { Configuration it -> - it.resolutionStrategy { ResolutionStrategy rs -> - rs.force("com.google.guava:guava:21.0") - } - it.resolutionStrategy { ResolutionStrategy rs -> - rs.force("it.unimi.dsi:fastutil:8.2.1") - } -} - -dependencies { - compile ("net.milkbowl.vault:VaultAPI:1.7") - api project(":worldedit-core") - api project(":worldedit-libs:core") // TODO remove once core can compile - api project(":worldedit-libs:bukkit") - compileOnly "com.sk89q:dummypermscompat:1.10" - compile "it.unimi.dsi:fastutil:8.2.1" - testCompile "org.mockito:mockito-core:1.9.0-rc1" - implementation("org.apache.logging.log4j:log4j-slf4j-impl:2.8.1"){transitive = false} - compile "com.destroystokyo.paper:paper-api:1.14.4-R0.1-SNAPSHOT" - implementation("io.papermc:paperlib:1.0.2"){transitive = false} - compileOnly "BuildTools:spigot-1.14.4:lastSuccessfulBuild@jar" - implementation("com.sk89q.worldguard:worldguard-core:7.0.0-20190215.210421-39"){transitive = false} - implementation("com.sk89q.worldguard:worldguard-legacy:7.0.0-20190215.210421-39"){transitive = false} - implementation("com.massivecraft:factions:2.8.0"){transitive = false} - implementation("com.drtshock:factions:1.6.9.5"){transitive = false} - implementation("com.factionsone:FactionsOne:1.2.2"){transitive = false} - implementation("me.ryanhamshire:GriefPrevention:11.5.2"){transitive = false} - implementation("com.massivecraft:mcore:7.0.1"){transitive = false} - implementation("net.sacredlabyrinth.Phaed:PreciousStones:10.0.4-SNAPSHOT"){transitive = false} - implementation("net.jzx7:regios:5.9.9"){transitive = false} - implementation("com.bekvon.bukkit.residence:Residence:4.5._13.1"){transitive = false} - implementation("com.palmergames.bukkit:towny:0.84.0.9"){transitive = false} - implementation("com.thevoxelbox.voxelsniper:voxelsniper:5.171.0"){transitive = false} - implementation("com.comphenix.protocol:ProtocolLib-API:4.4.0-SNAPSHOT"){transitive = false} - implementation("com.wasteofplastic:askyblock:3.0.8.2"){transitive = false} -} - -shadowJar { - dependencies { - relocate "org.slf4j", "com.sk89q.worldedit.slf4j" - relocate "org.apache.logging.slf4j", "com.sk89q.worldedit.log4jbridge" - include(dependency(":worldedit-core")) - include(dependency(":worldedit-libs:core")) - include(dependency(":worldedit-libs:bukkit")) - include(dependency("org.slf4j:slf4j-api")) - include(dependency("org.apache.logging.log4j:log4j-slf4j-impl")) - relocate("it.unimi.dsi.fastutil", "com.sk89q.worldedit.bukkit.fastutil") { - include("it.unimi.dsi:fastutil") - } - } - archiveName = "${parent.name}-${project.name.replaceAll("worldedit-", "")}-${parent.version}.jar" - destinationDir = file "../target" -} - -processResources { - from("src/main/resources") { - expand( - name: project.parent.name, - version: project.parent.version - ) - include "plugin.yml" - } -} - -jar.archiveName="fawe-bukkit-${project.parent.version}.jar" -jar.destinationDir = file "../mvn/com/boydti/fawe-bukkit/" + project.parent.version -task createPom { - doLast { - pom { - project { - groupId "com.boydti" - artifactId "fawe-bukkit" - version project.parent.version - } - } - .getEffectivePom() - .setDependencies(new ArrayList<>()) - .writeTo("../mvn/com/boydti/fawe-bukkit/${project.parent.version}/fawe-bukkit-${project.parent.version}.pom") - pom { - project { - groupId "com.boydti" - artifactId "fawe-bukkit" - version "latest" - } - } - .getEffectivePom() - .setDependencies(new ArrayList<>()) - .writeTo("../mvn/com/boydti/fawe-bukkit/latest/fawe-bukkit-latest.pom") - } -} -task copyFiles { - doLast { - copy { - from "../mvn/com/boydti/fawe-bukkit/${project.parent.version}/" - into "../mvn/com/boydti/fawe-bukkit/latest/" - include("*.jar") - rename ("fawe-bukkit-${project.parent.version}.jar", "fawe-bukkit-latest.jar") - } - } -} -build.dependsOn(shadowJar) -build.finalizedBy(copyFiles) -copyFiles.dependsOn(createPom) diff --git a/worldedit-bukkit/build.gradle.kts b/worldedit-bukkit/build.gradle.kts new file mode 100644 index 000000000..0efa9d67b --- /dev/null +++ b/worldedit-bukkit/build.gradle.kts @@ -0,0 +1,98 @@ +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar + +plugins { + `java-library` +} + +applyPlatformAndCoreConfiguration() +applyShadowConfiguration() + +repositories { + maven { url = uri("https://hub.spigotmc.org/nexus/content/groups/public") } + maven { url = uri("https://repo.codemc.org/repository/maven-public") } + maven { url = uri("https://papermc.io/repo/repository/maven-public/") } + maven { url = uri("http://empcraft.com/maven2") } + maven { url = uri("http://ci.frostcast.net/plugin/repository/everything") } + maven { url = uri("http://dl.bintray.com/tastybento/maven-repo") } + maven { url = uri("http://ci.emc.gs/nexus/content/groups/aikar/") } + maven { url = uri("https://libraries.minecraft.net") } + maven { url = uri("https://repo.destroystokyo.com/repository/maven-public//") } + maven { url = uri("http://repo.dmulloy2.net/content/groups/public/") } +} + +configurations.all { + resolutionStrategy { + force("com.google.guava:guava:21.0") + } +} + +dependencies { + "compile"("net.milkbowl.vault:VaultAPI:1.7") + "api"(project(":worldedit-core")) + "api"(project(":worldedit-libs:bukkit")) + "api"("org.bukkit:bukkit:1.13.2-R0.1-SNAPSHOT") { + exclude("junit", "junit") + } + "compile"("it.unimi.dsi:fastutil:8.2.1") + "compileOnly"("com.destroystokyo.paper:paper-api:1.13.2-R0.1-SNAPSHOT") + "compile"("com.destroystokyo.paper:paper-api:1.14.4-R0.1-SNAPSHOT") + "compileOnly"("BuildTools:spigot-1.14.4:lastSuccessfulBuild@jar") + "implementation"("io.papermc:paperlib:1.0.2") + "compileOnly"("com.sk89q:dummypermscompat:1.10") + "implementation"("org.apache.logging.log4j:log4j-slf4j-impl:2.8.1") + "implementation"("org.bstats:bstats-bukkit:1.5") + "testCompile"("org.mockito:mockito-core:1.9.0-rc1") + "implementation"("com.sk89q.worldguard:worldguard-core:7.0.0-20190215.210421-39") + "implementation"("com.sk89q.worldguard:worldguard-legacy:7.0.0-20190215.210421-39") + "implementation"("com.massivecraft:factions:2.8.0") + "implementation"("com.drtshock:factions:1.6.9.5") + "implementation"("com.factionsone:FactionsOne:1.2.2") + "implementation"("me.ryanhamshire:GriefPrevention:11.5.2") + "implementation"("com.massivecraft:mcore:7.0.1") + "implementation"("net.sacredlabyrinth.Phaed:PreciousStones:10.0.4-SNAPSHOT") + "implementation"("net.jzx7:regios:5.9.9") + "implementation"("com.bekvon.bukkit.residence:Residence:4.5._13.1") + "implementation"("com.palmergames.bukkit:towny:0.84.0.9") + "implementation"("com.thevoxelbox.voxelsniper:voxelsniper:5.171.0") + "implementation"("com.comphenix.protocol:ProtocolLib-API:4.4.0-SNAPSHOT") + "implementation"("com.wasteofplastic:askyblock:3.0.8.2") +} + +tasks.named("processResources") { + filesMatching("plugin.yml") { + expand("name" to (project.parent?.name ?: "FAWE")) + expand("version" to (project.parent?.version ?: "UNKNOWN")) + } +} + +tasks.named("jar") { + manifest { + attributes("Class-Path" to "truezip.jar WorldEdit/truezip.jar js.jar WorldEdit/js.jar", + "WorldEdit-Version" to project.version) + } +} + +tasks.named("shadowJar") { + dependencies { + relocate("org.slf4j", "com.sk89q.worldedit.slf4j") + relocate("org.apache.logging.slf4j", "com.sk89q.worldedit.log4jbridge") + include(dependency(":worldedit-core")) + include(dependency(":worldedit-libs:core")) + include(dependency(":worldedit-libs:bukkit")) + include(dependency("org.slf4j:slf4j-api")) + include(dependency("org.apache.logging.log4j:log4j-slf4j-impl")) + relocate("org.bstats", "com.sk89q.worldedit.bukkit.bstats") { + include(dependency("org.bstats:bstats-bukkit:1.5")) + } + relocate("io.papermc.lib", "com.sk89q.worldedit.bukkit.paperlib") { + include(dependency("io.papermc:paperlib:1.0.2")) + } + relocate("it.unimi.dsi.fastutil", "com.sk89q.worldedit.bukkit.fastutil") { + include(dependency("it.unimi.dsi:fastutil")) + } + } +} + +tasks.named("assemble").configure { + dependsOn("shadowJar") +} diff --git a/worldedit-core/build.gradle b/worldedit-core/build.gradle deleted file mode 100644 index 34a27d0e2..000000000 --- a/worldedit-core/build.gradle +++ /dev/null @@ -1,129 +0,0 @@ -plugins { - id("java-library") - id("eclipse") - id("idea") - id("net.ltgt.apt") version "0.21" apply false - id "net.ltgt.apt-eclipse" version "0.21" - id "net.ltgt.apt-idea" version "0.21" -} - -repositories { - maven {url "http://ci.athion.net/job/PlotSquared-Breaking/ws/mvn/"} -} - -configurations.all { Configuration it -> - it.resolutionStrategy { ResolutionStrategy rs -> - rs.force("com.google.guava:guava:21.0") - } - it.resolutionStrategy { ResolutionStrategy rs -> - rs.force("it.unimi.dsi:fastutil:8.2.1") - } -} - -dependencies { - compile project(":worldedit-libs:core") - compile "de.schlichtherle:truezip:6.8.3" - compile "rhino:js:1.7R2" - compile "org.yaml:snakeyaml:1.23" - compile "com.google.guava:guava:21.0" - compile "com.google.code.findbugs:jsr305:1.3.9" - compile "com.thoughtworks.paranamer:paranamer:2.6" - compile "com.google.code.gson:gson:2.8.0" - compile "com.googlecode.json-simple:json-simple:1.1.1" - compile "org.slf4j:slf4j-api:1.7.26" - compile "it.unimi.dsi:fastutil:8.2.1" - - compileOnly project(":worldedit-libs:core:ap") - annotationProcessor project(":worldedit-libs:core:ap") - annotationProcessor "com.google.guava:guava:21.0" - def avVersion = "1.6.5" - compileOnly "com.google.auto.value:auto-value-annotations:$avVersion" - annotationProcessor "com.google.auto.value:auto-value:$avVersion" - //compile "net.sf.trove4j:trove4j:3.0.3" - testCompile "org.mockito:mockito-core:1.9.0-rc1" - - // Fawe depends - compileOnly "net.fabiozumbi12:redprotect:1.9.6" - compileOnly ("com.github.intellectualsites.plotsquared:PlotSquared-API:latest") { - transitive = false - } - compile "com.mojang:datafixerupper:1.0.20" - compile "com.github.luben:zstd-jni:1.1.1" - compile "co.aikar:fastutil-lite:1.0" - testImplementation ("org.junit.jupiter:junit-jupiter-api:5.5.0") - testImplementation ("org.junit.jupiter:junit-jupiter-params:5.5.0") - testImplementation ("org.mockito:mockito-core:3.0.0") - testImplementation ("org.mockito:mockito-junit-jupiter:3.0.0") - testRuntime ("org.junit.jupiter:junit-jupiter-engine:5.5.0") -} - -tasks.withType(JavaCompile).configureEach { - dependsOn(":worldedit-libs:build") - it.options.compilerArgs << "-Xmaxerrs" << "10000" - it.options.compilerArgs.add("-Aarg.name.key.prefix=") -} - -sourceSets { - main { - java { - srcDir "src/main/java" - srcDir "src/legacy/java" - } - resources { - srcDir "src/main/resources" - } - } -} - -processResources { - from("src/main/resources") { - include "fawe.properties" - expand( - version: "${project.parent.version}", - name: project.parent.name, - commit: "${git.head().abbreviatedId}", - date: "${git.head().getDate().format("yy.MM.dd")}" -) - } -} - -jar.archiveName="fawe-api-${project.parent.version}.jar" -jar.destinationDir = file "../mvn/com/boydti/fawe-api/" + project.parent.version -task createPom { - doLast { - pom { - project { - groupId "com.boydti" - artifactId "fawe-api" - version project.parent.version - } - } - .getEffectivePom() - .setDependencies(new ArrayList<>()) - .writeTo("../mvn/com/boydti/fawe-api/${project.parent.version}/fawe-api-${project.parent.version}.pom") - pom { - project { - groupId "com.boydti" - artifactId "fawe-api" - version "latest" - } - } - .getEffectivePom() - .setDependencies(new ArrayList<>()) - .writeTo("../mvn/com/boydti/fawe-api/latest/fawe-api-latest.pom") - } -} -task copyFiles { - doLast { - copy { - from "../mvn/com/boydti/fawe-api/${project.parent.version}/" - into "../mvn/com/boydti/fawe-api/latest/" - include("*.jar") - rename ("fawe-api-${project.parent.version}.jar", "fawe-api-latest.jar") - } - } -} - -build.dependsOn(shadowJar) -build.finalizedBy(copyFiles) -copyFiles.dependsOn(createPom) diff --git a/worldedit-core/build.gradle.kts b/worldedit-core/build.gradle.kts new file mode 100644 index 000000000..c27900398 --- /dev/null +++ b/worldedit-core/build.gradle.kts @@ -0,0 +1,67 @@ +plugins { + id("java-library") + id("net.ltgt.apt-eclipse") + id("net.ltgt.apt-idea") +} + +applyPlatformAndCoreConfiguration() + +configurations.all { + resolutionStrategy { + force("com.google.guava:guava:21.0") + } +} + +dependencies { + "compile"(project(":worldedit-libs:core")) + "compile"("de.schlichtherle:truezip:6.8.3") + "compile"("rhino:js:1.7R2") + "compile"("org.yaml:snakeyaml:1.23") + "compile"("com.google.guava:guava:21.0") + "compile"("com.google.code.findbugs:jsr305:1.3.9") + "compile"("com.google.code.gson:gson:2.8.0") + "compile"("org.slf4j:slf4j-api:1.7.26") + "compile"("it.unimi.dsi:fastutil:8.2.1") + "compile"("com.googlecode.json-simple:json-simple:1.1.1") + + + "compileOnly"(project(":worldedit-libs:core:ap")) + "annotationProcessor"(project(":worldedit-libs:core:ap")) + // ensure this is on the classpath for the AP + "annotationProcessor"("com.google.guava:guava:21.0") + "compileOnly"("com.google.auto.value:auto-value-annotations:${Versions.AUTO_VALUE}") + "annotationProcessor"("com.google.auto.value:auto-value:${Versions.AUTO_VALUE}") + "compile"("co.aikar:fastutil-lite:1.0") + "compile"("com.github.luben:zstd-jni:1.1.1") + "compile"("com.mojang:datafixerupper:1.0.20") + "compileOnly"("com.github.intellectualsites.plotsquared:PlotSquared-API:latest") { + isTransitive = false + } + "compileOnly"("net.fabiozumbi12:redprotect:1.9.6") +} + +tasks.withType().configureEach { + dependsOn(":worldedit-libs:build") + options.compilerArgs.add("-Aarg.name.key.prefix=") +} + +sourceSets { + main { + java { + srcDir("src/main/java") + srcDir("src/legacy/java") + } + resources { + srcDir("src/main/resources") + } + } +} + +tasks.named("processResources") { + filesMatching("fawe.properties") { + expand("version" to (project.parent?.version ?: "UNKNOWN")) + expand("name" to (project.parent?.name ?: "FAWE")) + expand("commit" to "TODO GIT") + expand("date" to "TODO Date") + } +} diff --git a/worldedit-core/src/main/java/com/boydti/fawe/util/DocumentationPrinter.java b/worldedit-core/src/main/java/com/boydti/fawe/util/DocumentationPrinter.java index d4537cbc3..cd679e35c 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/util/DocumentationPrinter.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/util/DocumentationPrinter.java @@ -34,9 +34,9 @@ import com.sk89q.worldedit.command.ChunkCommands; import com.sk89q.worldedit.command.ClipboardCommands; import com.sk89q.worldedit.command.GenerationCommands; import com.sk89q.worldedit.command.HistoryCommands; -import com.sk89q.worldedit.command.MaskCommands; +//import com.sk89q.worldedit.command.MaskCommands; import com.sk89q.worldedit.command.NavigationCommands; -import com.sk89q.worldedit.command.PatternCommands; +//import com.sk89q.worldedit.command.PatternCommands; import com.sk89q.worldedit.command.RegionCommands; import com.sk89q.worldedit.command.SchematicCommands; import com.sk89q.worldedit.command.ScriptingCommands; @@ -45,7 +45,7 @@ import com.sk89q.worldedit.command.SnapshotCommands; import com.sk89q.worldedit.command.SnapshotUtilCommands; import com.sk89q.worldedit.command.SuperPickaxeCommands; import com.sk89q.worldedit.command.ToolCommands; -import com.sk89q.worldedit.command.TransformCommands; +//import com.sk89q.worldedit.command.TransformCommands; import com.sk89q.worldedit.command.UtilityCommands; import com.sk89q.worldedit.command.WorldEditCommands; import org.enginehub.piston.annotation.param.Arg; @@ -127,9 +127,9 @@ public final class DocumentationPrinter { writePermissionsWikiTable(stream, builder, "/", BrushOptionsCommands.class); writePermissionsWikiTable(stream, builder, "/tool ", ToolCommands.class); writePermissionsWikiTable(stream, builder, "/brush ", BrushCommands.class); - writePermissionsWikiTable(stream, builder, "", MaskCommands.class, "/Masks"); - writePermissionsWikiTable(stream, builder, "", PatternCommands.class, "/Patterns"); - writePermissionsWikiTable(stream, builder, "", TransformCommands.class, "/Transforms"); + //writePermissionsWikiTable(stream, builder, "", MaskCommands.class, "/Masks"); + //writePermissionsWikiTable(stream, builder, "", PatternCommands.class, "/Patterns"); + //writePermissionsWikiTable(stream, builder, "", TransformCommands.class, "/Transforms"); writePermissionsWikiTable(stream, builder, "/cfi ", CFICommands.class, "Create From Image"); stream.println(); stream.print("#### Uncategorized\n"); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/MaskCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/MaskCommands.java index c4e78042a..5fcae45ed 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/MaskCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/MaskCommands.java @@ -1,448 +1,448 @@ -package com.sk89q.worldedit.command; - -import com.boydti.fawe.object.mask.AdjacentAnyMask; -import com.boydti.fawe.object.mask.AdjacentMask; -import com.boydti.fawe.object.mask.AngleMask; -import com.boydti.fawe.object.mask.BiomeMask; -import com.boydti.fawe.object.mask.BlockLightMask; -import com.boydti.fawe.object.mask.BrightnessMask; -import com.boydti.fawe.object.mask.DataMask; -import com.boydti.fawe.object.mask.ExtremaMask; -import com.boydti.fawe.object.mask.IdDataMask; -import com.boydti.fawe.object.mask.IdMask; -import com.boydti.fawe.object.mask.LightMask; -import com.boydti.fawe.object.mask.OpacityMask; -import com.boydti.fawe.object.mask.ROCAngleMask; -import com.boydti.fawe.object.mask.RadiusMask; -import com.boydti.fawe.object.mask.RandomMask; -import com.boydti.fawe.object.mask.SimplexMask; -import com.boydti.fawe.object.mask.SkyLightMask; -import com.boydti.fawe.object.mask.SurfaceMask; -import com.boydti.fawe.object.mask.WallMask; -import com.boydti.fawe.object.mask.XAxisMask; -import com.boydti.fawe.object.mask.YAxisMask; -import com.boydti.fawe.object.mask.ZAxisMask; -import com.sk89q.worldedit.IncompleteRegionException; -import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator; -import com.sk89q.worldedit.entity.Player; -import com.sk89q.worldedit.extent.Extent; -import com.sk89q.worldedit.function.mask.BlockMaskBuilder; -import com.sk89q.worldedit.function.mask.ExistingBlockMask; -import com.sk89q.worldedit.function.mask.ExpressionMask; -import com.sk89q.worldedit.function.mask.Mask; -import com.sk89q.worldedit.function.mask.MaskIntersection; -import com.sk89q.worldedit.function.mask.MaskUnion; -import com.sk89q.worldedit.function.mask.Masks; -import com.sk89q.worldedit.function.mask.OffsetMask; -import com.sk89q.worldedit.function.mask.RegionMask; -import com.sk89q.worldedit.function.mask.SolidBlockMask; -import com.sk89q.worldedit.internal.expression.Expression; -import com.sk89q.worldedit.internal.expression.ExpressionException; -import com.sk89q.worldedit.internal.expression.runtime.ExpressionEnvironment; -import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.Vector3; -import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment; -import com.sk89q.worldedit.session.request.RequestSelection; -import com.sk89q.worldedit.world.biome.BiomeType; -import org.enginehub.piston.annotation.Command; -import org.enginehub.piston.annotation.CommandContainer; -import org.enginehub.piston.annotation.param.Arg; -import org.enginehub.piston.annotation.param.Switch; - -//@Command(aliases = {"masks"}, -// desc = "Help for the various masks. [More Info](https://git.io/v9r4K)", -// descFooter = "Masks determine if a block can be placed\n" + -// " - Use [brackets] for arguments\n" + -// " - Use , to OR multiple\n" + -// " - Use & to AND multiple\n" + -// "e.g. >[stone,dirt],#light[0][5],$jungle\n" + -// "More Info: https://git.io/v9r4K" +//package com.sk89q.worldedit.command; +// +//import com.boydti.fawe.object.mask.AdjacentAnyMask; +//import com.boydti.fawe.object.mask.AdjacentMask; +//import com.boydti.fawe.object.mask.AngleMask; +//import com.boydti.fawe.object.mask.BiomeMask; +//import com.boydti.fawe.object.mask.BlockLightMask; +//import com.boydti.fawe.object.mask.BrightnessMask; +//import com.boydti.fawe.object.mask.DataMask; +//import com.boydti.fawe.object.mask.ExtremaMask; +//import com.boydti.fawe.object.mask.IdDataMask; +//import com.boydti.fawe.object.mask.IdMask; +//import com.boydti.fawe.object.mask.LightMask; +//import com.boydti.fawe.object.mask.OpacityMask; +//import com.boydti.fawe.object.mask.ROCAngleMask; +//import com.boydti.fawe.object.mask.RadiusMask; +//import com.boydti.fawe.object.mask.RandomMask; +//import com.boydti.fawe.object.mask.SimplexMask; +//import com.boydti.fawe.object.mask.SkyLightMask; +//import com.boydti.fawe.object.mask.SurfaceMask; +//import com.boydti.fawe.object.mask.WallMask; +//import com.boydti.fawe.object.mask.XAxisMask; +//import com.boydti.fawe.object.mask.YAxisMask; +//import com.boydti.fawe.object.mask.ZAxisMask; +//import com.sk89q.worldedit.IncompleteRegionException; +//import com.sk89q.worldedit.LocalSession; +//import com.sk89q.worldedit.WorldEdit; +//import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator; +//import com.sk89q.worldedit.entity.Player; +//import com.sk89q.worldedit.extent.Extent; +//import com.sk89q.worldedit.function.mask.BlockMaskBuilder; +//import com.sk89q.worldedit.function.mask.ExistingBlockMask; +//import com.sk89q.worldedit.function.mask.ExpressionMask; +//import com.sk89q.worldedit.function.mask.Mask; +//import com.sk89q.worldedit.function.mask.MaskIntersection; +//import com.sk89q.worldedit.function.mask.MaskUnion; +//import com.sk89q.worldedit.function.mask.Masks; +//import com.sk89q.worldedit.function.mask.OffsetMask; +//import com.sk89q.worldedit.function.mask.RegionMask; +//import com.sk89q.worldedit.function.mask.SolidBlockMask; +//import com.sk89q.worldedit.internal.expression.Expression; +//import com.sk89q.worldedit.internal.expression.ExpressionException; +//import com.sk89q.worldedit.internal.expression.runtime.ExpressionEnvironment; +//import com.sk89q.worldedit.math.BlockVector3; +//import com.sk89q.worldedit.math.Vector3; +//import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment; +//import com.sk89q.worldedit.session.request.RequestSelection; +//import com.sk89q.worldedit.world.biome.BiomeType; +//import org.enginehub.piston.annotation.Command; +//import org.enginehub.piston.annotation.CommandContainer; +//import org.enginehub.piston.annotation.param.Arg; +//import org.enginehub.piston.annotation.param.Switch; +// +////@Command(aliases = {"masks"}, +//// desc = "Help for the various masks. [More Info](https://git.io/v9r4K)", +//// descFooter = "Masks determine if a block can be placed\n" + +//// " - Use [brackets] for arguments\n" + +//// " - Use , to OR multiple\n" + +//// " - Use & to AND multiple\n" + +//// "e.g. >[stone,dirt],#light[0][5],$jungle\n" + +//// "More Info: https://git.io/v9r4K" +////) +//@CommandContainer//(superTypes = CommandPermissionsConditionGenerator.Registration.class) +//public class MaskCommands { +// private final WorldEdit worldEdit; +// +// public MaskCommands(WorldEdit worldEdit) { +// this.worldEdit = worldEdit; +// } +// +// @Command( +// name = "#simplex", +// desc = "Use simplex noise as the mask" +// ) +// public Mask simplex(double scale, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) { +// scale = 1d / Math.max(1, scale); +// minInt = (minInt - 50) / 50; +// maxInt = (maxInt - 50) / 50; +// return new SimplexMask(scale, minInt, maxInt); +// } +// +// @Command( +// name = "#light", +// desc = "Restrict to specific light levels" +// ) +// public Mask light(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) { +// return new LightMask(extent, (int) minInt, (int) maxInt); +// } +// +// @Command( +// name = "#false", +// desc = "Always false" +// ) +// public Mask falseMask(Extent extent) { +// return Masks.alwaysFalse(); +// } +// +// @Command( +// name = "#true", +// desc = "Always true" +// ) +// public Mask trueMask(Extent extent) { +// return Masks.alwaysTrue(); +// } +// +// @Command( +// name = "#skylight", +// desc = "Restrict to specific sky light levels" +// ) +// public Mask skylight(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) { +// return new SkyLightMask(extent, (int) minInt, (int) maxInt); +// } +// +// @Command( +// name = "#blocklight", +// aliases = {"#emittedlight"}, +// desc = "Restrict to specific block light levels" +// ) +// public Mask blocklight(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) { +// return new BlockLightMask(extent, (int) minInt, (int) maxInt); +// } +// +// @Command( +// name = "#opacity", +// desc = "Restrict to specific opacity levels" +// ) +// public Mask opacity(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) { +// return new OpacityMask(extent, (int) minInt, (int) maxInt); +// } +// +// @Command( +// name = "#brightness", +// desc = "Restrict to specific block brightness" +// ) +// public Mask brightness(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) { +// return new BrightnessMask(extent, (int) minInt, (int) maxInt); +// } +// +// @Command( +// name = "#offset", +// desc = "Offset a mask" +// ) +// public Mask offset(double x, double y, double z, Mask mask) { +// return new OffsetMask(mask, BlockVector3.at(x, y, z)); +// } +// +// @Command( +// name = "#haslight", +// desc = "Restricts to blocks with light (sky or emitted)" +// ) +// public Mask haslight(Extent extent) { +// return new LightMask(extent, 1, Integer.MAX_VALUE); +// } +// +// @Command( +// name = "#nolight", +// desc = "Restrict to blocks without light (sky or emitted)" +// ) +// public Mask nolight(Extent extent) { +// return new LightMask(extent, 0, 0); +// } +// +// @Command( +// name = "#existing", +// desc = "If there is a non air block" +// ) +// public Mask existing(Extent extent) { +// return new ExistingBlockMask(extent); +// } +// +// @Command( +// name = "#solid", +// desc = "If there is a solid block" +// ) +// public Mask solid(Extent extent) { +// return new SolidBlockMask(extent); +// } +// +// @Command( +// name = "#liquid", +// desc = "If there is a solid block" +// ) +// public Mask liquid(Extent extent) { +// return new BlockMaskBuilder().addAll(b -> b.getMaterial().isLiquid()).build(extent); +// } +// +// @Command( +// name = "#dregion", +// aliases = {"#dselection", "#dsel"}, +// desc = "inside the player's selection" +// ) +// public Mask dregion() { +// return new RegionMask(new RequestSelection()); +// } +// +// @Command( +// name = "#region", +// aliases = {"#selection", "#sel"}, +// desc = "inside the provided selection" +// ) +// public Mask selection(Player player, LocalSession session) throws IncompleteRegionException { +// return new RegionMask(session.getSelection(player.getWorld()).clone()); +// } +// +// @Command( +// name = "#xaxis", +// desc = "Restrict to initial x axis" +// ) +// public Mask xaxis() { +// return new XAxisMask(); +// } +// +// @Command( +// name = "#yaxis", +// desc = "Restrict to initial y axis" +// ) +// public Mask yaxis() { +// return new YAxisMask(); +// } +// +// @Command( +// name = "#zaxis", +// desc = "Restrict to initial z axis" +// ) +// public Mask zaxis() { +// return new ZAxisMask(); +// } +// +// @Command( +// name = "#id", +// desc = "Restrict to initial id" +// ) +// public Mask id(Extent extent) { +// return new IdMask(extent); +// } +// +// @Command( +// name = "#data", +// desc = "Restrict to initial data" +// ) +// public Mask data(Extent extent) { +// return new DataMask(extent); +// } +// +// @Command( +// name = "#iddata", +// desc = "Restrict to initial block id and data" +// ) +// public Mask iddata(Extent extent) { +// return new IdDataMask(extent); +// } +// +// @Command( +// name = "#air", +// desc = "Restrict to types of air" +// ) +// public Mask air(Extent extent) { +// return new BlockMaskBuilder().addAll(b -> b.getMaterial().isAir()).build(extent); +// } +// +// @Command( +// name = "#wall", +// desc = "Restrict to walls (any block n,e,s,w of air)" +// ) +// public Mask wall(Extent extent) { +// Mask blockMask = air(extent); +// return new MaskUnion(new ExistingBlockMask(extent), new WallMask(blockMask, 1, 8)); +// } +// +// @Command( +// name = "#surface", +// desc = "Restrict to surfaces (any solid block touching air)" +// ) +// public Mask surface(Extent extent) { +// return new SurfaceMask(extent); +// } +// +// @Command( +// name = "\\", +// aliases = {"/", "#angle", "#\\", "#/"}, +// desc = "Restrict to specific terrain angle", +// descFooter = "Restrict to specific terrain angle\n" + +// "The -o flag will only overlay\n" + +// "Example: /[0d][45d]\n" + +// "Explanation: Allows any block where the adjacent block is between 0 and 45 degrees.\n" + +// "Example: /[3][20]\n" + +// "Explanation: Allows any block where the adjacent block is between 3 and 20 blocks below" //) -@CommandContainer//(superTypes = CommandPermissionsConditionGenerator.Registration.class) -public class MaskCommands { - private final WorldEdit worldEdit; - - public MaskCommands(WorldEdit worldEdit) { - this.worldEdit = worldEdit; - } - - @Command( - name = "#simplex", - desc = "Use simplex noise as the mask" -) - public Mask simplex(double scale, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) { - scale = 1d / Math.max(1, scale); - minInt = (minInt - 50) / 50; - maxInt = (maxInt - 50) / 50; - return new SimplexMask(scale, minInt, maxInt); - } - - @Command( - name = "#light", - desc = "Restrict to specific light levels" -) - public Mask light(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) { - return new LightMask(extent, (int) minInt, (int) maxInt); - } - - @Command( - name = "#false", - desc = "Always false" - ) - public Mask falseMask(Extent extent) { - return Masks.alwaysFalse(); - } - - @Command( - name = "#true", - desc = "Always true" - ) - public Mask trueMask(Extent extent) { - return Masks.alwaysTrue(); - } - - @Command( - name = "#skylight", - desc = "Restrict to specific sky light levels" - ) - public Mask skylight(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) { - return new SkyLightMask(extent, (int) minInt, (int) maxInt); - } - - @Command( - name = "#blocklight", - aliases = {"#emittedlight"}, - desc = "Restrict to specific block light levels" -) - public Mask blocklight(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) { - return new BlockLightMask(extent, (int) minInt, (int) maxInt); - } - - @Command( - name = "#opacity", - desc = "Restrict to specific opacity levels" -) - public Mask opacity(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) { - return new OpacityMask(extent, (int) minInt, (int) maxInt); - } - - @Command( - name = "#brightness", - desc = "Restrict to specific block brightness" -) - public Mask brightness(Extent extent, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) { - return new BrightnessMask(extent, (int) minInt, (int) maxInt); - } - - @Command( - name = "#offset", - desc = "Offset a mask" -) - public Mask offset(double x, double y, double z, Mask mask) { - return new OffsetMask(mask, BlockVector3.at(x, y, z)); - } - - @Command( - name = "#haslight", - desc = "Restricts to blocks with light (sky or emitted)" - ) - public Mask haslight(Extent extent) { - return new LightMask(extent, 1, Integer.MAX_VALUE); - } - - @Command( - name = "#nolight", - desc = "Restrict to blocks without light (sky or emitted)" - ) - public Mask nolight(Extent extent) { - return new LightMask(extent, 0, 0); - } - - @Command( - name = "#existing", - desc = "If there is a non air block" - ) - public Mask existing(Extent extent) { - return new ExistingBlockMask(extent); - } - - @Command( - name = "#solid", - desc = "If there is a solid block" - ) - public Mask solid(Extent extent) { - return new SolidBlockMask(extent); - } - - @Command( - name = "#liquid", - desc = "If there is a solid block" - ) - public Mask liquid(Extent extent) { - return new BlockMaskBuilder().addAll(b -> b.getMaterial().isLiquid()).build(extent); - } - - @Command( - name = "#dregion", - aliases = {"#dselection", "#dsel"}, - desc = "inside the player's selection" - ) - public Mask dregion() { - return new RegionMask(new RequestSelection()); - } - - @Command( - name = "#region", - aliases = {"#selection", "#sel"}, - desc = "inside the provided selection" - ) - public Mask selection(Player player, LocalSession session) throws IncompleteRegionException { - return new RegionMask(session.getSelection(player.getWorld()).clone()); - } - - @Command( - name = "#xaxis", - desc = "Restrict to initial x axis" - ) - public Mask xaxis() { - return new XAxisMask(); - } - - @Command( - name = "#yaxis", - desc = "Restrict to initial y axis" - ) - public Mask yaxis() { - return new YAxisMask(); - } - - @Command( - name = "#zaxis", - desc = "Restrict to initial z axis" - ) - public Mask zaxis() { - return new ZAxisMask(); - } - - @Command( - name = "#id", - desc = "Restrict to initial id" - ) - public Mask id(Extent extent) { - return new IdMask(extent); - } - - @Command( - name = "#data", - desc = "Restrict to initial data" - ) - public Mask data(Extent extent) { - return new DataMask(extent); - } - - @Command( - name = "#iddata", - desc = "Restrict to initial block id and data" - ) - public Mask iddata(Extent extent) { - return new IdDataMask(extent); - } - - @Command( - name = "#air", - desc = "Restrict to types of air" - ) - public Mask air(Extent extent) { - return new BlockMaskBuilder().addAll(b -> b.getMaterial().isAir()).build(extent); - } - - @Command( - name = "#wall", - desc = "Restrict to walls (any block n,e,s,w of air)" - ) - public Mask wall(Extent extent) { - Mask blockMask = air(extent); - return new MaskUnion(new ExistingBlockMask(extent), new WallMask(blockMask, 1, 8)); - } - - @Command( - name = "#surface", - desc = "Restrict to surfaces (any solid block touching air)" - ) - public Mask surface(Extent extent) { - return new SurfaceMask(extent); - } - - @Command( - name = "\\", - aliases = {"/", "#angle", "#\\", "#/"}, - desc = "Restrict to specific terrain angle", - descFooter = "Restrict to specific terrain angle\n" + - "The -o flag will only overlay\n" + - "Example: /[0d][45d]\n" + - "Explanation: Allows any block where the adjacent block is between 0 and 45 degrees.\n" + - "Example: /[3][20]\n" + - "Explanation: Allows any block where the adjacent block is between 3 and 20 blocks below" -) - public Mask angle(Extent extent, @Arg(name="min", desc = "min angle") String minStr, @Arg(name="max", desc = "max angle") String maxStr, @Switch(name = 'o', desc = "TODO") boolean overlay, @Arg(name = "distance", desc = "int", def = "1") int distanceOpt) throws ExpressionException { - double y1, y2; - boolean override; - if (maxStr.endsWith("d")) { - double y1d = Expression.compile(minStr.substring(0, minStr.length() - 1)).evaluate(); - double y2d = Expression.compile(maxStr.substring(0, maxStr.length() - 1)).evaluate(); - y1 = Math.tan(y1d * (Math.PI / 180)); - y2 = Math.tan(y2d * (Math.PI / 180)); - } else { - y1 = Expression.compile(minStr).evaluate(); - y2 = Expression.compile(maxStr).evaluate(); - } - return new AngleMask(extent, y1, y2, overlay, distanceOpt); - } - - @Command( - name = "(", - aliases = {")", "#roc", "#(", "#)"}, - desc = "Restrict to near specific terrain slope rate of change", - descFooter = "Restrict to near specific terrain slope rate of change\n" + - "The -o flag will only overlay\n" + - "Example: ([0d][45d][5]\n" + - "Explanation: Restrict near where the angle changes between 0-45 degrees within 5 blocks\n" + - "Note: Use negatives for decreasing slope" -) - public Mask roc(Extent extent, @Arg(name="min", desc = "min angle") String minStr, @Arg(name="max", desc = "max angle") String maxStr, @Switch(name = 'o', desc = "TODO") boolean overlay, @Arg(name = "distance", desc = "int", def = "4") int distanceOpt) throws ExpressionException { - double y1, y2; - boolean override; - if (maxStr.endsWith("d")) { - double y1d = Expression.compile(minStr.substring(0, minStr.length() - 1)).evaluate(); - double y2d = Expression.compile(maxStr.substring(0, maxStr.length() - 1)).evaluate(); - y1 = Math.tan(y1d * (Math.PI / 180)); - y2 = Math.tan(y2d * (Math.PI / 180)); - } else { - y1 = Expression.compile(minStr).evaluate(); - y2 = Expression.compile(maxStr).evaluate(); - } - return new ROCAngleMask(extent, y1, y2, overlay, distanceOpt); - } - - @Command( - name = "^", - aliases = {"#extrema", "#^"}, - desc = "Restrict to near specific terrain extrema", - descFooter = "Restrict to near specific terrain extrema\n" + - "The -o flag will only overlay\n" + - "Example: ([0d][45d][5]\n" + - "Explanation: Restrict to near 45 degrees of local maxima\n" + - "Note: Use negatives for local minima" -) - public Mask extrema(Extent extent, @Arg(name="min", desc = "min angle") String minStr, @Arg(name="max", desc = "max angle") String maxStr, @Switch(name = 'o', desc = "TODO") boolean overlay, @Arg(name = "distance", desc = "int", def = "4") int distanceOpt) throws ExpressionException { - double y1, y2; - boolean override; - if (maxStr.endsWith("d")) { - double y1d = Expression.compile(minStr.substring(0, minStr.length() - 1)).evaluate(); - double y2d = Expression.compile(maxStr.substring(0, maxStr.length() - 1)).evaluate(); - y1 = Math.tan(y1d * (Math.PI / 180)); - y2 = Math.tan(y2d * (Math.PI / 180)); - } else { - y1 = Expression.compile(minStr).evaluate(); - y2 = Expression.compile(maxStr).evaluate(); - } - return new ExtremaMask(extent, y1, y2, overlay, distanceOpt); - } - - @Command( - name = "{", - aliases = {"#{"}, - desc = "Restricts blocks to within a specific radius range of the initial block" -) - public Mask radius(@Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) throws ExpressionException { - return new RadiusMask((int) minInt, (int) maxInt); - } - - @Command( - name = "|", - aliases = {"#|", "#side"}, - desc = "sides with a specific number of other blocks" -) - public Mask wall(Mask mask, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) throws ExpressionException { - return new WallMask(mask, (int) minInt, (int) maxInt); - } - - @Command( - name = "~", - aliases = {"#~", "#adjacent"}, - desc = "Adjacent to a specific number of other blocks" -) - public Mask adjacent(Mask mask, @Arg(name = "min", desc = "double", def = "-1") double min, @Arg(name = "max", desc = "double", def = "-1") double max) throws ExpressionException { - if (min == -1 && max == -1) { - min = 1; - max = 8; - } else if (max == -1) max = min; - if (max >= 8 && min == 1) { - return new AdjacentAnyMask(mask); - } - return new AdjacentMask(mask, (int) min, (int) max); - } - - @Command( - name = "<", - aliases = {"#<", "#below"}, - desc = "below a specific block" -) - public Mask below(Mask mask) throws ExpressionException { - OffsetMask offsetMask = new OffsetMask(mask, BlockVector3.at(0, 1, 0)); - return new MaskIntersection(offsetMask, Masks.negate(mask)); - } - - @Command( - name = ">", - aliases = {"#>", "#above"}, - desc = "above a specific block" -) - public Mask above(Mask mask) throws ExpressionException { - OffsetMask offsetMask = new OffsetMask(mask, BlockVector3.at(0, -1, 0)); - return new MaskIntersection(offsetMask, Masks.negate(mask)); - } - - @Command( - name = "$", - aliases = {"#biome", "#$"}, - desc = "in a specific biome", - descFooter = "in a specific biome. For a list of biomes use //biomelist" -) - public Mask biome(Extent extent, BiomeType biome) throws ExpressionException { - return new BiomeMask(extent, biome); - } - - @Command( - name = "%", - aliases = {"#%", "#percent"}, - desc = "percentage chance" -) - public Mask random(double chance) throws ExpressionException { - chance = chance / 100; - return new RandomMask(chance); - } - - @Command( - name = "=", - aliases = {"#=", "#expression"}, - desc = "expression mask" -) - public Mask expression(Extent extent, String input) throws ExpressionException { - Expression exp = Expression.compile(input, "x", "y", "z"); - ExpressionEnvironment env = new WorldEditExpressionEnvironment(extent, Vector3.ONE, Vector3.ZERO); - exp.setEnvironment(env); - return new ExpressionMask(exp); - } - - @Command( - name = "!", - aliases = {"#not", "#negate", "#!"}, - desc = "Negate another mask" -) - public Mask expression(Mask mask) throws ExpressionException { - return Masks.negate(mask); - } -} +// public Mask angle(Extent extent, @Arg(name="min", desc = "min angle") String minStr, @Arg(name="max", desc = "max angle") String maxStr, @Switch(name = 'o', desc = "TODO") boolean overlay, @Arg(name = "distance", desc = "int", def = "1") int distanceOpt) throws ExpressionException { +// double y1, y2; +// boolean override; +// if (maxStr.endsWith("d")) { +// double y1d = Expression.compile(minStr.substring(0, minStr.length() - 1)).evaluate(); +// double y2d = Expression.compile(maxStr.substring(0, maxStr.length() - 1)).evaluate(); +// y1 = Math.tan(y1d * (Math.PI / 180)); +// y2 = Math.tan(y2d * (Math.PI / 180)); +// } else { +// y1 = Expression.compile(minStr).evaluate(); +// y2 = Expression.compile(maxStr).evaluate(); +// } +// return new AngleMask(extent, y1, y2, overlay, distanceOpt); +// } +// +// @Command( +// name = "(", +// aliases = {")", "#roc", "#(", "#)"}, +// desc = "Restrict to near specific terrain slope rate of change", +// descFooter = "Restrict to near specific terrain slope rate of change\n" + +// "The -o flag will only overlay\n" + +// "Example: ([0d][45d][5]\n" + +// "Explanation: Restrict near where the angle changes between 0-45 degrees within 5 blocks\n" + +// "Note: Use negatives for decreasing slope" +//) +// public Mask roc(Extent extent, @Arg(name="min", desc = "min angle") String minStr, @Arg(name="max", desc = "max angle") String maxStr, @Switch(name = 'o', desc = "TODO") boolean overlay, @Arg(name = "distance", desc = "int", def = "4") int distanceOpt) throws ExpressionException { +// double y1, y2; +// boolean override; +// if (maxStr.endsWith("d")) { +// double y1d = Expression.compile(minStr.substring(0, minStr.length() - 1)).evaluate(); +// double y2d = Expression.compile(maxStr.substring(0, maxStr.length() - 1)).evaluate(); +// y1 = Math.tan(y1d * (Math.PI / 180)); +// y2 = Math.tan(y2d * (Math.PI / 180)); +// } else { +// y1 = Expression.compile(minStr).evaluate(); +// y2 = Expression.compile(maxStr).evaluate(); +// } +// return new ROCAngleMask(extent, y1, y2, overlay, distanceOpt); +// } +// +// @Command( +// name = "^", +// aliases = {"#extrema", "#^"}, +// desc = "Restrict to near specific terrain extrema", +// descFooter = "Restrict to near specific terrain extrema\n" + +// "The -o flag will only overlay\n" + +// "Example: ([0d][45d][5]\n" + +// "Explanation: Restrict to near 45 degrees of local maxima\n" + +// "Note: Use negatives for local minima" +//) +// public Mask extrema(Extent extent, @Arg(name="min", desc = "min angle") String minStr, @Arg(name="max", desc = "max angle") String maxStr, @Switch(name = 'o', desc = "TODO") boolean overlay, @Arg(name = "distance", desc = "int", def = "4") int distanceOpt) throws ExpressionException { +// double y1, y2; +// boolean override; +// if (maxStr.endsWith("d")) { +// double y1d = Expression.compile(minStr.substring(0, minStr.length() - 1)).evaluate(); +// double y2d = Expression.compile(maxStr.substring(0, maxStr.length() - 1)).evaluate(); +// y1 = Math.tan(y1d * (Math.PI / 180)); +// y2 = Math.tan(y2d * (Math.PI / 180)); +// } else { +// y1 = Expression.compile(minStr).evaluate(); +// y2 = Expression.compile(maxStr).evaluate(); +// } +// return new ExtremaMask(extent, y1, y2, overlay, distanceOpt); +// } +// +// @Command( +// name = "{", +// aliases = {"#{"}, +// desc = "Restricts blocks to within a specific radius range of the initial block" +//) +// public Mask radius(@Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) throws ExpressionException { +// return new RadiusMask((int) minInt, (int) maxInt); +// } +// +// @Command( +// name = "|", +// aliases = {"#|", "#side"}, +// desc = "sides with a specific number of other blocks" +//) +// public Mask wall(Mask mask, @Arg(name="mine", desc = "min light") double minInt, @Arg(name="mine", desc = "max light") double maxInt) throws ExpressionException { +// return new WallMask(mask, (int) minInt, (int) maxInt); +// } +// +// @Command( +// name = "~", +// aliases = {"#~", "#adjacent"}, +// desc = "Adjacent to a specific number of other blocks" +//) +// public Mask adjacent(Mask mask, @Arg(name = "min", desc = "double", def = "-1") double min, @Arg(name = "max", desc = "double", def = "-1") double max) throws ExpressionException { +// if (min == -1 && max == -1) { +// min = 1; +// max = 8; +// } else if (max == -1) max = min; +// if (max >= 8 && min == 1) { +// return new AdjacentAnyMask(mask); +// } +// return new AdjacentMask(mask, (int) min, (int) max); +// } +// +// @Command( +// name = "<", +// aliases = {"#<", "#below"}, +// desc = "below a specific block" +//) +// public Mask below(Mask mask) throws ExpressionException { +// OffsetMask offsetMask = new OffsetMask(mask, BlockVector3.at(0, 1, 0)); +// return new MaskIntersection(offsetMask, Masks.negate(mask)); +// } +// +// @Command( +// name = ">", +// aliases = {"#>", "#above"}, +// desc = "above a specific block" +//) +// public Mask above(Mask mask) throws ExpressionException { +// OffsetMask offsetMask = new OffsetMask(mask, BlockVector3.at(0, -1, 0)); +// return new MaskIntersection(offsetMask, Masks.negate(mask)); +// } +// +// @Command( +// name = "$", +// aliases = {"#biome", "#$"}, +// desc = "in a specific biome", +// descFooter = "in a specific biome. For a list of biomes use //biomelist" +//) +// public Mask biome(Extent extent, BiomeType biome) throws ExpressionException { +// return new BiomeMask(extent, biome); +// } +// +// @Command( +// name = "%", +// aliases = {"#%", "#percent"}, +// desc = "percentage chance" +//) +// public Mask random(double chance) throws ExpressionException { +// chance = chance / 100; +// return new RandomMask(chance); +// } +// +// @Command( +// name = "=", +// aliases = {"#=", "#expression"}, +// desc = "expression mask" +//) +// public Mask expression(Extent extent, String input) throws ExpressionException { +// Expression exp = Expression.compile(input, "x", "y", "z"); +// ExpressionEnvironment env = new WorldEditExpressionEnvironment(extent, Vector3.ONE, Vector3.ZERO); +// exp.setEnvironment(env); +// return new ExpressionMask(exp); +// } +// +// @Command( +// name = "!", +// aliases = {"#not", "#negate", "#!"}, +// desc = "Negate another mask" +//) +// public Mask expression(Mask mask) throws ExpressionException { +// return Masks.negate(mask); +// } +//} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/PatternCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/PatternCommands.java index 0ed73a8e4..6dcdef69c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/PatternCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/PatternCommands.java @@ -1,378 +1,378 @@ -package com.sk89q.worldedit.command; - -import com.boydti.fawe.object.DataAnglePattern; -import com.boydti.fawe.object.FawePlayer; -import com.boydti.fawe.object.clipboard.MultiClipboardHolder; -import com.boydti.fawe.object.collection.RandomCollection; -import com.boydti.fawe.object.pattern.*; -import com.boydti.fawe.object.random.SimplexRandom; -import com.boydti.fawe.util.ColorUtil; -import com.boydti.fawe.util.TextureUtil; -import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator; -import org.enginehub.piston.annotation.Command; -import com.sk89q.worldedit.*; -import com.sk89q.worldedit.entity.Player; -import com.sk89q.worldedit.extension.input.InputParseException; -import com.sk89q.worldedit.extension.platform.Actor; -import com.sk89q.worldedit.extent.Extent; -import com.sk89q.worldedit.extent.clipboard.Clipboard; -import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats; -import com.sk89q.worldedit.function.mask.Mask; -import com.sk89q.worldedit.function.pattern.ClipboardPattern; -import com.sk89q.worldedit.function.pattern.Pattern; -import com.sk89q.worldedit.function.pattern.RandomPattern; -import com.sk89q.worldedit.internal.expression.Expression; -import com.sk89q.worldedit.internal.expression.ExpressionException; -import com.sk89q.worldedit.math.Vector3; -import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment; -import com.sk89q.worldedit.session.ClipboardHolder; -import com.sk89q.worldedit.internal.annotation.Range; -import com.sk89q.worldedit.world.biome.BiomeType; -import org.enginehub.piston.annotation.CommandContainer; -import org.enginehub.piston.annotation.param.Arg; - -import java.awt.Color; -import java.io.IOException; -import java.util.Collections; -import java.util.List; -import java.util.Set; - -//@Command(aliases = {"patterns"}, -// desc = "Help for the various patterns. [More Info](https://git.io/vSPmA)", -// descFooter = "Patterns determine what blocks are placed\n" + -// " - Use [brackets] for arguments\n" + -// " - Use , to OR multiple\n" + -// "e.g. #surfacespread[10][#existing],andesite\n" + -// "More Info: https://git.io/vSPmA" +//package com.sk89q.worldedit.command; +// +//import com.boydti.fawe.object.DataAnglePattern; +//import com.boydti.fawe.object.FawePlayer; +//import com.boydti.fawe.object.clipboard.MultiClipboardHolder; +//import com.boydti.fawe.object.collection.RandomCollection; +//import com.boydti.fawe.object.pattern.*; +//import com.boydti.fawe.object.random.SimplexRandom; +//import com.boydti.fawe.util.ColorUtil; +//import com.boydti.fawe.util.TextureUtil; +//import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator; +//import org.enginehub.piston.annotation.Command; +//import com.sk89q.worldedit.*; +//import com.sk89q.worldedit.entity.Player; +//import com.sk89q.worldedit.extension.input.InputParseException; +//import com.sk89q.worldedit.extension.platform.Actor; +//import com.sk89q.worldedit.extent.Extent; +//import com.sk89q.worldedit.extent.clipboard.Clipboard; +//import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats; +//import com.sk89q.worldedit.function.mask.Mask; +//import com.sk89q.worldedit.function.pattern.ClipboardPattern; +//import com.sk89q.worldedit.function.pattern.Pattern; +//import com.sk89q.worldedit.function.pattern.RandomPattern; +//import com.sk89q.worldedit.internal.expression.Expression; +//import com.sk89q.worldedit.internal.expression.ExpressionException; +//import com.sk89q.worldedit.math.Vector3; +//import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment; +//import com.sk89q.worldedit.session.ClipboardHolder; +//import com.sk89q.worldedit.internal.annotation.Range; +//import com.sk89q.worldedit.world.biome.BiomeType; +//import org.enginehub.piston.annotation.CommandContainer; +//import org.enginehub.piston.annotation.param.Arg; +// +//import java.awt.Color; +//import java.io.IOException; +//import java.util.Collections; +//import java.util.List; +//import java.util.Set; +// +////@Command(aliases = {"patterns"}, +//// desc = "Help for the various patterns. [More Info](https://git.io/vSPmA)", +//// descFooter = "Patterns determine what blocks are placed\n" + +//// " - Use [brackets] for arguments\n" + +//// " - Use , to OR multiple\n" + +//// "e.g. #surfacespread[10][#existing],andesite\n" + +//// "More Info: https://git.io/vSPmA" +////) +//@CommandContainer//(superTypes = CommandPermissionsConditionGenerator.Registration.class) +//public class PatternCommands { +// +// @Command( +// name = "#existing", +// aliases = {"#*", "*", ".*"}, +// desc = "Use the block that is already there" +// ) +// public Pattern existing(Extent extent, @Arg(name = "properties", desc = "String", def = "") String properties) { // TODO FIXME , @Arg(name = "properties", desc = "String", def = "") String properties +// if (properties == null) return new ExistingPattern(extent); +// return new PropertyPattern(extent).addRegex(".*[" + properties + "]"); +// } +// +// @Command( +// name = "#clipboard", +// aliases = {"#copy"}, +// desc = "Use the blocks in your clipboard as the pattern") +// public Pattern clipboard(LocalSession session) throws EmptyClipboardException { +// ClipboardHolder holder = session.getClipboard(); +// Clipboard clipboard = holder.getClipboard(); +// return new ClipboardPattern(clipboard); +// } +// +// @Command( +// name = "#simplex", +// desc = "Use simplex noise to randomize blocks. Tutorial: https://imgur.com/a/rwVAE" //) -@CommandContainer//(superTypes = CommandPermissionsConditionGenerator.Registration.class) -public class PatternCommands { - - @Command( - name = "#existing", - aliases = {"#*", "*", ".*"}, - desc = "Use the block that is already there" - ) - public Pattern existing(Extent extent, @Arg(name = "properties", desc = "String", def = "") String properties) { // TODO FIXME , @Arg(name = "properties", desc = "String", def = "") String properties - if (properties == null) return new ExistingPattern(extent); - return new PropertyPattern(extent).addRegex(".*[" + properties + "]"); - } - - @Command( - name = "#clipboard", - aliases = {"#copy"}, - desc = "Use the blocks in your clipboard as the pattern") - public Pattern clipboard(LocalSession session) throws EmptyClipboardException { - ClipboardHolder holder = session.getClipboard(); - Clipboard clipboard = holder.getClipboard(); - return new ClipboardPattern(clipboard); - } - - @Command( - name = "#simplex", - desc = "Use simplex noise to randomize blocks. Tutorial: https://imgur.com/a/rwVAE" -) - public Pattern simplex(@Arg(desc = "scale factor") double scale, Pattern other) { - if (other instanceof RandomPattern) { - scale = (1d / Math.max(1, scale)); - RandomCollection collection = ((RandomPattern) other).getCollection(); - collection.setRandom(new SimplexRandom(scale)); - } - return other; - } - - @Command( - name = "#color", - desc = "Use the block closest to a specific color" -) - public Pattern color(TextureUtil textureUtil, String color) { - Color colorObj = ColorUtil.parseColor(color); - return textureUtil.getNearestBlock(colorObj.getRGB()).getDefaultState(); - } - - @Command( - name = "#anglecolor", - desc = "A darker block based on the existing terrain angle" -) - public Pattern anglecolor(Extent extent, LocalSession session, @Arg(name = "randomize", desc = "boolean", def = "true") boolean randomize, @Arg(name = "maxcomplexity", desc = "double", def = "100") double maxComplexity, @Arg(name = "distance", desc = "int", def = "1") int distanceOpt) { - return new AngleColorPattern(extent, session, distanceOpt); - } - - @Command( - name = "#angledata", - desc = "Block data based on the existing terrain angle" - ) - public Pattern angledata(Extent extent, @Arg(name = "distance", desc = "int", def = "1") int distanceOpt) { - return new DataAnglePattern(extent, distanceOpt); - } - - @Command( - name = "#saturate", - desc = "Saturate the existing block with a color" -) - public Pattern saturate(Extent extent, LocalSession session, String colorStr) { - Color color = ColorUtil.parseColor(colorStr); - return new SaturatePattern(extent, color.getRGB(), session); - } - - @Command( - name = "#averagecolor", - desc = "Average between the existing block and a color" -) - public Pattern averagecolor(Extent extent, LocalSession session, String colorStr) { - Color color = ColorUtil.parseColor(colorStr); - return new AverageColorPattern(extent, color.getRGB(), session); - } - - @Command( - name = "#desaturate", - desc = "Desaturated color of the existing block" -) - public Pattern desaturate(Extent extent, LocalSession session, @Arg(name = "percent", desc = "double", def = "100") double percent) { - return new DesaturatePattern(extent, percent / 100d, session); - } - - @Command( - name = "#lighten", - desc = "Lighten the existing block" -) - public Pattern lighten(Extent extent, TextureUtil util) { - return new ShadePattern(extent, false, util); - } - - @Command( - name = "#darken", - desc = "Darken the existing block" -) - public Pattern darken(Extent extent, TextureUtil util) { - return new ShadePattern(extent, true, util); - } - - @Command( - name = "#fullcopy", - desc = "Places your full clipboard at each block" -) - public Pattern fullcopy(Player player, Extent extent, LocalSession session, @Arg(name = "location", desc = "String", def = "#copy") String location, @Arg(name = "rotate", desc = "boolean", def = "false") boolean rotate, @Arg(name = "flip", desc = "boolean", def = "false") boolean flip) throws EmptyClipboardException, InputParseException, IOException { - List clipboards; - switch (location.toLowerCase()) { - case "#copy": - case "#clipboard": - ClipboardHolder clipboard = session.getExistingClipboard(); - if (clipboard == null) { - throw new InputParseException("To use #fullcopy, please first copy something to your clipboard"); - } - if (!rotate && !flip) { - return new FullClipboardPattern(extent, clipboard.getClipboard()); - } - clipboards = Collections.singletonList(clipboard); - break; - default: - MultiClipboardHolder multi = ClipboardFormats.loadAllFromInput(player, location, null, true); - clipboards = multi != null ? multi.getHolders() : null; - break; - } - if (clipboards == null) { - throw new InputParseException("#fullcopy:"); - } - return new RandomFullClipboardPattern(extent, clipboards, rotate, flip); - } - - @Command( - name = "#buffer", - desc = "Only place a block once while a pattern is in use", - descFooter = "Only place a block once while a pattern is in use\n" + - "Use with a brush when you don't want to apply to the same spot twice" -) - public Pattern buffer(Actor actor, Pattern pattern) { - return new BufferedPattern(FawePlayer.wrap(actor), pattern); - } - - @Command( - name = "#buffer2d", - desc = "Only place a block once in a column while a pattern is in use" -) - public Pattern buffer2d(Actor actor, Pattern pattern) { - return new BufferedPattern2D(FawePlayer.wrap(actor), pattern); - } - - @Command( - name = "#iddatamask", - desc = "Use the pattern's id and the existing blocks data with the provided mask", - descFooter = "Use the pattern's id and the existing blocks data with the provided mask\n" + - " - Use to replace slabs or where the data values needs to be shifted instead of set" -) - public Pattern iddatamask(Actor actor, LocalSession session, Extent extent, @Range(min = 0, max = 15) int bitmask, Pattern pattern) { - - return new IdDataMaskPattern(extent, pattern, bitmask); - } - - @Command( - name = "#id", - desc = "Only change the block id" -) - public Pattern id(Actor actor, LocalSession session, Extent extent, Pattern pattern) { - - return new IdPattern(extent, pattern); - } - - @Command( - name = "#data", - desc = "Only change the block data" -) - public Pattern data(Actor actor, LocalSession session, Extent extent, Pattern pattern) { - - return new DataPattern(extent, pattern); - } - - @Command( - name = "#biome", - aliases = {"$"}, - desc = "Set the biome" -) - public Pattern biome(Actor actor, LocalSession session, Extent extent, BiomeType biome) { - - return new BiomePattern(extent, biome); - } - - @Command( - name = "#relative", - aliases = {"#~", "#r", "#rel"}, - desc = "Offset the pattern to where you click" -) - public Pattern relative(Actor actor, LocalSession session, Extent extent, Pattern pattern) { - - return new RelativePattern(pattern); - } - - @Command( - name = "#!x", - aliases = {"#nx", "#nox"}, - desc = "The pattern will not be provided the x axis info", - descFooter = "The pattern will not be provided the z axis info.\n" + - "Example: #!x[#!z[#~[#l3d[pattern]]]]" -) - public Pattern nox(Actor actor, LocalSession session, Extent extent, Pattern pattern) { - - return new NoXPattern(pattern); - } - - @Command( - name = "#!y", - aliases = {"#ny", "#noy"}, - desc = "The pattern will not be provided the y axis info" -) - public Pattern noy(Actor actor, LocalSession session, Extent extent, Pattern pattern) { - - return new NoYPattern(pattern); - } - - @Command( - name = "#!z", - aliases = {"#nz", "#noz"}, - desc = "The pattern will not be provided the z axis info" -) - public Pattern noz(Actor actor, LocalSession session, Extent extent, Pattern pattern) { - - return new NoZPattern(pattern); - } - - @Command( - name = "#mask", - desc = "Apply a pattern depending on a mask" -) - public Pattern mask(Actor actor, LocalSession session, Mask mask, Pattern pass, Pattern fail) { - return new MaskedPattern(mask, pass, fail); - } - - @Command( - name = "#offset", - desc = "Offset a pattern" -) - public Pattern offset(Actor actor, LocalSession session, double x, double y, double z, Pattern pattern) { - - return new OffsetPattern(pattern, (int) x, (int) y, (int) z); - } - - @Command( - name = "#surfacespread", - desc = "Applies to only blocks on a surface. Selects a block from provided pattern with a given ranomized offset `[0, )`. e.g. Use `#existing` to randomly offset blocks in the world, or `#copy` to offset blocks in your clipboard" -) - public Pattern surfacespread(Actor actor, LocalSession session, double distance, Pattern pattern) { - - return new SurfaceRandomOffsetPattern(pattern, (int) distance); - } - - @Command( - name = "#solidspread", - desc = "Randomly spread solid blocks" -) - public Pattern solidspread(Actor actor, LocalSession session, double x, double y, double z, Pattern pattern) { - - return new SolidRandomOffsetPattern(pattern, (int) x, (int) y, (int) z); - } - - @Command( - name = "#spread", - aliases = {"#randomoffset"}, - desc = "Randomly spread blocks" -) - public Pattern spread(Actor actor, LocalSession session, double x, double y, double z, Pattern pattern) { - - return new RandomOffsetPattern(pattern, (int) x, (int) y, (int) z); - } - - @Command( - name = "#linear", - aliases = {"#l"}, - desc = "Sequentially set blocks from a list of patterns" -) - public Pattern linear(Actor actor, LocalSession session, Pattern other) { - - if (other instanceof RandomPattern) { - Set patterns = ((RandomPattern) other).getPatterns(); - return new LinearBlockPattern(patterns.toArray(new Pattern[patterns.size()])); - } - return other; - } - - @Command( - name = "#linear3d", - aliases = {"#l3d"}, - desc = "Use the x,y,z coordinate to pick a block from the list" -) - public Pattern linear3d(Actor actor, LocalSession session, Pattern other) { - - if (other instanceof RandomPattern) { - Set patterns = ((RandomPattern) other).getPatterns(); - return new Linear3DBlockPattern(patterns.toArray(new Pattern[patterns.size()])); - } - return other; - } - - @Command( - name = "#linear2d", - aliases = {"#l2d"}, - desc = "Use the x,z coordinate to pick a block from the list" -) - public Pattern linear2d(Actor actor, LocalSession session, Pattern other) { - - if (other instanceof RandomPattern) { - Set patterns = ((RandomPattern) other).getPatterns(); - return new Linear2DBlockPattern(patterns.toArray(new Pattern[patterns.size()])); - } - return other; - } - - @Command( - name = "=", - aliases = {"#=", "#expression"}, - desc = "Expression pattern: http://wiki.sk89q.com/wiki/WorldEdit/Expression_syntax" -) - public Pattern expression(Actor actor, LocalSession session, Extent extent, String input) throws ExpressionException { - - Expression exp = Expression.compile(input, "x", "y", "z"); - WorldEditExpressionEnvironment env = new WorldEditExpressionEnvironment(extent, Vector3.ONE, Vector3.ZERO); - exp.setEnvironment(env); - return new ExpressionPattern(exp); - } -} +// public Pattern simplex(@Arg(desc = "scale factor") double scale, Pattern other) { +// if (other instanceof RandomPattern) { +// scale = (1d / Math.max(1, scale)); +// RandomCollection collection = ((RandomPattern) other).getCollection(); +// collection.setRandom(new SimplexRandom(scale)); +// } +// return other; +// } +// +// @Command( +// name = "#color", +// desc = "Use the block closest to a specific color" +//) +// public Pattern color(TextureUtil textureUtil, String color) { +// Color colorObj = ColorUtil.parseColor(color); +// return textureUtil.getNearestBlock(colorObj.getRGB()).getDefaultState(); +// } +// +// @Command( +// name = "#anglecolor", +// desc = "A darker block based on the existing terrain angle" +//) +// public Pattern anglecolor(Extent extent, LocalSession session, @Arg(name = "randomize", desc = "boolean", def = "true") boolean randomize, @Arg(name = "maxcomplexity", desc = "double", def = "100") double maxComplexity, @Arg(name = "distance", desc = "int", def = "1") int distanceOpt) { +// return new AngleColorPattern(extent, session, distanceOpt); +// } +// +// @Command( +// name = "#angledata", +// desc = "Block data based on the existing terrain angle" +// ) +// public Pattern angledata(Extent extent, @Arg(name = "distance", desc = "int", def = "1") int distanceOpt) { +// return new DataAnglePattern(extent, distanceOpt); +// } +// +// @Command( +// name = "#saturate", +// desc = "Saturate the existing block with a color" +//) +// public Pattern saturate(Extent extent, LocalSession session, String colorStr) { +// Color color = ColorUtil.parseColor(colorStr); +// return new SaturatePattern(extent, color.getRGB(), session); +// } +// +// @Command( +// name = "#averagecolor", +// desc = "Average between the existing block and a color" +//) +// public Pattern averagecolor(Extent extent, LocalSession session, String colorStr) { +// Color color = ColorUtil.parseColor(colorStr); +// return new AverageColorPattern(extent, color.getRGB(), session); +// } +// +// @Command( +// name = "#desaturate", +// desc = "Desaturated color of the existing block" +//) +// public Pattern desaturate(Extent extent, LocalSession session, @Arg(name = "percent", desc = "double", def = "100") double percent) { +// return new DesaturatePattern(extent, percent / 100d, session); +// } +// +// @Command( +// name = "#lighten", +// desc = "Lighten the existing block" +//) +// public Pattern lighten(Extent extent, TextureUtil util) { +// return new ShadePattern(extent, false, util); +// } +// +// @Command( +// name = "#darken", +// desc = "Darken the existing block" +//) +// public Pattern darken(Extent extent, TextureUtil util) { +// return new ShadePattern(extent, true, util); +// } +// +// @Command( +// name = "#fullcopy", +// desc = "Places your full clipboard at each block" +//) +// public Pattern fullcopy(Player player, Extent extent, LocalSession session, @Arg(name = "location", desc = "String", def = "#copy") String location, @Arg(name = "rotate", desc = "boolean", def = "false") boolean rotate, @Arg(name = "flip", desc = "boolean", def = "false") boolean flip) throws EmptyClipboardException, InputParseException, IOException { +// List clipboards; +// switch (location.toLowerCase()) { +// case "#copy": +// case "#clipboard": +// ClipboardHolder clipboard = session.getExistingClipboard(); +// if (clipboard == null) { +// throw new InputParseException("To use #fullcopy, please first copy something to your clipboard"); +// } +// if (!rotate && !flip) { +// return new FullClipboardPattern(extent, clipboard.getClipboard()); +// } +// clipboards = Collections.singletonList(clipboard); +// break; +// default: +// MultiClipboardHolder multi = ClipboardFormats.loadAllFromInput(player, location, null, true); +// clipboards = multi != null ? multi.getHolders() : null; +// break; +// } +// if (clipboards == null) { +// throw new InputParseException("#fullcopy:"); +// } +// return new RandomFullClipboardPattern(extent, clipboards, rotate, flip); +// } +// +// @Command( +// name = "#buffer", +// desc = "Only place a block once while a pattern is in use", +// descFooter = "Only place a block once while a pattern is in use\n" + +// "Use with a brush when you don't want to apply to the same spot twice" +//) +// public Pattern buffer(Actor actor, Pattern pattern) { +// return new BufferedPattern(FawePlayer.wrap(actor), pattern); +// } +// +// @Command( +// name = "#buffer2d", +// desc = "Only place a block once in a column while a pattern is in use" +//) +// public Pattern buffer2d(Actor actor, Pattern pattern) { +// return new BufferedPattern2D(FawePlayer.wrap(actor), pattern); +// } +// +// @Command( +// name = "#iddatamask", +// desc = "Use the pattern's id and the existing blocks data with the provided mask", +// descFooter = "Use the pattern's id and the existing blocks data with the provided mask\n" + +// " - Use to replace slabs or where the data values needs to be shifted instead of set" +//) +// public Pattern iddatamask(Actor actor, LocalSession session, Extent extent, @Range(min = 0, max = 15) int bitmask, Pattern pattern) { +// +// return new IdDataMaskPattern(extent, pattern, bitmask); +// } +// +// @Command( +// name = "#id", +// desc = "Only change the block id" +//) +// public Pattern id(Actor actor, LocalSession session, Extent extent, Pattern pattern) { +// +// return new IdPattern(extent, pattern); +// } +// +// @Command( +// name = "#data", +// desc = "Only change the block data" +//) +// public Pattern data(Actor actor, LocalSession session, Extent extent, Pattern pattern) { +// +// return new DataPattern(extent, pattern); +// } +// +// @Command( +// name = "#biome", +// aliases = {"$"}, +// desc = "Set the biome" +//) +// public Pattern biome(Actor actor, LocalSession session, Extent extent, BiomeType biome) { +// +// return new BiomePattern(extent, biome); +// } +// +// @Command( +// name = "#relative", +// aliases = {"#~", "#r", "#rel"}, +// desc = "Offset the pattern to where you click" +//) +// public Pattern relative(Actor actor, LocalSession session, Extent extent, Pattern pattern) { +// +// return new RelativePattern(pattern); +// } +// +// @Command( +// name = "#!x", +// aliases = {"#nx", "#nox"}, +// desc = "The pattern will not be provided the x axis info", +// descFooter = "The pattern will not be provided the z axis info.\n" + +// "Example: #!x[#!z[#~[#l3d[pattern]]]]" +//) +// public Pattern nox(Actor actor, LocalSession session, Extent extent, Pattern pattern) { +// +// return new NoXPattern(pattern); +// } +// +// @Command( +// name = "#!y", +// aliases = {"#ny", "#noy"}, +// desc = "The pattern will not be provided the y axis info" +//) +// public Pattern noy(Actor actor, LocalSession session, Extent extent, Pattern pattern) { +// +// return new NoYPattern(pattern); +// } +// +// @Command( +// name = "#!z", +// aliases = {"#nz", "#noz"}, +// desc = "The pattern will not be provided the z axis info" +//) +// public Pattern noz(Actor actor, LocalSession session, Extent extent, Pattern pattern) { +// +// return new NoZPattern(pattern); +// } +// +// @Command( +// name = "#mask", +// desc = "Apply a pattern depending on a mask" +//) +// public Pattern mask(Actor actor, LocalSession session, Mask mask, Pattern pass, Pattern fail) { +// return new MaskedPattern(mask, pass, fail); +// } +// +// @Command( +// name = "#offset", +// desc = "Offset a pattern" +//) +// public Pattern offset(Actor actor, LocalSession session, double x, double y, double z, Pattern pattern) { +// +// return new OffsetPattern(pattern, (int) x, (int) y, (int) z); +// } +// +// @Command( +// name = "#surfacespread", +// desc = "Applies to only blocks on a surface. Selects a block from provided pattern with a given ranomized offset `[0, )`. e.g. Use `#existing` to randomly offset blocks in the world, or `#copy` to offset blocks in your clipboard" +//) +// public Pattern surfacespread(Actor actor, LocalSession session, double distance, Pattern pattern) { +// +// return new SurfaceRandomOffsetPattern(pattern, (int) distance); +// } +// +// @Command( +// name = "#solidspread", +// desc = "Randomly spread solid blocks" +//) +// public Pattern solidspread(Actor actor, LocalSession session, double x, double y, double z, Pattern pattern) { +// +// return new SolidRandomOffsetPattern(pattern, (int) x, (int) y, (int) z); +// } +// +// @Command( +// name = "#spread", +// aliases = {"#randomoffset"}, +// desc = "Randomly spread blocks" +//) +// public Pattern spread(Actor actor, LocalSession session, double x, double y, double z, Pattern pattern) { +// +// return new RandomOffsetPattern(pattern, (int) x, (int) y, (int) z); +// } +// +// @Command( +// name = "#linear", +// aliases = {"#l"}, +// desc = "Sequentially set blocks from a list of patterns" +//) +// public Pattern linear(Actor actor, LocalSession session, Pattern other) { +// +// if (other instanceof RandomPattern) { +// Set patterns = ((RandomPattern) other).getPatterns(); +// return new LinearBlockPattern(patterns.toArray(new Pattern[patterns.size()])); +// } +// return other; +// } +// +// @Command( +// name = "#linear3d", +// aliases = {"#l3d"}, +// desc = "Use the x,y,z coordinate to pick a block from the list" +//) +// public Pattern linear3d(Actor actor, LocalSession session, Pattern other) { +// +// if (other instanceof RandomPattern) { +// Set patterns = ((RandomPattern) other).getPatterns(); +// return new Linear3DBlockPattern(patterns.toArray(new Pattern[patterns.size()])); +// } +// return other; +// } +// +// @Command( +// name = "#linear2d", +// aliases = {"#l2d"}, +// desc = "Use the x,z coordinate to pick a block from the list" +//) +// public Pattern linear2d(Actor actor, LocalSession session, Pattern other) { +// +// if (other instanceof RandomPattern) { +// Set patterns = ((RandomPattern) other).getPatterns(); +// return new Linear2DBlockPattern(patterns.toArray(new Pattern[patterns.size()])); +// } +// return other; +// } +// +// @Command( +// name = "=", +// aliases = {"#=", "#expression"}, +// desc = "Expression pattern: http://wiki.sk89q.com/wiki/WorldEdit/Expression_syntax" +//) +// public Pattern expression(Actor actor, LocalSession session, Extent extent, String input) throws ExpressionException { +// +// Expression exp = Expression.compile(input, "x", "y", "z"); +// WorldEditExpressionEnvironment env = new WorldEditExpressionEnvironment(extent, Vector3.ONE, Vector3.ZERO); +// exp.setEnvironment(env); +// return new ExpressionPattern(exp); +// } +//} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/TransformCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/TransformCommands.java index f93ebe210..63e6d3015 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/TransformCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/TransformCommands.java @@ -1,104 +1,104 @@ -package com.sk89q.worldedit.command; - -import com.boydti.fawe.object.extent.Linear3DTransform; -import com.boydti.fawe.object.extent.LinearTransform; -import com.boydti.fawe.object.extent.OffsetExtent; -import com.boydti.fawe.object.extent.PatternTransform; -import com.boydti.fawe.object.extent.RandomOffsetTransform; -import com.boydti.fawe.object.extent.RandomTransform; -import com.boydti.fawe.object.extent.ResettableExtent; -import com.boydti.fawe.object.extent.ScaleTransform; -import com.boydti.fawe.object.extent.TransformExtent; -import com.boydti.fawe.util.ExtentTraverser; -import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator; -import com.sk89q.worldedit.entity.Player; -import com.sk89q.worldedit.extension.platform.Actor; -import com.sk89q.worldedit.extent.transform.BlockTransformExtent; -import com.sk89q.worldedit.function.pattern.Pattern; -import com.sk89q.worldedit.math.transform.AffineTransform; -import java.util.Set; -import org.enginehub.piston.annotation.Command; -import org.enginehub.piston.annotation.CommandContainer; -import org.enginehub.piston.annotation.param.Arg; - -@CommandContainer//(superTypes = CommandPermissionsConditionGenerator.Registration.class) -public class TransformCommands { - - @Command( - name = "#linear", - aliases = {"#l"}, - desc = "Sequentially pick from a list of transform" - ) - public ResettableExtent linear(Actor actor, LocalSession session, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) { - if (other instanceof RandomTransform) { - Set extents = ((RandomTransform) other).getExtents(); - return new LinearTransform(extents.toArray(new ResettableExtent[0])); - } - return other; - } - - @Command( - name = "#linear3d", - aliases = {"#l3d"}, - desc = "Use the x,y,z coordinate to pick a transform from the list" - ) - public ResettableExtent linear3d(Actor actor, LocalSession session, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) { - if (other instanceof RandomTransform) { - Set extents = ((RandomTransform) other).getExtents(); - return new Linear3DTransform(extents.toArray(new ResettableExtent[0])); - } - return other; - } - - @Command( - name = "#pattern", - desc = "Always use a specific pattern" - ) - public ResettableExtent pattern(Actor actor, LocalSession session, Pattern pattern, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) { - return new PatternTransform(other, pattern); - } - - @Command( - name = "#offset", - desc = "Offset transform" - ) - public ResettableExtent offset(Actor actor, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) { - return new OffsetExtent(other, (int) x, (int) y, (int) z); - } - - @Command( - name = "#spread", - aliases = {"#randomoffset"}, - desc = "Random offset transform" -) - public ResettableExtent randomOffset(Actor actor, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) { - return new RandomOffsetTransform(other, (int) x, (int) y, (int) z); - } - - @Command( - name = "#scale", - desc = "All changes will be scaled" - ) - public ResettableExtent scale(Actor actor, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) { - return new ScaleTransform(other, x, y, z); - } - - @Command( - name = "#rotate", - desc = "All changes will be rotate around the initial position" - ) - public ResettableExtent rotate(Player player, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) { - ExtentTraverser traverser = new ExtentTraverser<>(other).find(TransformExtent.class); - BlockTransformExtent affine = traverser != null ? traverser.get() : null; - if (affine == null) { - other = affine = new TransformExtent(other); - } - AffineTransform transform = (AffineTransform) affine.getTransform(); - transform = transform.rotateX(x); - transform = transform.rotateY(y); - transform = transform.rotateZ(z); - affine.setTransform(transform); - return other; - } -} +//package com.sk89q.worldedit.command; +// +//import com.boydti.fawe.object.extent.Linear3DTransform; +//import com.boydti.fawe.object.extent.LinearTransform; +//import com.boydti.fawe.object.extent.OffsetExtent; +//import com.boydti.fawe.object.extent.PatternTransform; +//import com.boydti.fawe.object.extent.RandomOffsetTransform; +//import com.boydti.fawe.object.extent.RandomTransform; +//import com.boydti.fawe.object.extent.ResettableExtent; +//import com.boydti.fawe.object.extent.ScaleTransform; +//import com.boydti.fawe.object.extent.TransformExtent; +//import com.boydti.fawe.util.ExtentTraverser; +//import com.sk89q.worldedit.LocalSession; +//import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator; +//import com.sk89q.worldedit.entity.Player; +//import com.sk89q.worldedit.extension.platform.Actor; +//import com.sk89q.worldedit.extent.transform.BlockTransformExtent; +//import com.sk89q.worldedit.function.pattern.Pattern; +//import com.sk89q.worldedit.math.transform.AffineTransform; +//import java.util.Set; +//import org.enginehub.piston.annotation.Command; +//import org.enginehub.piston.annotation.CommandContainer; +//import org.enginehub.piston.annotation.param.Arg; +// +//@CommandContainer//(superTypes = CommandPermissionsConditionGenerator.Registration.class) +//public class TransformCommands { +// +// @Command( +// name = "#linear", +// aliases = {"#l"}, +// desc = "Sequentially pick from a list of transform" +// ) +// public ResettableExtent linear(Actor actor, LocalSession session, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) { +// if (other instanceof RandomTransform) { +// Set extents = ((RandomTransform) other).getExtents(); +// return new LinearTransform(extents.toArray(new ResettableExtent[0])); +// } +// return other; +// } +// +// @Command( +// name = "#linear3d", +// aliases = {"#l3d"}, +// desc = "Use the x,y,z coordinate to pick a transform from the list" +// ) +// public ResettableExtent linear3d(Actor actor, LocalSession session, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) { +// if (other instanceof RandomTransform) { +// Set extents = ((RandomTransform) other).getExtents(); +// return new Linear3DTransform(extents.toArray(new ResettableExtent[0])); +// } +// return other; +// } +// +// @Command( +// name = "#pattern", +// desc = "Always use a specific pattern" +// ) +// public ResettableExtent pattern(Actor actor, LocalSession session, Pattern pattern, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) { +// return new PatternTransform(other, pattern); +// } +// +// @Command( +// name = "#offset", +// desc = "Offset transform" +// ) +// public ResettableExtent offset(Actor actor, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) { +// return new OffsetExtent(other, (int) x, (int) y, (int) z); +// } +// +// @Command( +// name = "#spread", +// aliases = {"#randomoffset"}, +// desc = "Random offset transform" +//) +// public ResettableExtent randomOffset(Actor actor, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) { +// return new RandomOffsetTransform(other, (int) x, (int) y, (int) z); +// } +// +// @Command( +// name = "#scale", +// desc = "All changes will be scaled" +// ) +// public ResettableExtent scale(Actor actor, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) { +// return new ScaleTransform(other, x, y, z); +// } +// +// @Command( +// name = "#rotate", +// desc = "All changes will be rotate around the initial position" +// ) +// public ResettableExtent rotate(Player player, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) { +// ExtentTraverser traverser = new ExtentTraverser<>(other).find(TransformExtent.class); +// BlockTransformExtent affine = traverser != null ? traverser.get() : null; +// if (affine == null) { +// other = affine = new TransformExtent(other); +// } +// AffineTransform transform = (AffineTransform) affine.getTransform(); +// transform = transform.rotateX(x); +// transform = transform.rotateY(y); +// transform = transform.rotateZ(z); +// affine.setTransform(transform); +// return other; +// } +//} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultTransformParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultTransformParser.java index 0626d4a33..54ef4986f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultTransformParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultTransformParser.java @@ -10,7 +10,7 @@ import com.boydti.fawe.util.StringMan; import com.google.common.collect.Iterables; import com.sk89q.minecraft.util.commands.CommandLocals; import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.command.TransformCommands; +//import com.sk89q.worldedit.command.TransformCommands; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.NoMatchException; import com.sk89q.worldedit.extension.input.ParserContext; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/DefaultPatternParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/DefaultPatternParser.java index 1c828ab9e..41359b87d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/DefaultPatternParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/pattern/DefaultPatternParser.java @@ -28,7 +28,7 @@ import com.google.common.collect.Iterables; import com.sk89q.minecraft.util.commands.CommandException; import com.sk89q.minecraft.util.commands.CommandLocals; import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.command.PatternCommands; +//import com.sk89q.worldedit.command.PatternCommands; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.NoMatchException; import com.sk89q.worldedit.extension.input.ParserContext; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformCommandManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformCommandManager.java index e1fc2512e..ba348b1a0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformCommandManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformCommandManager.java @@ -61,8 +61,6 @@ import com.sk89q.worldedit.command.HistoryCommandsRegistration; import com.sk89q.worldedit.command.NavigationCommands; import com.sk89q.worldedit.command.NavigationCommandsRegistration; import com.sk89q.worldedit.command.PaintBrushCommands; -import com.sk89q.worldedit.command.PatternCommands; -import com.sk89q.worldedit.command.PatternCommandsRegistration; import com.sk89q.worldedit.command.RegionCommands; import com.sk89q.worldedit.command.RegionCommandsRegistration; import com.sk89q.worldedit.command.SchematicCommands; @@ -81,8 +79,8 @@ import com.sk89q.worldedit.command.ToolCommands; import com.sk89q.worldedit.command.ToolCommandsRegistration; import com.sk89q.worldedit.command.ToolUtilCommands; import com.sk89q.worldedit.command.ToolUtilCommandsRegistration; -import com.sk89q.worldedit.command.TransformCommands; -import com.sk89q.worldedit.command.TransformCommandsRegistration; +//import com.sk89q.worldedit.command.TransformCommands; +//import com.sk89q.worldedit.command.TransformCommandsRegistration; import com.sk89q.worldedit.command.UtilityCommands; import com.sk89q.worldedit.command.UtilityCommandsRegistration; import com.sk89q.worldedit.command.WorldEditCommands; @@ -306,20 +304,20 @@ public final class PlatformCommandManager { public void registerAllCommands() { if (Settings.IMP.ENABLED_COMPONENTS.COMMANDS) { // TODO NOT IMPLEMENTED dunno why these have issues generating - registerSubCommands( - "patterns", - ImmutableList.of(), - "Patterns determine what blocks are placed", - PatternCommandsRegistration.builder(), - new PatternCommands() - ); - registerSubCommands( - "transforms", - ImmutableList.of(), - "Transforms modify how a block is placed", - TransformCommandsRegistration.builder(), - new TransformCommands() - ); +// registerSubCommands( +// "patterns", +// ImmutableList.of(), +// "Patterns determine what blocks are placed", +// PatternCommandsRegistration.builder(), +// new PatternCommands() +// ); +// registerSubCommands( +// "transforms", +// ImmutableList.of(), +// "Transforms modify how a block is placed", +// TransformCommandsRegistration.builder(), +// new TransformCommands() +// ); registerSubCommands( "schematic", ImmutableList.of("schem", "/schematic", "/schem"), @@ -380,17 +378,17 @@ public final class PlatformCommandManager { AnvilCommandsRegistration.builder(), new AnvilCommands(worldEdit) ); - registerSubCommands( - "transforms", - ImmutableList.of(), - "Transforms modify how a block is placed\n" + - " - Use [brackets] for arguments\n" + - " - Use , to OR multiple\n" + - " - Use & to AND multiple\n" + - "More Info: https://git.io/v9KHO", - TransformCommandsRegistration.builder(), - new TransformCommands() - ); +// registerSubCommands( +// "transforms", +// ImmutableList.of(), +// "Transforms modify how a block is placed\n" + +// " - Use [brackets] for arguments\n" + +// " - Use , to OR multiple\n" + +// " - Use & to AND multiple\n" + +// "More Info: https://git.io/v9KHO", +// TransformCommandsRegistration.builder(), +// new TransformCommands() +// ); this.registration.register( commandManager, BiomeCommandsRegistration.builder(), diff --git a/worldedit-libs/build.gradle b/worldedit-libs/build.gradle deleted file mode 100644 index bf7270421..000000000 --- a/worldedit-libs/build.gradle +++ /dev/null @@ -1,139 +0,0 @@ -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar -/* - -This project shades API libraries, i.e. those libraries -whose classes are publicly referenced from `-core` classes. - -This project does not shade implementation libraries, i.e. -those libraries whose classes are internally depended on. - -This is because the main reason for shading those libraries is for -their internal usage in each platform, not because we need them available to -dependents of `-core` to compile and work with WorldEdit"s API. - - */ -configure(subprojects + project("core:ap")) { - apply plugin: "maven" - apply plugin: "com.github.johnrengelman.shadow" - apply plugin: "com.jfrog.artifactory" - configurations { - create("shade") - getByName("archives").extendsFrom(getByName("default")) - } - - group = rootProject.group + ".worldedit-libs" - - tasks.register("jar", ShadowJar) { - configurations = [project.configurations.shade] - classifier = "" - - dependencies { - exclude(dependency("com.google.guava:guava")) - exclude(dependency("com.google.code.gson:gson")) - exclude(dependency("org.checkerframework:checker-qual")) - } - - relocate("net.kyori.text", "com.sk89q.worldedit.util.formatting.text") - } - def altConfigFiles = { String artifactType -> - def deps = configurations.shade.incoming.dependencies - .collect { it.copy() } - .collect { dependency -> - dependency.artifact { artifact -> - artifact.name = dependency.name - artifact.type = artifactType - artifact.extension = "jar" - artifact.classifier = artifactType - } - dependency - } - - return files(configurations.detachedConfiguration(deps as Dependency[]) - .resolvedConfiguration.lenientConfiguration.getArtifacts() - .findAll { it.classifier == artifactType } - .collect { zipTree(it.file) }) - } - tasks.register("sourcesJar", Jar) { - from { - altConfigFiles("sources") - } - def filePattern = ~/(.*)net\/kyori\/text((?:\/|\u0024).*)/ - def textPattern = ~/net\.kyori\.text/ - eachFile { - it.filter { String line -> - line.replaceFirst(textPattern, "com.sk89q.worldedit.util.formatting.text") - } - it.path = it.path.replaceFirst(filePattern, "\$1com/sk89q/worldedit/util/formatting/text\$2") - } - classifier = "sources" - } - - artifacts { - add("default", jar) - add("archives", sourcesJar) - } - - tasks.register("install", Upload) { - configuration = configurations.archives - repositories.mavenInstaller { - pom.version = project.version - pom.artifactId = project.name - } - } - - artifactoryPublish { - publishConfigs("default") - } - - build.dependsOn(jar, sourcesJar) -} - -def textExtrasVersion = "3.0.2" -project("core") { - def textVersion = "3.0.2" - def pistonVersion = "0.4.4-SNAPSHOT" - - dependencies { - shade "net.kyori:text-api:$textVersion" - shade "net.kyori:text-serializer-gson:$textVersion" - shade "net.kyori:text-serializer-legacy:$textVersion" - shade "net.kyori:text-serializer-plain:$textVersion" - shade "net.kyori:text-feature-pagination:$textVersion" - shade("com.sk89q:jchronic:0.2.4a") { - exclude(group: "junit", module: "junit") - } - shade "com.thoughtworks.paranamer:paranamer:2.6" - shade "com.sk89q.lib:jlibnoise:1.0.0" - shade "FAWE-Piston:lastSuccessfulBuild:core/build/libs/core-$pistonVersion@jar" - shade "FAWE-Piston:lastSuccessfulBuild:core-ap/runtime/build/libs/runtime-$pistonVersion@jar" - shade "FAWE-Piston:lastSuccessfulBuild:default-impl/build/libs/default-impl-$pistonVersion@jar" - } - - project("ap") { - dependencies { -// def avVersion = "1.6.5" -// shade "com.google.auto.value:auto-value-annotations:$avVersion" - shade "FAWE-Piston:lastSuccessfulBuild:core/build/libs/core-$pistonVersion@jar" - shade "FAWE-Piston:lastSuccessfulBuild:core-ap/annotations/build/libs/annotations-$pistonVersion@jar" - shade "FAWE-Piston:lastSuccessfulBuild:core-ap/processor/build/libs/processor-$pistonVersion@jar" - - shade "org.enginehub.piston.core-ap:annotations:$pistonVersion" - shade "org.enginehub.piston.core-ap:processor:$pistonVersion" - } - } -} -project("bukkit") { - repositories { - maven { - name = "SpigotMC" - url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" - } - } - dependencies { - shade "net.kyori:text-adapter-bukkit:$textExtrasVersion" - } -} - -tasks.register("build") { - dependsOn(subprojects.collect { it.tasks.named("build") }) -} diff --git a/worldedit-libs/build.gradle.kts b/worldedit-libs/build.gradle.kts new file mode 100644 index 000000000..152530cb0 --- /dev/null +++ b/worldedit-libs/build.gradle.kts @@ -0,0 +1,3 @@ +tasks.register("build") { + dependsOn(subprojects.map { it.tasks.named("build") }) +} diff --git a/worldedit-libs/bukkit/build.gradle.kts b/worldedit-libs/bukkit/build.gradle.kts new file mode 100644 index 000000000..247fd9219 --- /dev/null +++ b/worldedit-libs/bukkit/build.gradle.kts @@ -0,0 +1,11 @@ +applyLibrariesConfiguration() + +repositories { + maven { + name = "SpigotMC" + url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") + } +} +dependencies { + "shade"("net.kyori:text-adapter-bukkit:${Versions.TEXT_EXTRAS}") +} diff --git a/worldedit-libs/core/ap/build.gradle.kts b/worldedit-libs/core/ap/build.gradle.kts new file mode 100644 index 000000000..355efe01c --- /dev/null +++ b/worldedit-libs/core/ap/build.gradle.kts @@ -0,0 +1,9 @@ +applyLibrariesConfiguration() + +dependencies { + "shade"("FAWE-Piston:core/build/libs/core-${Versions.PISTON}:lastSuccessfulBuild@jar") + "shade"("FAWE-Piston:core-ap/runtime/build/libs/runtime-${Versions.PISTON}:lastSuccessfulBuild@jar") + "shade"("FAWE-Piston:default-impl/build/libs/default-impl-${Versions.PISTON}:lastSuccessfulBuild@jar") + "shade"("org.enginehub.piston.core-ap:annotations:${Versions.PISTON}") + "shade"("org.enginehub.piston.core-ap:processor:${Versions.PISTON}") +} diff --git a/worldedit-libs/core/build.gradle.kts b/worldedit-libs/core/build.gradle.kts new file mode 100644 index 000000000..37b7215a5 --- /dev/null +++ b/worldedit-libs/core/build.gradle.kts @@ -0,0 +1,16 @@ +applyLibrariesConfiguration() + +dependencies { + "shade"("net.kyori:text-api:${Versions.TEXT}") + "shade"("net.kyori:text-serializer-gson:${Versions.TEXT}") + "shade"("net.kyori:text-serializer-legacy:${Versions.TEXT}") + "shade"("net.kyori:text-serializer-plain:${Versions.TEXT}") + "shade"("com.sk89q:jchronic:0.2.4a") { + exclude(group = "junit", module = "junit") + } + "shade"("com.thoughtworks.paranamer:paranamer:2.6") + "shade"("com.sk89q.lib:jlibnoise:1.0.0") + "shade"("FAWE-Piston:core/build/libs/core-${Versions.PISTON}:lastSuccessfulBuild@jar") + "shade"("FAWE-Piston:core-ap/runtime/build/libs/runtime-${Versions.PISTON}:lastSuccessfulBuild@jar") + "shade"("FAWE-Piston:default-impl/build/libs/default-impl-${Versions.PISTON}:lastSuccessfulBuild@jar") +} From 7d254bc8398e496f220574da4371a6c7a9c33894 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Tue, 20 Aug 2019 15:16:08 -0400 Subject: [PATCH 09/24] migrate to gradle to kotlin --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index e8da05dd6..39f055c99 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,7 +13,7 @@ logger.lifecycle(""" Output files will be in [subproject]/build/libs ******************************************* """) - +//TODO FIX THIS WHEN I FEEL LIKE IT //def rootVersion = "1.13" //def revision = "" //def buildNumber = "" From 0f5c49c9f53e308ee794c5efb098549fa9119729 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Tue, 20 Aug 2019 15:23:14 -0400 Subject: [PATCH 10/24] comment out a maven url --- buildSrc/src/main/kotlin/CommonConfig.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/CommonConfig.kt b/buildSrc/src/main/kotlin/CommonConfig.kt index 8f2048586..4fe17b56b 100644 --- a/buildSrc/src/main/kotlin/CommonConfig.kt +++ b/buildSrc/src/main/kotlin/CommonConfig.kt @@ -13,7 +13,7 @@ fun Project.applyCommonConfiguration() { maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") } maven { url = uri("http://empcraft.com/maven2") } maven { url = uri("https://repo.destroystokyo.com/repository/maven-public") } - maven { url = uri("https://ci.athion.net/job/FAWE-Piston/ws/") } + //maven { url = uri("https://ci.athion.net/job/FAWE-Piston/ws/") } ivy { url = uri("https://ci.athion.net/job") patternLayout { artifact("/[organisation]/[module]/artifact/[revision].[ext]") From e415e7362353944d59934fb04c1f8f0f30ca5794 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Tue, 20 Aug 2019 15:30:55 -0400 Subject: [PATCH 11/24] Another attempt to fix piston --- buildSrc/src/main/kotlin/CommonConfig.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/CommonConfig.kt b/buildSrc/src/main/kotlin/CommonConfig.kt index 4fe17b56b..ddbaa1dfe 100644 --- a/buildSrc/src/main/kotlin/CommonConfig.kt +++ b/buildSrc/src/main/kotlin/CommonConfig.kt @@ -16,7 +16,7 @@ fun Project.applyCommonConfiguration() { //maven { url = uri("https://ci.athion.net/job/FAWE-Piston/ws/") } ivy { url = uri("https://ci.athion.net/job") patternLayout { - artifact("/[organisation]/[module]/artifact/[revision].[ext]") + artifact("/[organisation]/ws/[module].[ext]") }} } configurations.all { From 6998c2d230b326cdafc6e0c7eea89dc4d2c931f0 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Tue, 20 Aug 2019 16:03:50 -0400 Subject: [PATCH 12/24] fix compile --- buildSrc/src/main/kotlin/CommonConfig.kt | 2 +- .../main/java/com/boydti/fawe/command/CFICommand.java | 2 +- .../java/com/boydti/fawe/command/CommandProcessor.java | 10 +++++----- .../worldedit/command/util/DelegateCommandManager.java | 2 +- worldedit-libs/core/ap/build.gradle.kts | 2 ++ worldedit-libs/core/build.gradle.kts | 5 +++++ 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/buildSrc/src/main/kotlin/CommonConfig.kt b/buildSrc/src/main/kotlin/CommonConfig.kt index ddbaa1dfe..4fe17b56b 100644 --- a/buildSrc/src/main/kotlin/CommonConfig.kt +++ b/buildSrc/src/main/kotlin/CommonConfig.kt @@ -16,7 +16,7 @@ fun Project.applyCommonConfiguration() { //maven { url = uri("https://ci.athion.net/job/FAWE-Piston/ws/") } ivy { url = uri("https://ci.athion.net/job") patternLayout { - artifact("/[organisation]/ws/[module].[ext]") + artifact("/[organisation]/[module]/artifact/[revision].[ext]") }} } configurations.all { diff --git a/worldedit-core/src/main/java/com/boydti/fawe/command/CFICommand.java b/worldedit-core/src/main/java/com/boydti/fawe/command/CFICommand.java index 1999fdaf3..390f48ed3 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/command/CFICommand.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/command/CFICommand.java @@ -42,7 +42,7 @@ public class CFICommand extends CommandProcessor { } @Override - public Object process(InjectedValueAccess context, List args, Object result) { + public int process(InjectedValueAccess context, List args, int result) { return result; } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/command/CommandProcessor.java b/worldedit-core/src/main/java/com/boydti/fawe/command/CommandProcessor.java index 348eff575..973f75433 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/command/CommandProcessor.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/command/CommandProcessor.java @@ -67,13 +67,13 @@ public abstract class CommandProcessor implements CommandManager { } @Override - public final O /* Need to recompile with FAWE-piston */ execute(InjectedValueAccess context, List args) { + public final int execute(InjectedValueAccess context, List args) { args = preprocess(context, args); if (args != null) { - I result = (I) parent.execute(context, args); + int result = parent.execute(context, args); return process(context, args, result); // TODO NOT IMPLEMENTED (recompile piston) } else { - return null; + return 0; } } @@ -89,5 +89,5 @@ public abstract class CommandProcessor implements CommandManager { public abstract List preprocess(InjectedValueAccess context, List args); - public abstract O process(InjectedValueAccess context, List args, I result); -} \ No newline at end of file + public abstract int process(InjectedValueAccess context, List args, int result); +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/DelegateCommandManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/DelegateCommandManager.java index 6985eba1d..8b284e8d9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/DelegateCommandManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/DelegateCommandManager.java @@ -61,7 +61,7 @@ public class DelegateCommandManager implements CommandManager { } @Override - public Object execute(InjectedValueAccess context, List args) { + public int execute(InjectedValueAccess context, List args) { return parent.execute(context, args); } diff --git a/worldedit-libs/core/ap/build.gradle.kts b/worldedit-libs/core/ap/build.gradle.kts index 355efe01c..1c3c3e8d8 100644 --- a/worldedit-libs/core/ap/build.gradle.kts +++ b/worldedit-libs/core/ap/build.gradle.kts @@ -1,9 +1,11 @@ applyLibrariesConfiguration() dependencies { +/* "shade"("FAWE-Piston:core/build/libs/core-${Versions.PISTON}:lastSuccessfulBuild@jar") "shade"("FAWE-Piston:core-ap/runtime/build/libs/runtime-${Versions.PISTON}:lastSuccessfulBuild@jar") "shade"("FAWE-Piston:default-impl/build/libs/default-impl-${Versions.PISTON}:lastSuccessfulBuild@jar") +*/ "shade"("org.enginehub.piston.core-ap:annotations:${Versions.PISTON}") "shade"("org.enginehub.piston.core-ap:processor:${Versions.PISTON}") } diff --git a/worldedit-libs/core/build.gradle.kts b/worldedit-libs/core/build.gradle.kts index 37b7215a5..f413cdb48 100644 --- a/worldedit-libs/core/build.gradle.kts +++ b/worldedit-libs/core/build.gradle.kts @@ -10,7 +10,12 @@ dependencies { } "shade"("com.thoughtworks.paranamer:paranamer:2.6") "shade"("com.sk89q.lib:jlibnoise:1.0.0") + "shade"("org.enginehub.piston:core:${Versions.PISTON}") + "shade"("org.enginehub.piston.core-ap:runtime:${Versions.PISTON}") + "shade"("org.enginehub.piston:default-impl:${Versions.PISTON}") +/* "shade"("FAWE-Piston:core/build/libs/core-${Versions.PISTON}:lastSuccessfulBuild@jar") "shade"("FAWE-Piston:core-ap/runtime/build/libs/runtime-${Versions.PISTON}:lastSuccessfulBuild@jar") "shade"("FAWE-Piston:default-impl/build/libs/default-impl-${Versions.PISTON}:lastSuccessfulBuild@jar") +*/ } From 135c12b650c083eb5bd8b58300d74b90b585a118 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Thu, 22 Aug 2019 13:14:27 -0400 Subject: [PATCH 13/24] More compile fixes --- buildSrc/build.gradle.kts | 6 +- buildSrc/src/main/kotlin/CommonConfig.kt | 1 - buildSrc/src/main/kotlin/PlatformConfig.kt | 16 +-- buildSrc/src/main/kotlin/Versions.kt | 2 +- config/checkstyle/checkstyle.xml | 4 - contrib/craftscripts/README.txt | 5 +- gradle.properties | 4 +- worldedit-bukkit/build.gradle.kts | 41 +++---- .../fawe/bukkit/wrapper/AsyncWorld.java | 5 - .../sk89q/worldedit/bukkit/BukkitWorld.java | 13 +-- .../src/main/resources/plugin.yml | 6 +- .../sk89q/wepif/DinnerPermsResolverTest.java | 30 ++--- .../sk89q/wepif/TestOfflinePermissible.java | 17 +-- .../worldedit/bukkit/BukkitWorldTest.java | 7 +- worldedit-core/build.gradle.kts | 8 +- .../util/commands/CommandContext.java | 9 +- .../com/sk89q/worldedit/LocalSession.java | 5 +- .../java/com/sk89q/worldedit/WorldEdit.java | 23 ++-- .../internal/command/CommandUtil.java | 28 ++++- .../internal/cui/ServerCUIHandler.java | 10 +- .../worldedit/session/SessionManager.java | 2 +- .../util/concurrency/EvenMoreExecutors.java | 26 ++++- .../worldedit/util/paste/EngineHubPaste.java | 13 ++- .../java/com/sk89q/worldedit/world/World.java | 1 - .../world/snapshot/SnapshotRepository.java | 15 +-- .../worldedit/world/registry/blocks.json | 20 ++-- .../worldedit/world/registry/legacy.json | 110 ++++-------------- .../util/commands/CommandContextTest.java | 23 ++-- .../transform/BlockTransformExtentTest.java | 21 ++-- .../test/resources/junit-platform.properties | 5 + worldedit-libs/core/ap/build.gradle.kts | 5 - worldedit-libs/core/build.gradle.kts | 5 - 32 files changed, 217 insertions(+), 269 deletions(-) create mode 100644 worldedit-core/src/test/resources/junit-platform.properties diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index ed12dbe5b..53c14fc9e 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -12,9 +12,9 @@ configurations.all { resolutionStrategy { // Fabric needs this. force( - "commons-io:commons-io:2.5", - "org.ow2.asm:asm:7.1", - "org.ow2.asm:asm-commons:7.1" + "commons-io:commons-io:2.5", + "org.ow2.asm:asm:7.1", + "org.ow2.asm:asm-commons:7.1" ) } } diff --git a/buildSrc/src/main/kotlin/CommonConfig.kt b/buildSrc/src/main/kotlin/CommonConfig.kt index 4fe17b56b..7be239760 100644 --- a/buildSrc/src/main/kotlin/CommonConfig.kt +++ b/buildSrc/src/main/kotlin/CommonConfig.kt @@ -13,7 +13,6 @@ fun Project.applyCommonConfiguration() { maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") } maven { url = uri("http://empcraft.com/maven2") } maven { url = uri("https://repo.destroystokyo.com/repository/maven-public") } - //maven { url = uri("https://ci.athion.net/job/FAWE-Piston/ws/") } ivy { url = uri("https://ci.athion.net/job") patternLayout { artifact("/[organisation]/[module]/artifact/[revision].[ext]") diff --git a/buildSrc/src/main/kotlin/PlatformConfig.kt b/buildSrc/src/main/kotlin/PlatformConfig.kt index 7e0f2cf2b..9a4d27a8f 100644 --- a/buildSrc/src/main/kotlin/PlatformConfig.kt +++ b/buildSrc/src/main/kotlin/PlatformConfig.kt @@ -22,7 +22,7 @@ fun Project.applyPlatformAndCoreConfiguration() { apply(plugin = "eclipse") apply(plugin = "idea") apply(plugin = "maven") - apply(plugin = "checkstyle") + //apply(plugin = "checkstyle") apply(plugin = "com.github.johnrengelman.shadow") apply(plugin = "com.jfrog.artifactory") @@ -33,10 +33,10 @@ fun Project.applyPlatformAndCoreConfiguration() { targetCompatibility = JavaVersion.VERSION_1_8 } - configure { - configFile = rootProject.file("config/checkstyle/checkstyle.xml") - toolVersion = "7.6.1" - } +// configure { +// configFile = rootProject.file("config/checkstyle/checkstyle.xml") +// toolVersion = "7.6.1" +// } tasks.withType().configureEach { useJUnitPlatform() @@ -86,9 +86,9 @@ fun Project.applyPlatformAndCoreConfiguration() { } } - tasks.named("check").configure { - dependsOn("checkstyleMain", "checkstyleTest") - } +// tasks.named("check").configure { +// dependsOn("checkstyleMain", "checkstyleTest") +// } } diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index a4570bd5a..b460f77eb 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -1,7 +1,7 @@ object Versions { const val TEXT = "3.0.1" const val TEXT_EXTRAS = "3.0.2" - const val PISTON = "0.4.4-SNAPSHOT" + const val PISTON = "0.4.3" const val AUTO_VALUE = "1.6.5" const val JUNIT = "5.5.0" const val MOCKITO = "3.0.0" diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index bef46365f..7e9784556 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -65,10 +65,6 @@ - - - - diff --git a/contrib/craftscripts/README.txt b/contrib/craftscripts/README.txt index 7638e67ed..61dd01128 100644 --- a/contrib/craftscripts/README.txt +++ b/contrib/craftscripts/README.txt @@ -6,10 +6,9 @@ Example usage: You may or may not install these scripts -- it is optional. If you are, however, place the entire craftscripts/ folder into the respective directory for the platform -that you have installed WorldEdit for -(see http://wiki.sk89q.com/wiki/WorldEdit/Installation). +that you have installed WorldEdit. In order to be able to use CraftScripts, you must install the Rhino JavaScript library. The installation page linked above has information about that. More information about scripts in general can be found at -http://wiki.sk89q.com/wiki/WorldEdit/Scripting \ No newline at end of file +https://worldedit.enginehub.org/en/latest/usage/other/craftscripts/ diff --git a/gradle.properties b/gradle.properties index 69b35f7b8..4d41d3dcb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -#group=com.sk89q.worldedit -#version=7.1.0-SNAPSHOT +group=com.sk89q.worldedit +version=7.1.0-SNAPSHOT org.gradle.jvmargs=-Xmx1G diff --git a/worldedit-bukkit/build.gradle.kts b/worldedit-bukkit/build.gradle.kts index 0efa9d67b..bf07b7bb6 100644 --- a/worldedit-bukkit/build.gradle.kts +++ b/worldedit-bukkit/build.gradle.kts @@ -27,41 +27,38 @@ configurations.all { } dependencies { - "compile"("net.milkbowl.vault:VaultAPI:1.7") + "compile"("net.milkbowl.vault:VaultAPI:1.7") { isTransitive = false } "api"(project(":worldedit-core")) "api"(project(":worldedit-libs:bukkit")) - "api"("org.bukkit:bukkit:1.13.2-R0.1-SNAPSHOT") { + "compile"("it.unimi.dsi:fastutil:8.2.1") + "api"("com.destroystokyo.paper:paper-api:1.14.4-R0.1-SNAPSHOT") { exclude("junit", "junit") } - "compile"("it.unimi.dsi:fastutil:8.2.1") - "compileOnly"("com.destroystokyo.paper:paper-api:1.13.2-R0.1-SNAPSHOT") - "compile"("com.destroystokyo.paper:paper-api:1.14.4-R0.1-SNAPSHOT") - "compileOnly"("BuildTools:spigot-1.14.4:lastSuccessfulBuild@jar") + "compileOnly"("org.spigotmc:spigot:1.14.4-R0.1-SNAPSHOT") "implementation"("io.papermc:paperlib:1.0.2") "compileOnly"("com.sk89q:dummypermscompat:1.10") "implementation"("org.apache.logging.log4j:log4j-slf4j-impl:2.8.1") "implementation"("org.bstats:bstats-bukkit:1.5") "testCompile"("org.mockito:mockito-core:1.9.0-rc1") - "implementation"("com.sk89q.worldguard:worldguard-core:7.0.0-20190215.210421-39") - "implementation"("com.sk89q.worldguard:worldguard-legacy:7.0.0-20190215.210421-39") - "implementation"("com.massivecraft:factions:2.8.0") - "implementation"("com.drtshock:factions:1.6.9.5") - "implementation"("com.factionsone:FactionsOne:1.2.2") - "implementation"("me.ryanhamshire:GriefPrevention:11.5.2") - "implementation"("com.massivecraft:mcore:7.0.1") - "implementation"("net.sacredlabyrinth.Phaed:PreciousStones:10.0.4-SNAPSHOT") - "implementation"("net.jzx7:regios:5.9.9") - "implementation"("com.bekvon.bukkit.residence:Residence:4.5._13.1") - "implementation"("com.palmergames.bukkit:towny:0.84.0.9") - "implementation"("com.thevoxelbox.voxelsniper:voxelsniper:5.171.0") - "implementation"("com.comphenix.protocol:ProtocolLib-API:4.4.0-SNAPSHOT") - "implementation"("com.wasteofplastic:askyblock:3.0.8.2") + "implementation"("com.sk89q.worldguard:worldguard-core:7.0.0-20190215.210421-39") { isTransitive = false } + "implementation"("com.sk89q.worldguard:worldguard-legacy:7.0.0-20190215.210421-39") { isTransitive = false } + "implementation"("com.massivecraft:factions:2.8.0") { isTransitive = false } + "implementation"("com.drtshock:factions:1.6.9.5") { isTransitive = false } + "implementation"("com.factionsone:FactionsOne:1.2.2") { isTransitive = false } + "implementation"("me.ryanhamshire:GriefPrevention:11.5.2") { isTransitive = false } + "implementation"("com.massivecraft:mcore:7.0.1") { isTransitive = false } + "implementation"("net.sacredlabyrinth.Phaed:PreciousStones:10.0.4-SNAPSHOT") { isTransitive = false } + "implementation"("net.jzx7:regios:5.9.9") { isTransitive = false } + "implementation"("com.bekvon.bukkit.residence:Residence:4.5._13.1") { isTransitive = false } + "implementation"("com.palmergames.bukkit:towny:0.84.0.9") { isTransitive = false } + "implementation"("com.thevoxelbox.voxelsniper:voxelsniper:5.171.0") { isTransitive = false } + "implementation"("com.comphenix.protocol:ProtocolLib-API:4.4.0-SNAPSHOT") { isTransitive = false } + "implementation"("com.wasteofplastic:askyblock:3.0.8.2") { isTransitive = false } } tasks.named("processResources") { filesMatching("plugin.yml") { - expand("name" to (project.parent?.name ?: "FAWE")) - expand("version" to (project.parent?.version ?: "UNKNOWN")) + expand("internalVersion" to project.ext["internalVersion"]) } } diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncWorld.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncWorld.java index 0a0e9d617..78f322654 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncWorld.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncWorld.java @@ -1098,11 +1098,6 @@ public class AsyncWorld extends PassthroughExtent implements World { return parent.locateNearestStructure(arg0, arg1, arg2, arg3); } - @Override - public int getViewDistance() { - return parent.getViewDistance(); - } - @Override public RayTraceResult rayTrace(Location arg0, Vector arg1, double arg2, FluidCollisionMode arg3, boolean arg4, double arg5, Predicate arg6) { diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java index 84e32fd07..b214d477e 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java @@ -28,6 +28,7 @@ import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; +import com.sk89q.worldedit.blocks.BaseItem; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; import com.sk89q.worldedit.entity.BaseEntity; @@ -36,6 +37,7 @@ import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.Region; +import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.util.TreeGenerator; import com.sk89q.worldedit.world.AbstractWorld; import com.sk89q.worldedit.world.biome.BiomeType; @@ -252,9 +254,6 @@ public class BukkitWorld extends AbstractWorld { @Override public boolean clearContainerBlockContents(BlockVector3 pt) { Block block = getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()); - if (block == null) { - return false; - } BlockState state = block.getState(); if (!(state instanceof InventoryHolder)) { return false; @@ -321,14 +320,12 @@ public class BukkitWorld extends AbstractWorld { public void checkLoadedChunk(BlockVector3 pt) { World world = getWorld(); - if (!world.isChunkLoaded(pt.getBlockX() >> 4, pt.getBlockZ() >> 4)) { - world.loadChunk(pt.getBlockX() >> 4, pt.getBlockZ() >> 4); - } + world.getChunkAt(pt.getBlockX() >> 4, pt.getBlockZ() >> 4); } @Override public boolean equals(Object other) { - World ref = worldRef.get(); + final World ref = worldRef.get(); if (ref == null) { return false; } else if (other == null) { @@ -337,7 +334,7 @@ public class BukkitWorld extends AbstractWorld { World otherWorld = ((BukkitWorld) other).worldRef.get(); return ref.equals(otherWorld); } else if (other instanceof com.sk89q.worldedit.world.World) { - return ((com.sk89q.worldedit.world.World) other).getName().equals(getName()); + return ((com.sk89q.worldedit.world.World) other).getName().equals(ref.getName()); } else { return false; } diff --git a/worldedit-bukkit/src/main/resources/plugin.yml b/worldedit-bukkit/src/main/resources/plugin.yml index 8c514eaa2..7683c521d 100644 --- a/worldedit-bukkit/src/main/resources/plugin.yml +++ b/worldedit-bukkit/src/main/resources/plugin.yml @@ -1,10 +1,10 @@ name: WorldEdit main: com.sk89q.worldedit.bukkit.WorldEditPlugin -version: ${version} +version: "${internalVersion}" +load: STARTUP api-version: 1.13 description: Fast Async WorldEdit plugin authors: [Empire92] -load: STARTUP loadbefore: [BannerBoard, WorldGuard, PlotSquared, AsyncWorldEdit, AsyncWorldEditInjector] database: false permissions: @@ -153,4 +153,4 @@ permissions: worldedit.green: true worldedit.extinguish: true worldedit.calc: true - worldedit.fill: true \ No newline at end of file + worldedit.fill: true diff --git a/worldedit-bukkit/src/test/java/com/sk89q/wepif/DinnerPermsResolverTest.java b/worldedit-bukkit/src/test/java/com/sk89q/wepif/DinnerPermsResolverTest.java index e207e7b8d..37deab330 100644 --- a/worldedit-bukkit/src/test/java/com/sk89q/wepif/DinnerPermsResolverTest.java +++ b/worldedit-bukkit/src/test/java/com/sk89q/wepif/DinnerPermsResolverTest.java @@ -19,26 +19,26 @@ package com.sk89q.wepif; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - import org.bukkit.Server; import org.bukkit.plugin.PluginManager; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; public class DinnerPermsResolverTest { private DinnerPermsResolver resolver; - @Before + @BeforeEach public void setUp() { Server server = mock(Server.class); when(server.getPluginManager()).thenReturn(mock(PluginManager.class)); resolver = new DinnerPermsResolver(server); } - + @Test public void testBasicResolving() { final TestOfflinePermissible permissible = new TestOfflinePermissible(); @@ -49,7 +49,7 @@ public class DinnerPermsResolverTest { assertFalse(resolver.hasPermission(permissible, "completely.unrelated")); permissible.clearPermissions(); } - + @Test public void testBasicWildcardResolution() { final TestOfflinePermissible permissible = new TestOfflinePermissible(); @@ -59,7 +59,7 @@ public class DinnerPermsResolverTest { assertTrue(resolver.hasPermission(permissible, "commandbook.spawnmob.spider.skeleton")); permissible.clearPermissions(); } - + @Test public void testNegatingNodes() { final TestOfflinePermissible permissible = new TestOfflinePermissible(); @@ -67,16 +67,16 @@ public class DinnerPermsResolverTest { permissible.setPermission("commandbook.cuteasianboys", false); permissible.setPermission("commandbook.warp.*", false); permissible.setPermission("commandbook.warp.create", true); - + assertTrue(resolver.hasPermission(permissible, "commandbook.motd")); assertFalse(resolver.hasPermission(permissible, "commandbook.cuteasianboys")); assertFalse(resolver.hasPermission(permissible, "commandbook.warp.remove")); assertTrue(resolver.hasPermission(permissible, "commandbook.warp.create")); - + permissible.clearPermissions(); } - - + + @Test public void testInGroup() { final TestOfflinePermissible permissible = new TestOfflinePermissible(); diff --git a/worldedit-bukkit/src/test/java/com/sk89q/wepif/TestOfflinePermissible.java b/worldedit-bukkit/src/test/java/com/sk89q/wepif/TestOfflinePermissible.java index 685baafc6..f75e3a634 100644 --- a/worldedit-bukkit/src/test/java/com/sk89q/wepif/TestOfflinePermissible.java +++ b/worldedit-bukkit/src/test/java/com/sk89q/wepif/TestOfflinePermissible.java @@ -30,6 +30,7 @@ import org.bukkit.plugin.Plugin; import java.util.HashMap; import java.util.HashSet; +import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.UUID; @@ -37,7 +38,7 @@ import java.util.UUID; public class TestOfflinePermissible implements OfflinePlayer, Permissible { private boolean op; private UUID randomUuid = UUID.randomUUID(); - + private final Map assignedPermissions = new HashMap<>(); @Override @@ -52,7 +53,7 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible { @Override public boolean isPermissionSet(String s) { - return assignedPermissions.containsKey(s.toLowerCase()); + return assignedPermissions.containsKey(s.toLowerCase(Locale.ROOT)); } @Override @@ -63,7 +64,7 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible { @Override public boolean hasPermission(String s) { if (isPermissionSet(s)) { - return assignedPermissions.get(s.toLowerCase()); + return assignedPermissions.get(s.toLowerCase(Locale.ROOT)); } return false; } @@ -111,19 +112,19 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible { } return ret; } - + public void setPermission(String permission, boolean value) { - assignedPermissions.put(permission.toLowerCase(), value); + assignedPermissions.put(permission.toLowerCase(Locale.ROOT), value); } - + public void unsetPermission(String permission) { - assignedPermissions.remove(permission.toLowerCase()); + assignedPermissions.remove(permission.toLowerCase(Locale.ROOT)); } public void clearPermissions() { assignedPermissions.clear(); } - + // -- Unneeded OfflinePlayer methods @Override diff --git a/worldedit-bukkit/src/test/java/com/sk89q/worldedit/bukkit/BukkitWorldTest.java b/worldedit-bukkit/src/test/java/com/sk89q/worldedit/bukkit/BukkitWorldTest.java index e6776cf8c..8851fb926 100644 --- a/worldedit-bukkit/src/test/java/com/sk89q/worldedit/bukkit/BukkitWorldTest.java +++ b/worldedit-bukkit/src/test/java/com/sk89q/worldedit/bukkit/BukkitWorldTest.java @@ -20,15 +20,16 @@ package com.sk89q.worldedit.bukkit; import com.sk89q.worldedit.util.TreeGenerator; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertNotNull; public class BukkitWorldTest { @Test public void testTreeTypeMapping() { for (TreeGenerator.TreeType type : TreeGenerator.TreeType.values()) { - Assert.assertNotNull("No mapping for: " + type, BukkitWorld.toBukkitTreeType(type)); + assertNotNull(BukkitWorld.toBukkitTreeType(type), "No mapping for: " + type); } } diff --git a/worldedit-core/build.gradle.kts b/worldedit-core/build.gradle.kts index c27900398..16513720b 100644 --- a/worldedit-core/build.gradle.kts +++ b/worldedit-core/build.gradle.kts @@ -24,7 +24,6 @@ dependencies { "compile"("it.unimi.dsi:fastutil:8.2.1") "compile"("com.googlecode.json-simple:json-simple:1.1.1") - "compileOnly"(project(":worldedit-libs:core:ap")) "annotationProcessor"(project(":worldedit-libs:core:ap")) // ensure this is on the classpath for the AP @@ -59,9 +58,8 @@ sourceSets { tasks.named("processResources") { filesMatching("fawe.properties") { - expand("version" to (project.parent?.version ?: "UNKNOWN")) - expand("name" to (project.parent?.name ?: "FAWE")) - expand("commit" to "TODO GIT") - expand("date" to "TODO Date") +// expand("version" to project.ext["internalVersion"]) +// expand("commit" to "TODO GIT") +// expand("date" to "TODO Date") } } diff --git a/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/CommandContext.java b/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/CommandContext.java index 2a7e07f00..69bd40894 100644 --- a/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/CommandContext.java +++ b/worldedit-core/src/main/java/com/sk89q/minecraft/util/commands/CommandContext.java @@ -26,8 +26,6 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.IntStream; public class CommandContext { @@ -256,8 +254,11 @@ public class CommandContext { } public String getString(int start, int end) { - return IntStream.range(start + 1, end + 1).mapToObj(i -> " " + parsedArgs.get(i)) - .collect(Collectors.joining("", parsedArgs.get(start), "")); + StringBuilder buffer = new StringBuilder(parsedArgs.get(start)); + for (int i = start + 1; i < end + 1; ++i) { + buffer.append(" ").append(parsedArgs.get(i)); + } + return buffer.toString(); } public int getInteger(int index) throws NumberFormatException { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java index 21f38c0fa..dbdaf32cd 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -72,6 +72,7 @@ import com.sk89q.worldedit.regions.selector.RegionSelectorType; import com.sk89q.worldedit.session.ClipboardHolder; import com.sk89q.worldedit.util.Countable; import com.sk89q.worldedit.util.HandSide; +import com.sk89q.worldedit.util.Identifiable; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; @@ -395,7 +396,7 @@ public class LocalSession implements TextureHolder { return null; } - public synchronized void remember(Player player, World world, ChangeSet changeSet, FaweLimit limit) { + public synchronized void remember(Identifiable player, World world, ChangeSet changeSet, FaweLimit limit) { if (Settings.IMP.HISTORY.USE_DISK) { LocalSession.MAX_HISTORY_SIZE = Integer.MAX_VALUE; } @@ -438,7 +439,7 @@ public class LocalSession implements TextureHolder { } } - public synchronized void remember(final EditSession editSession, final boolean append, int limitMb) { + public synchronized void remember(EditSession editSession, boolean append, int limitMb) { if (Settings.IMP.HISTORY.USE_DISK) { LocalSession.MAX_HISTORY_SIZE = Integer.MAX_VALUE; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java index 64d759ac8..4111cc83c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java @@ -81,7 +81,6 @@ import java.util.Map; import javax.annotation.Nullable; import javax.script.ScriptException; -import org.mozilla.javascript.NativeJavaObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -109,7 +108,8 @@ public final class WorldEdit { private final PlatformManager platformManager = new PlatformManager(this); private final EditSessionFactory editSessionFactory = new EditSessionFactory.EditSessionFactoryImpl(eventBus); private final SessionManager sessions = new SessionManager(this); - private final ListeningExecutorService executorService = MoreExecutors.listeningDecorator(EvenMoreExecutors.newBoundedCachedThreadPool(0, 1, 20));; + private final ListeningExecutorService executorService = MoreExecutors.listeningDecorator( + EvenMoreExecutors.newBoundedCachedThreadPool(0, 1, 20, "WorldEdit Task Executor - %s")); private final Supervisor supervisor = new SimpleSupervisor(); private final BlockFactory blockFactory = new BlockFactory(this); @@ -635,14 +635,14 @@ public final class WorldEdit { * @param args arguments for the script * @throws WorldEditException */ - public Object runScript(Player player, File f, String[] args) throws WorldEditException { + public void runScript(Player player, File f, String[] args) throws WorldEditException { String filename = f.getPath(); int index = filename.lastIndexOf('.'); String ext = filename.substring(index + 1); if (!ext.equalsIgnoreCase("js")) { player.printError("Only .js scripts are currently supported"); - return null; + return; } String script; @@ -655,7 +655,7 @@ public final class WorldEdit { if (file == null) { player.printError("Script does not exist: " + filename); - return null; + return; } } else { file = new FileInputStream(f); @@ -668,7 +668,7 @@ public final class WorldEdit { script = new String(data, 0, data.length, StandardCharsets.UTF_8); } catch (IOException e) { player.printError("Script read error: " + e.getMessage()); - return null; + return; } LocalSession session = getSessionManager().get(player); @@ -681,8 +681,8 @@ public final class WorldEdit { engine = new RhinoCraftScriptEngine(); } catch (NoClassDefFoundError ignored) { player.printError("Failed to find an installed script engine."); - player.printError("Please see https://worldedit.readthedocs.io/en/latest/usage/other/craftscripts/"); - return null; + player.printError("Please see https://worldedit.enginehub.org/en/latest/usage/other/craftscripts/"); + return; } engine.setTimeLimit(getConfiguration().scriptTimeout); @@ -693,11 +693,7 @@ public final class WorldEdit { vars.put("player", player); try { - Object result = engine.evaluate(script, filename, vars); - if (result instanceof NativeJavaObject) { - result = ((NativeJavaObject) result).unwrap(); - } - return result; + engine.evaluate(script, filename, vars); } catch (ScriptException e) { player.printError("Failed to execute:"); player.printRaw(e.getMessage()); @@ -714,7 +710,6 @@ public final class WorldEdit { session.remember(editSession); } } - return null; } /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/CommandUtil.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/CommandUtil.java index c74afd0dc..bdcd8e541 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/CommandUtil.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/CommandUtil.java @@ -19,14 +19,12 @@ package com.sk89q.worldedit.internal.command; -import static com.google.common.base.Preconditions.checkState; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; import com.sk89q.worldedit.extension.platform.PlatformCommandManager; import com.sk89q.worldedit.internal.util.Substring; import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.util.formatting.text.TextComponent; -import static java.util.stream.Collectors.toList; import org.enginehub.piston.Command; import org.enginehub.piston.exception.CommandException; import org.enginehub.piston.inject.InjectedValueAccess; @@ -40,6 +38,9 @@ import java.util.Optional; import java.util.function.Function; import java.util.stream.Collectors; +import static com.google.common.base.Preconditions.checkState; +import static java.util.stream.Collectors.toList; + public class CommandUtil { public static Map getSubCommands(Command currentCommand) { @@ -64,20 +65,37 @@ public class CommandUtil { * Fix {@code suggestions} to replace the last space-separated word in {@code arguments}. */ public static List fixSuggestions(String arguments, List suggestions) { - Substring lastArg = Iterables.getLast(CommandArgParser.spaceSplit(arguments)); + Substring lastArg = Iterables.getLast( + CommandArgParser.spaceSplit(arguments) + ); return suggestions.stream() - .map(suggestion -> CommandUtil.suggestLast(lastArg, suggestion)) + // Re-map suggestions to only operate on the last non-quoted word + .map(suggestion -> onlyOnLastQuotedWord(lastArg, suggestion)) + .map(suggestion -> suggestLast(lastArg, suggestion)) .filter(Optional::isPresent) .map(Optional::get) .collect(toList()); } + private static Substring onlyOnLastQuotedWord(Substring lastArg, Substring suggestion) { + if (suggestion.getSubstring().startsWith(lastArg.getSubstring())) { + // This is already fine. + return suggestion; + } + String substr = suggestion.getSubstring(); + int sp = substr.lastIndexOf(' '); + if (sp < 0) { + return suggestion; + } + return Substring.wrap(substr.substring(sp + 1), suggestion.getStart() + sp + 1, suggestion.getEnd()); + } + /** * Given the last word of a command, mutate the suggestion to replace the last word, if * possible. */ private static Optional suggestLast(Substring last, Substring suggestion) { - if (suggestion.getStart() == last.getEnd()) { + if (suggestion.getStart() == last.getEnd() && !last.getSubstring().equals("\"")) { // this suggestion is for the next argument. if (last.getSubstring().isEmpty()) { return Optional.of(suggestion.getSubstring()); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/ServerCUIHandler.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/ServerCUIHandler.java index 5a13140db..2ca8f3bd3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/ServerCUIHandler.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/ServerCUIHandler.java @@ -32,6 +32,7 @@ import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.selector.CuboidRegionSelector; +import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockTypes; @@ -114,11 +115,12 @@ public class ServerCUIHandler { } // Borrowed this math from FAWE - double rotX = player.getLocation().getYaw(); - double rotY = player.getLocation().getPitch(); + final Location location = player.getLocation(); + double rotX = location.getYaw(); + double rotY = location.getPitch(); double xz = Math.cos(Math.toRadians(rotY)); - int x = (int) (player.getLocation().getX() - (-xz * Math.sin(Math.toRadians(rotX))) * 12); - int z = (int) (player.getLocation().getZ() - (xz * Math.cos(Math.toRadians(rotX))) * 12); + int x = (int) (location.getX() - (-xz * Math.sin(Math.toRadians(rotX))) * 12); + int z = (int) (location.getZ() - (xz * Math.cos(Math.toRadians(rotX))) * 12); int y = Math.max(0, Math.min(Math.min(255, posY + 32), posY + 3)); Map structureTag = new HashMap<>(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java index 08ad67ff3..70dd62256 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java @@ -71,7 +71,7 @@ public class SessionManager { private static final Logger log = LoggerFactory.getLogger(SessionManager.class); private static boolean warnedInvalidTool; - private final Timer timer = new Timer(); + private final Timer timer = new Timer("WorldEdit Session Manager"); private final WorldEdit worldEdit; private final Map sessions = new HashMap<>(); private SessionStore store = new VoidStore(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/concurrency/EvenMoreExecutors.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/concurrency/EvenMoreExecutors.java index 5272039a1..1c40c9454 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/concurrency/EvenMoreExecutors.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/concurrency/EvenMoreExecutors.java @@ -19,8 +19,10 @@ package com.sk89q.worldedit.util.concurrency; -import java.util.concurrent.ArrayBlockingQueue; +import com.google.common.util.concurrent.ThreadFactoryBuilder; + import java.util.concurrent.ExecutorService; +import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; @@ -39,15 +41,33 @@ public final class EvenMoreExecutors { * * @param minThreads the minimum number of threads to have at a given time * @param maxThreads the maximum number of threads to have at a given time - * @param queueSize the size of the queue before new submissions are rejected + * @param queueSize the size of the queue before new submissions are rejected * @return the newly created thread pool */ public static ExecutorService newBoundedCachedThreadPool(int minThreads, int maxThreads, int queueSize) { + return newBoundedCachedThreadPool(minThreads, maxThreads, queueSize, null); + } + + /** + * Creates a thread pool that creates new threads as needed up to + * a maximum number of threads, but will reuse previously constructed + * threads when they are available. + * + * @param minThreads the minimum number of threads to have at a given time + * @param maxThreads the maximum number of threads to have at a given time + * @param queueSize the size of the queue before new submissions are rejected + * @param threadFormat thread name formatter + * @return the newly created thread pool + */ + public static ExecutorService newBoundedCachedThreadPool(int minThreads, int maxThreads, int queueSize, String threadFormat) { ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor( minThreads, maxThreads, 60L, TimeUnit.SECONDS, - new ArrayBlockingQueue<>(queueSize)); + new LinkedBlockingDeque<>(queueSize)); threadPoolExecutor.allowCoreThreadTimeOut(true); + if (threadFormat != null) { + threadPoolExecutor.setThreadFactory(new ThreadFactoryBuilder().setNameFormat(threadFormat).build()); + } return threadPoolExecutor; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/EngineHubPaste.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/EngineHubPaste.java index ac7484846..ab8ebe029 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/EngineHubPaste.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/EngineHubPaste.java @@ -19,8 +19,9 @@ package com.sk89q.worldedit.util.paste; +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; import com.sk89q.worldedit.util.net.HttpRequest; -import org.json.simple.JSONValue; import java.io.IOException; import java.net.URL; @@ -33,6 +34,8 @@ public class EngineHubPaste implements Paster { private static final Pattern URL_PATTERN = Pattern.compile("https?://.+$"); + private static final Gson GSON = new Gson(); + @Override public Callable paste(String content) { return new PasteTask(content); @@ -59,10 +62,10 @@ public class EngineHubPaste implements Paster { .returnContent() .asString("UTF-8").trim(); - Object object = JSONValue.parse(result); - if (object instanceof Map) { - @SuppressWarnings("unchecked") - String urlString = String.valueOf(((Map) object).get("url")); + Map object = GSON.fromJson(result, new TypeToken>() { + }.getType()); + if (object != null) { + String urlString = String.valueOf(object.get("url")); Matcher m = URL_PATTERN.matcher(urlString); if (m.matches()) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java index 4a705ff7b..c74d31f3e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java @@ -72,7 +72,6 @@ public interface World extends Extent, Keyed, IChunkCache { * * @return the maximum Y */ - @Override int getMaxY(); /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotRepository.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotRepository.java index 3399cb9cd..d13663427 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotRepository.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotRepository.java @@ -66,13 +66,13 @@ public class SnapshotRepository { } /** - * Get a list of snapshots in a directory. The newest snapshot is near the top of the array. + * Get a list of snapshots in a directory. The newest snapshot is + * near the top of the array. * * @param newestFirst true to get the newest first * @return a list of snapshots */ - public List getSnapshots(boolean newestFirst, String worldName) - throws MissingWorldException { + public List getSnapshots(boolean newestFirst, String worldName) throws MissingWorldException { FilenameFilter filter = (dir, name) -> { File f = new File(dir, name); return isValidSnapshot(f); @@ -116,8 +116,7 @@ public class SnapshotRepository { * @return a snapshot or null */ @Nullable - public Snapshot getSnapshotAfter(ZonedDateTime date, String world) - throws MissingWorldException { + public Snapshot getSnapshotAfter(ZonedDateTime date, String world) throws MissingWorldException { List snapshots = getSnapshots(true, world); Snapshot last = null; @@ -139,8 +138,7 @@ public class SnapshotRepository { * @return a snapshot or null */ @Nullable - public Snapshot getSnapshotBefore(ZonedDateTime date, String world) - throws MissingWorldException { + public Snapshot getSnapshotBefore(ZonedDateTime date, String world) throws MissingWorldException { List snapshots = getSnapshots(false, world); Snapshot last = null; @@ -206,8 +204,7 @@ public class SnapshotRepository { * @return whether it is a valid snapshot */ protected boolean isValidSnapshot(File file) { - if (!file.getName() - .matches("^[A-Za-z0-9_\\- \\./\\\\'\\$@~!%\\^\\*\\(\\)\\[\\]\\+\\{\\},\\?]+$")) { + if (!file.getName().matches("^[A-Za-z0-9_\\- \\./\\\\'\\$@~!%\\^\\*\\(\\)\\[\\]\\+\\{\\},\\?]+$")) { return false; } diff --git a/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/blocks.json b/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/blocks.json index d5f98648d..1c3009b6b 100644 --- a/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/blocks.json +++ b/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/blocks.json @@ -283,7 +283,7 @@ "hardness": 2.0, "resistance": 3.0, "ticksRandomly": false, - "fullCube": true, + "fullCube": false, "slipperiness": 0.6, "liquid": false, "solid": true, @@ -758,7 +758,7 @@ "hardness": 3.0, "resistance": 3.0, "ticksRandomly": false, - "fullCube": true, + "fullCube": false, "slipperiness": 0.6, "liquid": false, "solid": true, @@ -771,7 +771,7 @@ "unpushable": false, "mapColor": "#000000", "isTranslucent": false, - "hasContainer": false + "hasContainer": true } }, { @@ -1133,7 +1133,7 @@ "hardness": 2.0, "resistance": 3.0, "ticksRandomly": false, - "fullCube": true, + "fullCube": false, "slipperiness": 0.6, "liquid": false, "solid": true, @@ -1246,7 +1246,7 @@ "unpushable": false, "mapColor": "#8f7748", "isTranslucent": false, - "hasContainer": false + "hasContainer": true } }, { @@ -1383,7 +1383,7 @@ "hardness": 2.0, "resistance": 2.0, "ticksRandomly": false, - "fullCube": true, + "fullCube": false, "slipperiness": 0.6, "liquid": false, "solid": true, @@ -1391,10 +1391,10 @@ "burnable": false, "opaque": true, "replacedDuringPlacement": false, - "toolRequired": false, + "toolRequired": true, "fragileWhenPushed": false, "unpushable": false, - "mapColor": "#7f3fb2", + "mapColor": "#707070", "isTranslucent": true, "hasContainer": true } @@ -1408,7 +1408,7 @@ "hardness": 0.3, "resistance": 0.3, "ticksRandomly": false, - "fullCube": true, + "fullCube": false, "slipperiness": 0.6, "liquid": false, "solid": true, @@ -16899,4 +16899,4 @@ "hasContainer": false } } -] \ No newline at end of file +] diff --git a/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/legacy.json b/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/legacy.json index 9ba596968..1996d1b2c 100644 --- a/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/legacy.json +++ b/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/legacy.json @@ -316,16 +316,11 @@ "47:0": "minecraft:bookshelf", "48:0": "minecraft:mossy_cobblestone", "49:0": "minecraft:obsidian", - "50:0": "minecraft:torch", "50:1": "minecraft:wall_torch[facing=east]", "50:2": "minecraft:wall_torch[facing=west]", "50:3": "minecraft:wall_torch[facing=south]", "50:4": "minecraft:wall_torch[facing=north]", - "50:9": "minecraft:wall_torch[facing=east]", - "50:10": "minecraft:wall_torch[facing=west]", - "50:11": "minecraft:wall_torch[facing=south]", - "50:12": "minecraft:wall_torch[facing=north]", - "50:13": "minecraft:torch", + "50:5": "minecraft:torch", "51:0": "minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=0]", "51:1": "minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=1]", "51:2": "minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=2]", @@ -351,15 +346,10 @@ "53:5": "minecraft:oak_stairs[half=top,shape=outer_right,facing=west]", "53:6": "minecraft:oak_stairs[half=top,shape=outer_right,facing=south]", "53:7": "minecraft:oak_stairs[half=top,shape=outer_right,facing=north]", - "54:0": "minecraft:chest", "54:2": "minecraft:chest[facing=north,type=single]", "54:3": "minecraft:chest[facing=south,type=single]", "54:4": "minecraft:chest[facing=west,type=single]", "54:5": "minecraft:chest[facing=east,type=single]", - "54:10": "minecraft:chest[facing=north]", - "54:11": "minecraft:chest[facing=south]", - "54:12": "minecraft:chest[facing=west]", - "54:13": "minecraft:chest[facing=east]", "55:0": "minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=0]", "55:1": "minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=1]", "55:2": "minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=2]", @@ -395,40 +385,30 @@ "60:5": "minecraft:farmland[moisture=5]", "60:6": "minecraft:farmland[moisture=6]", "60:7": "minecraft:farmland[moisture=7]", - "61:0": "minecraft:furnace", "61:2": "minecraft:furnace[facing=north,lit=false]", "61:3": "minecraft:furnace[facing=south,lit=false]", "61:4": "minecraft:furnace[facing=west,lit=false]", "61:5": "minecraft:furnace[facing=east,lit=false]", - "61:10": "minecraft:furnace[facing=north,lit=false]", - "61:11": "minecraft:furnace[facing=south,lit=false]", - "61:12": "minecraft:furnace[facing=west,lit=false]", - "61:13": "minecraft:furnace[facing=east,lit=false]", - "62:0": "minecraft:furnace[lit=true]", "62:2": "minecraft:furnace[facing=north,lit=true]", "62:3": "minecraft:furnace[facing=south,lit=true]", "62:4": "minecraft:furnace[facing=west,lit=true]", "62:5": "minecraft:furnace[facing=east,lit=true]", - "62:10": "minecraft:furnace[facing=north,lit=true]", - "62:11": "minecraft:furnace[facing=south,lit=true]", - "62:12": "minecraft:furnace[facing=west,lit=true]", - "62:13": "minecraft:furnace[facing=east,lit=true]", - "63:0": "minecraft:oak_sign[rotation=0]", - "63:1": "minecraft:oak_sign[rotation=1]", - "63:2": "minecraft:oak_sign[rotation=2]", - "63:3": "minecraft:oak_sign[rotation=3]", - "63:4": "minecraft:oak_sign[rotation=4]", - "63:5": "minecraft:oak_sign[rotation=5]", - "63:6": "minecraft:oak_sign[rotation=6]", - "63:7": "minecraft:oak_sign[rotation=7]", - "63:8": "minecraft:oak_sign[rotation=8]", - "63:9": "minecraft:oak_sign[rotation=9]", - "63:10": "minecraft:oak_sign[rotation=10]", - "63:11": "minecraft:oak_sign[rotation=11]", - "63:12": "minecraft:oak_sign[rotation=12]", - "63:13": "minecraft:oak_sign[rotation=13]", - "63:14": "minecraft:oak_sign[rotation=14]", - "63:15": "minecraft:oak_sign[rotation=15]", + "63:0": "minecraft:sign[rotation=0]", + "63:1": "minecraft:sign[rotation=1]", + "63:2": "minecraft:sign[rotation=2]", + "63:3": "minecraft:sign[rotation=3]", + "63:4": "minecraft:sign[rotation=4]", + "63:5": "minecraft:sign[rotation=5]", + "63:6": "minecraft:sign[rotation=6]", + "63:7": "minecraft:sign[rotation=7]", + "63:8": "minecraft:sign[rotation=8]", + "63:9": "minecraft:sign[rotation=9]", + "63:10": "minecraft:sign[rotation=10]", + "63:11": "minecraft:sign[rotation=11]", + "63:12": "minecraft:sign[rotation=12]", + "63:13": "minecraft:sign[rotation=13]", + "63:14": "minecraft:sign[rotation=14]", + "63:15": "minecraft:sign[rotation=15]", "64:0": "minecraft:oak_door[hinge=right,half=lower,powered=false,facing=east,open=false]", "64:1": "minecraft:oak_door[hinge=right,half=lower,powered=false,facing=south,open=false]", "64:2": "minecraft:oak_door[hinge=right,half=lower,powered=false,facing=west,open=false]", @@ -441,15 +421,10 @@ "64:9": "minecraft:oak_door[hinge=right,half=upper,powered=false,facing=east,open=false]", "64:10": "minecraft:oak_door[hinge=left,half=upper,powered=true,facing=east,open=false]", "64:11": "minecraft:oak_door[hinge=right,half=upper,powered=true,facing=east,open=false]", - "65:0": "minecraft:ladder", "65:2": "minecraft:ladder[facing=north]", "65:3": "minecraft:ladder[facing=south]", "65:4": "minecraft:ladder[facing=west]", "65:5": "minecraft:ladder[facing=east]", - "65:10": "minecraft:ladder[facing=north]", - "65:11": "minecraft:ladder[facing=south]", - "65:12": "minecraft:ladder[facing=west]", - "65:13": "minecraft:ladder[facing=east]", "66:0": "minecraft:rail[shape=north_south]", "66:1": "minecraft:rail[shape=east_west]", "66:2": "minecraft:rail[shape=ascending_east]", @@ -468,15 +443,10 @@ "67:5": "minecraft:cobblestone_stairs[half=top,shape=straight,facing=west]", "67:6": "minecraft:cobblestone_stairs[half=top,shape=straight,facing=south]", "67:7": "minecraft:cobblestone_stairs[half=top,shape=straight,facing=north]", - "68:0": "minecraft:oak_wall_sign", - "68:2": "minecraft:oak_wall_sign[facing=north]", - "68:3": "minecraft:oak_wall_sign[facing=south]", - "68:4": "minecraft:oak_wall_sign[facing=west]", - "68:5": "minecraft:oak_wall_sign[facing=east]", - "68:10": "minecraft:oak_wall_sign[facing=north]", - "68:11": "minecraft:oak_wall_sign[facing=south]", - "68:12": "minecraft:oak_wall_sign[facing=west]", - "68:13": "minecraft:oak_wall_sign[facing=east]", + "68:2": "minecraft:wall_sign[facing=north]", + "68:3": "minecraft:wall_sign[facing=south]", + "68:4": "minecraft:wall_sign[facing=west]", + "68:5": "minecraft:wall_sign[facing=east]", "69:0": "minecraft:lever[powered=false,facing=north,face=ceiling]", "69:1": "minecraft:lever[powered=false,facing=east,face=wall]", "69:2": "minecraft:lever[powered=false,facing=west,face=wall]", @@ -511,28 +481,16 @@ "72:1": "minecraft:oak_pressure_plate[powered=true]", "73:0": "minecraft:redstone_ore[lit=false]", "74:0": "minecraft:redstone_ore[lit=true]", - "75:0": "minecraft:redstone_torch[lit=false]", "75:1": "minecraft:redstone_wall_torch[facing=east,lit=false]", "75:2": "minecraft:redstone_wall_torch[facing=west,lit=false]", "75:3": "minecraft:redstone_wall_torch[facing=south,lit=false]", "75:4": "minecraft:redstone_wall_torch[facing=north,lit=false]", "75:5": "minecraft:redstone_torch[lit=false]", - "75:9": "minecraft:redstone_wall_torch[facing=east,lit=false]", - "75:10": "minecraft:redstone_wall_torch[facing=west,lit=false]", - "75:11": "minecraft:redstone_wall_torch[facing=south,lit=false]", - "75:12": "minecraft:redstone_wall_torch[facing=north,lit=false]", - "75:13": "minecraft:redstone_wall_torch[lit=false]", - "76:0": "minecraft:redstone_torch[lit=true]", "76:1": "minecraft:redstone_wall_torch[facing=east,lit=true]", "76:2": "minecraft:redstone_wall_torch[facing=west,lit=true]", "76:3": "minecraft:redstone_wall_torch[facing=south,lit=true]", "76:4": "minecraft:redstone_wall_torch[facing=north,lit=true]", - "76:5": "minecraft:redstone_wall_torch[lit=true]", - "76:9": "minecraft:redstone_wall_torch[facing=east,lit=true]", - "76:10": "minecraft:redstone_wall_torch[facing=west,lit=true]", - "76:11": "minecraft:redstone_wall_torch[facing=south,lit=true]", - "76:12": "minecraft:redstone_wall_torch[facing=north,lit=true]", - "76:13": "minecraft:redstone_wall_torch[lit=true]", + "76:5": "minecraft:redstone_torch[lit=true]", "77:0": "minecraft:stone_button[powered=false,facing=east,face=ceiling]", "77:1": "minecraft:stone_button[powered=false,facing=east,face=wall]", "77:2": "minecraft:stone_button[powered=false,facing=west,face=wall]", @@ -598,15 +556,8 @@ "87:0": "minecraft:netherrack", "88:0": "minecraft:soul_sand", "89:0": "minecraft:glowstone", - "90:0": "minecraft:nether_portal", "90:1": "minecraft:nether_portal[axis=x]", "90:2": "minecraft:nether_portal[axis=z]", - "90:5": "minecraft:nether_portal[axis=x]", - "90:6": "minecraft:nether_portal[axis=z]", - "90:9": "minecraft:nether_portal[axis=x]", - "90:10": "minecraft:nether_portal[axis=z]", - "90:13": "minecraft:nether_portal[axis=x]", - "90:14": "minecraft:nether_portal[axis=z]", "91:0": "minecraft:jack_o_lantern[facing=south]", "91:1": "minecraft:jack_o_lantern[facing=west]", "91:2": "minecraft:jack_o_lantern[facing=north]", @@ -866,15 +817,10 @@ "128:6": "minecraft:sandstone_stairs[half=top,shape=straight,facing=south]", "128:7": "minecraft:sandstone_stairs[half=top,shape=straight,facing=north]", "129:0": "minecraft:emerald_ore", - "130:0": "minecraft:ender_chest", "130:2": "minecraft:ender_chest[facing=north]", "130:3": "minecraft:ender_chest[facing=south]", "130:4": "minecraft:ender_chest[facing=west]", "130:5": "minecraft:ender_chest[facing=east]", - "130:10": "minecraft:ender_chest[facing=north]", - "130:11": "minecraft:ender_chest[facing=south]", - "130:12": "minecraft:ender_chest[facing=west]", - "130:13": "minecraft:ender_chest[facing=east]", "131:0": "minecraft:tripwire_hook[powered=false,attached=false,facing=south]", "131:1": "minecraft:tripwire_hook[powered=false,attached=false,facing=west]", "131:2": "minecraft:tripwire_hook[powered=false,attached=false,facing=north]", @@ -1007,15 +953,10 @@ "145:9": "minecraft:damaged_anvil[facing=west]", "145:10": "minecraft:damaged_anvil[facing=north]", "145:11": "minecraft:damaged_anvil[facing=east]", - "146:0": "minecraft:trapped_chest", "146:2": "minecraft:trapped_chest[facing=north,type=single]", "146:3": "minecraft:trapped_chest[facing=south,type=single]", "146:4": "minecraft:trapped_chest[facing=west,type=single]", "146:5": "minecraft:trapped_chest[facing=east,type=single]", - "146:10": "minecraft:trapped_chest[facing=north,type=single]", - "146:11": "minecraft:trapped_chest[facing=south,type=single]", - "146:12": "minecraft:trapped_chest[facing=west,type=single]", - "146:13": "minecraft:trapped_chest[facing=east,type=single]", "147:0": "minecraft:light_weighted_pressure_plate[power=0]", "147:1": "minecraft:light_weighted_pressure_plate[power=1]", "147:2": "minecraft:light_weighted_pressure_plate[power=2]", @@ -1283,15 +1224,10 @@ "176:13": "minecraft:white_banner[rotation=13]", "176:14": "minecraft:white_banner[rotation=14]", "176:15": "minecraft:white_banner[rotation=15]", - "177:0": "minecraft:white_wall_banner", "177:2": "minecraft:white_wall_banner[facing=north]", "177:3": "minecraft:white_wall_banner[facing=south]", "177:4": "minecraft:white_wall_banner[facing=west]", "177:5": "minecraft:white_wall_banner[facing=east]", - "177:10": "minecraft:white_wall_banner[facing=north]", - "177:11": "minecraft:white_wall_banner[facing=south]", - "177:12": "minecraft:white_wall_banner[facing=west]", - "177:13": "minecraft:white_wall_banner[facing=east]", "178:0": "minecraft:daylight_detector[inverted=true,power=0]", "178:1": "minecraft:daylight_detector[inverted=true,power=1]", "178:2": "minecraft:daylight_detector[inverted=true,power=2]", @@ -2196,7 +2132,7 @@ "321:0": "minecraft:painting", "322:0": "minecraft:golden_apple", "322:1": "minecraft:enchanted_golden_apple", - "323:0": "minecraft:oak_sign", + "323:0": "minecraft:sign", "324:0": "minecraft:oak_door", "325:0": "minecraft:bucket", "326:0": "minecraft:water_bucket", diff --git a/worldedit-core/src/test/java/com/sk89q/minecraft/util/commands/CommandContextTest.java b/worldedit-core/src/test/java/com/sk89q/minecraft/util/commands/CommandContextTest.java index 555c83889..1a010265b 100644 --- a/worldedit-core/src/test/java/com/sk89q/minecraft/util/commands/CommandContextTest.java +++ b/worldedit-core/src/test/java/com/sk89q/minecraft/util/commands/CommandContextTest.java @@ -19,19 +19,20 @@ package com.sk89q.minecraft.util.commands; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Arrays; import java.util.HashSet; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; public class CommandContextTest { @@ -39,7 +40,7 @@ public class CommandContextTest { private static final String firstCmdString = "herpderp -opw testers \"mani world\" 'another thing' because something"; CommandContext firstCommand; - @Before + @BeforeEach public void setUpTest() { try { firstCommand = new CommandContext(firstCmdString, new HashSet<>(Arrays.asList('o', 'w'))); @@ -49,10 +50,12 @@ public class CommandContextTest { } } - @Test(expected = CommandException.class) - public void testInvalidFlags() throws CommandException { + @Test + public void testInvalidFlags() { final String failingCommand = "herpderp -opw testers"; + assertThrows(CommandException.class, () -> { new CommandContext(failingCommand, new HashSet<>(Arrays.asList('o', 'w'))); + }); } @Test diff --git a/worldedit-core/src/test/java/com/sk89q/worldedit/extent/transform/BlockTransformExtentTest.java b/worldedit-core/src/test/java/com/sk89q/worldedit/extent/transform/BlockTransformExtentTest.java index 7a1fa379a..f18ec27f4 100644 --- a/worldedit-core/src/test/java/com/sk89q/worldedit/extent/transform/BlockTransformExtentTest.java +++ b/worldedit-core/src/test/java/com/sk89q/worldedit/extent/transform/BlockTransformExtentTest.java @@ -19,34 +19,29 @@ package com.sk89q.worldedit.extent.transform; -import static org.junit.Assert.assertEquals; - import com.sk89q.worldedit.math.transform.AffineTransform; import com.sk89q.worldedit.math.transform.Transform; -import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockType; -import com.sk89q.worldedit.world.block.BlockTypes; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; - import java.util.HashSet; import java.util.Set; +import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; -@Ignore("A platform is currently required to get properties, preventing this test.") +@Disabled("A platform is currently required to get properties, preventing this test.") public class BlockTransformExtentTest { private static final Transform ROTATE_90 = new AffineTransform().rotateY(-90); private static final Transform ROTATE_NEG_90 = new AffineTransform().rotateY(90); private final Set ignored = new HashSet<>(); - @Before - public void setUp() throws Exception { + @BeforeEach + public void setUp() { // BlockType.REGISTRY.register("worldedit:test", new BlockType("worldedit:test")); } @Test - public void testTransform() throws Exception { + public void testTransform() { // for (BlockType type : BlockType.REGISTRY.values()) { // if (ignored.contains(type)) { // continue; @@ -66,4 +61,4 @@ public class BlockTransformExtentTest { // assertEquals(base, rotated); // } } -} \ No newline at end of file +} diff --git a/worldedit-core/src/test/resources/junit-platform.properties b/worldedit-core/src/test/resources/junit-platform.properties new file mode 100644 index 000000000..ee7c4fad3 --- /dev/null +++ b/worldedit-core/src/test/resources/junit-platform.properties @@ -0,0 +1,5 @@ +junit.jupiter.execution.parallel.enabled=true +junit.jupiter.execution.parallel.mode.default=concurrent +junit.jupiter.execution.parallel.mode.classes.default=same_thread +junit.jupiter.execution.parallel.config.strategy=dynamic +junit.jupiter.execution.parallel.config.dynamic.factor=4 diff --git a/worldedit-libs/core/ap/build.gradle.kts b/worldedit-libs/core/ap/build.gradle.kts index 1c3c3e8d8..44374359b 100644 --- a/worldedit-libs/core/ap/build.gradle.kts +++ b/worldedit-libs/core/ap/build.gradle.kts @@ -1,11 +1,6 @@ applyLibrariesConfiguration() dependencies { -/* - "shade"("FAWE-Piston:core/build/libs/core-${Versions.PISTON}:lastSuccessfulBuild@jar") - "shade"("FAWE-Piston:core-ap/runtime/build/libs/runtime-${Versions.PISTON}:lastSuccessfulBuild@jar") - "shade"("FAWE-Piston:default-impl/build/libs/default-impl-${Versions.PISTON}:lastSuccessfulBuild@jar") -*/ "shade"("org.enginehub.piston.core-ap:annotations:${Versions.PISTON}") "shade"("org.enginehub.piston.core-ap:processor:${Versions.PISTON}") } diff --git a/worldedit-libs/core/build.gradle.kts b/worldedit-libs/core/build.gradle.kts index f413cdb48..d669216d6 100644 --- a/worldedit-libs/core/build.gradle.kts +++ b/worldedit-libs/core/build.gradle.kts @@ -13,9 +13,4 @@ dependencies { "shade"("org.enginehub.piston:core:${Versions.PISTON}") "shade"("org.enginehub.piston.core-ap:runtime:${Versions.PISTON}") "shade"("org.enginehub.piston:default-impl:${Versions.PISTON}") -/* - "shade"("FAWE-Piston:core/build/libs/core-${Versions.PISTON}:lastSuccessfulBuild@jar") - "shade"("FAWE-Piston:core-ap/runtime/build/libs/runtime-${Versions.PISTON}:lastSuccessfulBuild@jar") - "shade"("FAWE-Piston:default-impl/build/libs/default-impl-${Versions.PISTON}:lastSuccessfulBuild@jar") -*/ } From cc7e452d4b0555df351fe4ed02df830338c407bd Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Thu, 22 Aug 2019 13:17:30 -0400 Subject: [PATCH 14/24] We aren't even using this yet --- worldedit-core/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-core/build.gradle.kts b/worldedit-core/build.gradle.kts index 16513720b..fe178e110 100644 --- a/worldedit-core/build.gradle.kts +++ b/worldedit-core/build.gradle.kts @@ -32,7 +32,7 @@ dependencies { "annotationProcessor"("com.google.auto.value:auto-value:${Versions.AUTO_VALUE}") "compile"("co.aikar:fastutil-lite:1.0") "compile"("com.github.luben:zstd-jni:1.1.1") - "compile"("com.mojang:datafixerupper:1.0.20") + //"compile"("com.mojang:datafixerupper:1.0.20") "compileOnly"("com.github.intellectualsites.plotsquared:PlotSquared-API:latest") { isTransitive = false } From 32b9aa26b249e83e227e7500902c0f3b368caedd Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Thu, 22 Aug 2019 13:20:29 -0400 Subject: [PATCH 15/24] Re-add accidentally removed method --- .../main/java/com/boydti/fawe/bukkit/wrapper/AsyncWorld.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncWorld.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncWorld.java index 78f322654..0a0e9d617 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncWorld.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncWorld.java @@ -1098,6 +1098,11 @@ public class AsyncWorld extends PassthroughExtent implements World { return parent.locateNearestStructure(arg0, arg1, arg2, arg3); } + @Override + public int getViewDistance() { + return parent.getViewDistance(); + } + @Override public RayTraceResult rayTrace(Location arg0, Vector arg1, double arg2, FluidCollisionMode arg3, boolean arg4, double arg5, Predicate arg6) { From b2ca05bc542cad0a3376073afbd5fe1f17311e69 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Thu, 22 Aug 2019 15:11:13 -0400 Subject: [PATCH 16/24] shade in missing dependency --- worldedit-core/build.gradle.kts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/worldedit-core/build.gradle.kts b/worldedit-core/build.gradle.kts index fe178e110..35a835444 100644 --- a/worldedit-core/build.gradle.kts +++ b/worldedit-core/build.gradle.kts @@ -1,3 +1,5 @@ +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar + plugins { id("java-library") id("net.ltgt.apt-eclipse") @@ -63,3 +65,9 @@ tasks.named("processResources") { // expand("date" to "TODO Date") } } +tasks.named("shadowJar") { + dependencies { + include(dependency("com.github.luben:zstd-jni:1.1.1")) + + } +} From 37d3fcd01cf7b3ca004003a2aecb6ca71c2fe508 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Thu, 22 Aug 2019 15:21:38 -0400 Subject: [PATCH 17/24] upgrade zstd --- worldedit-core/build.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worldedit-core/build.gradle.kts b/worldedit-core/build.gradle.kts index 35a835444..11b8e61db 100644 --- a/worldedit-core/build.gradle.kts +++ b/worldedit-core/build.gradle.kts @@ -33,7 +33,7 @@ dependencies { "compileOnly"("com.google.auto.value:auto-value-annotations:${Versions.AUTO_VALUE}") "annotationProcessor"("com.google.auto.value:auto-value:${Versions.AUTO_VALUE}") "compile"("co.aikar:fastutil-lite:1.0") - "compile"("com.github.luben:zstd-jni:1.1.1") + "compile"("com.github.luben:zstd-jni:1.4.3-1") //"compile"("com.mojang:datafixerupper:1.0.20") "compileOnly"("com.github.intellectualsites.plotsquared:PlotSquared-API:latest") { isTransitive = false @@ -67,7 +67,7 @@ tasks.named("processResources") { } tasks.named("shadowJar") { dependencies { - include(dependency("com.github.luben:zstd-jni:1.1.1")) + include(dependency("com.github.luben:zstd-jni:1.4.3-1")) } } From b5b89412d9169eecd88273892e5fb13e93809256 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Thu, 22 Aug 2019 16:12:50 -0400 Subject: [PATCH 18/24] Let's try this --- build.gradle.kts | 11 +++++++++++ worldedit-core/build.gradle.kts | 5 ++--- worldedit-libs/core/build.gradle.kts | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 39f055c99..ea6b26bb8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,9 @@ import org.ajoberstar.grgit.Grgit +plugins { + id("com.gradle.build-scan") version "2.4.1" +} + logger.lifecycle(""" ******************************************* You are building WorldEdit! @@ -46,3 +50,10 @@ if (!project.hasProperty("gitCommitHash")) { "no_git_id" } } + +buildScan { + setTermsOfServiceUrl("https://gradle.com/terms-of-service") + setTermsOfServiceAgree("yes") + + publishAlways() +} diff --git a/worldedit-core/build.gradle.kts b/worldedit-core/build.gradle.kts index 11b8e61db..f84a33feb 100644 --- a/worldedit-core/build.gradle.kts +++ b/worldedit-core/build.gradle.kts @@ -20,12 +20,11 @@ dependencies { "compile"("rhino:js:1.7R2") "compile"("org.yaml:snakeyaml:1.23") "compile"("com.google.guava:guava:21.0") - "compile"("com.google.code.findbugs:jsr305:1.3.9") + "compile"("com.google.code.findbugs:jsr305:3.0.2") "compile"("com.google.code.gson:gson:2.8.0") "compile"("org.slf4j:slf4j-api:1.7.26") "compile"("it.unimi.dsi:fastutil:8.2.1") - "compile"("com.googlecode.json-simple:json-simple:1.1.1") - + "compile"("com.googlecode.json-simple:json-simple:1.1.1") { isTransitive = false } "compileOnly"(project(":worldedit-libs:core:ap")) "annotationProcessor"(project(":worldedit-libs:core:ap")) // ensure this is on the classpath for the AP diff --git a/worldedit-libs/core/build.gradle.kts b/worldedit-libs/core/build.gradle.kts index d669216d6..6e2505b51 100644 --- a/worldedit-libs/core/build.gradle.kts +++ b/worldedit-libs/core/build.gradle.kts @@ -8,6 +8,7 @@ dependencies { "shade"("com.sk89q:jchronic:0.2.4a") { exclude(group = "junit", module = "junit") } + "shade"("com.github.luben:zstd-jni:1.4.3-1") "shade"("com.thoughtworks.paranamer:paranamer:2.6") "shade"("com.sk89q.lib:jlibnoise:1.0.0") "shade"("org.enginehub.piston:core:${Versions.PISTON}") From 70d4af006abaa4e9ed164ad5a4ebfd6d77885e80 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Thu, 22 Aug 2019 21:06:03 -0400 Subject: [PATCH 19/24] attempt at setting up fawe.properties --- build.gradle.kts | 25 +++++++++++++++++++++++++ gradle.properties | 2 +- worldedit-core/build.gradle.kts | 6 +++--- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index ea6b26bb8..e189f6b82 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,5 @@ import org.ajoberstar.grgit.Grgit +import java.time.format.DateTimeFormatter plugins { id("com.gradle.build-scan") version "2.4.1" @@ -18,6 +19,28 @@ logger.lifecycle(""" ******************************************* """) //TODO FIX THIS WHEN I FEEL LIKE IT +var rootVersion = "1.13" +var revision: String = "" +var buildNumber = "" +var date: String = "" +ext { + val git: Grgit = Grgit.open { + dir = File(rootDir.toString() + "/.git"); + } + ext["date"] = git.head().dateTime.format(DateTimeFormatter.ofPattern("yy.MM.dd")); + ext["revision"] = "-${git.head().abbreviatedId}"; + var parents: MutableList? = git.head().parentIds; + if (project.hasProperty("buildnumber")) { + buildNumber = project.properties["buildnumber"] as String; + } else { + var index = -2109; // Offset to match CI + while (parents != null && parents.isNotEmpty()) { + parents = git.getResolve().toCommit(parents.get(0)).getParentIds() + index++; + } + buildNumber = index.toString(); + } +} //def rootVersion = "1.13" //def revision = "" //def buildNumber = "" @@ -40,6 +63,8 @@ logger.lifecycle(""" // //version = String.format("%s.%s", rootVersion, buildNumber) +version = String.format("%s.%s", rootVersion, buildNumber) + if (!project.hasProperty("gitCommitHash")) { apply(plugin = "org.ajoberstar.grgit") ext["gitCommitHash"] = try { diff --git a/gradle.properties b/gradle.properties index 4d41d3dcb..5432e7cfb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ group=com.sk89q.worldedit -version=7.1.0-SNAPSHOT +#version=7.1.0-SNAPSHOT org.gradle.jvmargs=-Xmx1G diff --git a/worldedit-core/build.gradle.kts b/worldedit-core/build.gradle.kts index f84a33feb..cc7e924cf 100644 --- a/worldedit-core/build.gradle.kts +++ b/worldedit-core/build.gradle.kts @@ -59,9 +59,9 @@ sourceSets { tasks.named("processResources") { filesMatching("fawe.properties") { -// expand("version" to project.ext["internalVersion"]) -// expand("commit" to "TODO GIT") -// expand("date" to "TODO Date") + expand("version" to "$version") + expand("commit" to "${rootProject.ext["revision"]}") + expand("date" to "${rootProject.ext["date"]}") } } tasks.named("shadowJar") { From c36db8de3765987501b1d7b16003e0c30ad2b6a5 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Thu, 22 Aug 2019 21:10:31 -0400 Subject: [PATCH 20/24] Attempt 2 --- worldedit-core/build.gradle.kts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/worldedit-core/build.gradle.kts b/worldedit-core/build.gradle.kts index cc7e924cf..2363ab57f 100644 --- a/worldedit-core/build.gradle.kts +++ b/worldedit-core/build.gradle.kts @@ -59,9 +59,9 @@ sourceSets { tasks.named("processResources") { filesMatching("fawe.properties") { - expand("version" to "$version") - expand("commit" to "${rootProject.ext["revision"]}") - expand("date" to "${rootProject.ext["date"]}") + expand("version" to "$version", + "commit" to "${rootProject.ext["revision"]}", + "date" to "${rootProject.ext["date"]}") } } tasks.named("shadowJar") { From d2063a210e0e20df8dfca084583029bd1c8ddd6b Mon Sep 17 00:00:00 2001 From: wizjany Date: Tue, 6 Aug 2019 23:07:26 -0400 Subject: [PATCH 21/24] Update/remove more dead links. (cherry picked from commit 17cfdee347a0b9f9619b4ce13587378959c2c6ba) --- .../main/java/com/sk89q/wepif/PermissionsResolverManager.java | 4 ---- worldedit-forge/src/main/resources/META-INF/mods.toml | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/wepif/PermissionsResolverManager.java b/worldedit-bukkit/src/main/java/com/sk89q/wepif/PermissionsResolverManager.java index 6514912a8..68903f9c3 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/wepif/PermissionsResolverManager.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/wepif/PermissionsResolverManager.java @@ -57,10 +57,6 @@ public class PermissionsResolverManager implements PermissionsResolver { "# into WEPIF, paste it into http://yaml-online-parser.appspot.com/\r\n" + "# and see if it gives \"ERROR:\".\r\n" + "# - Lines starting with # are comments and so they are ignored.\r\n" + - "#\r\n" + - "# About Configuration Permissions\r\n" + - "# - See http://wiki.sk89q.com/wiki/WorldEdit/Permissions/Bukkit\r\n" + - "# - Now with multiworld support (see example)\r\n" + "\r\n"; private static PermissionsResolverManager instance; diff --git a/worldedit-forge/src/main/resources/META-INF/mods.toml b/worldedit-forge/src/main/resources/META-INF/mods.toml index 07b5ff1a0..1f6e628a7 100644 --- a/worldedit-forge/src/main/resources/META-INF/mods.toml +++ b/worldedit-forge/src/main/resources/META-INF/mods.toml @@ -5,7 +5,7 @@ loaderVersion="[24,)" # A URL to refer people to when problems occur with this mod issueTrackerURL="https://discord.gg/enginehub" # A URL for the "homepage" for this mod, displayed in the mod UI -displayURL="http://wiki.sk89q.com/wiki/WorldEdit/" +displayURL="https://worldedit.enginehub.org/" # A file name (in the root of the mod JAR) containing a logo for display logoFile="worldedit-icon.png" # A text field displayed in the mod UI From a62cbce7874e989965c46391269d8dbc78025f96 Mon Sep 17 00:00:00 2001 From: wizjany Date: Tue, 6 Aug 2019 21:49:43 -0400 Subject: [PATCH 22/24] Update docs links to point to enginehub. (cherry picked from commit 95d5adb30c6e6eee62f55a634101300a9d7ded67) --- .../com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java index 085c88226..dd68d75df 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java @@ -54,7 +54,7 @@ public class BukkitImplLoader { "** will be blank, and so on. There will be no support for entity\n" + "** and block property-related functions.\n" + "**\n" + - "** Please see https://worldedit.rtfd.io/en/latest/faq/#bukkit-adapters\n" + + "** Please see https://worldedit.enginehub.org/en/latest/faq/#bukkit-adapters\n" + "**********************************************\n"; /** From 20fff1c668f3369711844cd1a90bca5e376f802b Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Thu, 22 Aug 2019 21:40:22 -0400 Subject: [PATCH 23/24] Commands can't have overlapping aliases --- .../main/java/com/sk89q/worldedit/command/BrushCommands.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java index 61b19247e..88dbd76dd 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java @@ -780,7 +780,7 @@ public class BrushCommands { @Command( name = "copypaste", - aliases = {"copy", "paste", "cp", "copypasta"}, + aliases = {"cp", "copypasta"}, desc = "Copy Paste brush", descFooter = "Left click the base of an object to copy.\n" + "Right click to paste\n" + From c5d3c4dca7ea2137fcc104e53ddec55e2246b177 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Fri, 23 Aug 2019 15:48:51 +0200 Subject: [PATCH 24/24] Build "Fawe" and credit Matt :heart: Also update PlotSquared stuff --- build.gradle.kts | 8 ++++---- buildSrc/src/main/kotlin/PlatformConfig.kt | 3 ++- worldedit-bukkit/src/main/resources/plugin.yml | 2 +- .../boydti/fawe/regions/general/plot/PlotSetBiome.java | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index e189f6b82..21be27e98 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,19 +7,19 @@ plugins { logger.lifecycle(""" ******************************************* - You are building WorldEdit! + You are building FastAsyncWorldEdit! If you encounter trouble: 1) Read COMPILING.md if you haven't yet 2) Try running 'build' in a separate Gradle run 3) Use gradlew and not gradle - 4) If you still need help, ask on Discord! https://discord.gg/enginehub + 4) If you still need help, ask on Discord! https://discord.gg/cSMxtGn Output files will be in [subproject]/build/libs ******************************************* """) //TODO FIX THIS WHEN I FEEL LIKE IT -var rootVersion = "1.13" +var rootVersion = "1.14" var revision: String = "" var buildNumber = "" var date: String = "" @@ -63,7 +63,7 @@ ext { // //version = String.format("%s.%s", rootVersion, buildNumber) -version = String.format("%s.%s", rootVersion, buildNumber) +version = String.format("%s-%s", rootVersion, buildNumber) if (!project.hasProperty("gitCommitHash")) { apply(plugin = "org.ajoberstar.grgit") diff --git a/buildSrc/src/main/kotlin/PlatformConfig.kt b/buildSrc/src/main/kotlin/PlatformConfig.kt index 9a4d27a8f..e33302f03 100644 --- a/buildSrc/src/main/kotlin/PlatformConfig.kt +++ b/buildSrc/src/main/kotlin/PlatformConfig.kt @@ -94,12 +94,13 @@ fun Project.applyPlatformAndCoreConfiguration() { fun Project.applyShadowConfiguration() { tasks.named("shadowJar") { - archiveClassifier.set("dist") +// archiveClassifier.set("dist") dependencies { include(project(":worldedit-libs:core")) include(project(":worldedit-libs:${project.name.replace("worldedit-", "")}")) include(project(":worldedit-core")) } + archiveName = "FastAsyncWorldEdit-${project.version}.jar" exclude("GradleStart**") exclude(".cache") exclude("LICENSE*") diff --git a/worldedit-bukkit/src/main/resources/plugin.yml b/worldedit-bukkit/src/main/resources/plugin.yml index 7683c521d..d9dbe048d 100644 --- a/worldedit-bukkit/src/main/resources/plugin.yml +++ b/worldedit-bukkit/src/main/resources/plugin.yml @@ -4,7 +4,7 @@ version: "${internalVersion}" load: STARTUP api-version: 1.13 description: Fast Async WorldEdit plugin -authors: [Empire92] +authors: [Empire92, MattBDev] loadbefore: [BannerBoard, WorldGuard, PlotSquared, AsyncWorldEdit, AsyncWorldEditInjector] database: false permissions: diff --git a/worldedit-core/src/main/java/com/boydti/fawe/regions/general/plot/PlotSetBiome.java b/worldedit-core/src/main/java/com/boydti/fawe/regions/general/plot/PlotSetBiome.java index 36e7e6d9b..ea0381916 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/regions/general/plot/PlotSetBiome.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/regions/general/plot/PlotSetBiome.java @@ -59,9 +59,9 @@ public class PlotSetBiome extends Command { Collection knownBiomes = BiomeTypes.values(); final BiomeType biome = Biomes.findBiomeByName(knownBiomes, args[0], biomeRegistry); if (biome == null) { - String biomes = StringMan.join(WorldUtil.IMP.getBiomeList(), Captions.BLOCK_LIST_SEPARATER.s()); + String biomes = StringMan.join(WorldUtil.IMP.getBiomeList(), Captions.BLOCK_LIST_SEPARATER.toString()); Captions.NEED_BIOME.send(player); - MainUtil.sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.s() + biomes); + MainUtil.sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.toString() + biomes); return; } confirm.run(this, new Runnable() {