diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/VoxelSniper.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/VoxelSniper.java index f86410a6f..715d774fa 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/VoxelSniper.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/VoxelSniper.java @@ -169,6 +169,7 @@ public class VoxelSniper extends JavaPlugin brushManager.registerSniperBrush(EntityRemovalBrush.class, "er", "entityremoval"); brushManager.registerSniperBrush(EraserBrush.class, "erase", "eraser"); brushManager.registerSniperBrush(ErodeBrush.class, "e", "erode"); + brushManager.registerSniperBrush(ErodeBlendBrush.class, "eb", "erodeblend", "erodeblendball"); brushManager.registerSniperBrush(ExtrudeBrush.class, "ex", "extrude"); brushManager.registerSniperBrush(FillDownBrush.class, "fd", "filldown"); brushManager.registerSniperBrush(FlatOceanBrush.class, "fo", "flatocean"); @@ -218,6 +219,7 @@ public class VoxelSniper extends JavaPlugin brushManager.registerSniperBrush(VoxelDiscBrush.class, "vd", "voxeldisc"); brushManager.registerSniperBrush(VoxelDiscFaceBrush.class, "vdf", "voxeldiscface"); brushManager.registerSniperBrush(WarpBrush.class, "w", "warp"); + brushManager.registerSniperBrush(WallSider.class, "wallsider", "sider"); } public void setupCommand(final String label, final FaweCommand cmd) { diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ErodeBlendBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ErodeBlendBrush.java new file mode 100644 index 000000000..3f81e05f4 --- /dev/null +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ErodeBlendBrush.java @@ -0,0 +1,52 @@ +package com.thevoxelbox.voxelsniper.brush; + +import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; + +public class ErodeBlendBrush extends Brush{ + + private BlendBallBrush blendBall; + private ErodeBrush erode; + + public ErodeBlendBrush() { + this.blendBall = new BlendBallBrush(); + this.erode = new ErodeBrush(); + this.setName("Erode BlendBall"); + } + + @Override + protected final void arrow(final SnipeData v) { + this.blendBall.excludeAir = false; + this.blendBall.setTargetBlock(this.getTargetBlock()); + this.blendBall.arrow(v); + this.erode.setTargetBlock(this.getTargetBlock()); + this.erode.arrow(v); + } + + @Override + protected final void powder(final SnipeData v) { + this.blendBall.excludeAir = false; + this.blendBall.setTargetBlock(this.getTargetBlock()); + this.blendBall.arrow(v); + this.erode.setTargetBlock(this.getTargetBlock()); + this.erode.powder(v); + } + + @Override + public final void parameters(final String[] par, final SnipeData v) { + this.blendBall.parameters(par, v); + this.erode.parameters(par, v); + } + + @Override + public String getPermissionNode() { + return "voxelsniper.brush.erodeblend"; + } + + @Override + public void info(Message vm) { + this.erode.info(vm); + this.blendBall.info(vm); + } + +} diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/WallSider.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/WallSider.java new file mode 100644 index 000000000..a083bd4b0 --- /dev/null +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/WallSider.java @@ -0,0 +1,139 @@ +package com.thevoxelbox.voxelsniper.brush; + +import org.bukkit.ChatColor; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.util.Vector; + +import com.boydti.fawe.bukkit.wrapper.AsyncBlock; +import com.thevoxelbox.voxelsniper.Message; +import com.thevoxelbox.voxelsniper.SnipeData; + +public class WallSider extends Brush{ + + private static String[] facings = new String[] { "north", "east", "south", "west", "relative to player" }; + private short c; + private short d; + private double e; + private boolean f; + private boolean g; + private boolean h; + + public WallSider() { + this.c = 4; + this.d = 1; + this.e = 0.0; + this.setName("WallSider"); + } + + private void a(final SnipeData snipeData, final Block block, final boolean b) { + final double n = (snipeData.getBrushSize() + this.e) * (snipeData.getBrushSize() + this.e); + final Vector vector; + final Vector clone = (vector = block.getLocation().toVector()).clone(); + int c; + if (this.c == 4) { + double n2; + if ((n2 = (snipeData.owner().getPlayer().getLocation().getYaw() - 90.0f) % 360.0f) < 0.0) { + n2 += 360.0; + } + c = ((0.0 >= n2 && n2 < 45.0) ? 2 : ((45.0 >= n2 && n2 < 135.0) ? 3 : ((135.0 >= n2 && n2 < 225.0) ? 0 : ((225.0 >= n2 && n2 < 315.0) ? 1 : ((315.0 >= n2 && n2 < 360.0) ? 2 : -1))))); + } + else { + c = this.c; + } + int n3 = c; + if (b) { + n3 = (short)((n3 + 2) % 4); + } + int n4 = 98; + if (n3 == 0 || n3 == 2) { + n4 = 97; + } + for (int i = -snipeData.getBrushSize(); i <= snipeData.getBrushSize(); ++i) { + if (n4 == 97) { + clone.setX(vector.getX() + i); + } + else { + clone.setZ(vector.getZ() + i); + } + for (int j = -snipeData.getBrushSize(); j <= snipeData.getBrushSize(); ++j) { + clone.setY(vector.getY() + j); + if (vector.distanceSquared(clone) <= n) { + for (short n5 = 0; n5 < this.d; ++n5) { + if (n4 == 97) { + clone.setZ(vector.getZ() + ((n3 == 2) ? n5 : (-n5))); + } + else { + clone.setX(vector.getX() + ((n3 == 1) ? n5 : (-n5))); + } + final AsyncBlock block2 = this.getWorld().getBlockAt(clone.getBlockX(), clone.getBlockY(), clone.getBlockZ()); + if ((this.f && block2.getTypeId() == snipeData.getReplaceId()) || (!this.f && (block2.getTypeId() != 0 || this.g))) { + block2.setTypeId(snipeData.getVoxelId()); + } + } + if (n4 == 97) { + clone.setZ(vector.getZ()); + } + else { + clone.setX(vector.getX()); + } + } + } + } + } + + @Override + protected final void arrow(final SnipeData snipeData) { + this.a(snipeData, this.getTargetBlock(), false); + } + + @Override + protected final void powder(final SnipeData snipeData) { + this.a(snipeData, this.getTargetBlock(), true); + } + + public final void parameters(final String[] array, final SnipeData snipeData) { + for (int i = 1; i < array.length; ++i) { + final String lowerCase; + if ((lowerCase = array[i].toLowerCase()).startsWith("d")) { + this.d = (short)Integer.parseInt(lowerCase.replace("d", "")); + snipeData.sendMessage(ChatColor.AQUA + "Depth set to " + this.d + " blocks"); + } + else if (lowerCase.startsWith("s")) { + this.c = (short)Integer.parseInt(lowerCase.replace("s", "")); + if (this.c > 4 || this.c < 0) { + this.c = 4; + } + snipeData.sendMessage(ChatColor.AQUA + "Orientation set to " + this.facings[this.c]); + } + else if (lowerCase.startsWith("true")) { + this.e = 0.5; + snipeData.sendMessage(ChatColor.AQUA + "True circle mode ON."); + } + else if (lowerCase.startsWith("false")) { + this.e = 0.0; + snipeData.sendMessage(ChatColor.AQUA + "True circle mode OFF."); + } + else if (lowerCase.startsWith("air")) { + this.g = true; + snipeData.sendMessage(ChatColor.AQUA + "Including air."); + } + else if (lowerCase.startsWith("mm")) { + this.f = true; + snipeData.sendMessage(ChatColor.AQUA + "Replacing block."); + } + } + } + + @Override + public String getPermissionNode() { + return "voxelsniper.brush.wallsider"; + } + + @Override + public void info(Message vm) { + // TODO Auto-generated method stub + + } + +} diff --git a/favs/src/main/resources/plugin.yml b/favs/src/main/resources/plugin.yml index fa6b1e7b1..f021c1e57 100644 --- a/favs/src/main/resources/plugin.yml +++ b/favs/src/main/resources/plugin.yml @@ -146,6 +146,7 @@ permissions: voxelsniper.brush.ellipsoid: true voxelsniper.brush.eraser: true voxelsniper.brush.erode: true + voxelsniper.brush.erodeblend: true voxelsniper.brush.extrude: true voxelsniper.brush.filldown: true voxelsniper.brush.flatocean: true @@ -190,6 +191,7 @@ permissions: voxelsniper.brush.voxeldisc: true voxelsniper.brush.voxeldiscface: true voxelsniper.brush.warp: true + voxelsniper.brush.wallsider: true voxelsniper.goto: true voxelsniper.sniper: true voxelsniper.sniper: @@ -228,6 +230,7 @@ permissions: voxelsniper.brush.entityremoval: true voxelsniper.brush.eraser: true voxelsniper.brush.erode: true + voxelsniper.brush.erodeblend: true voxelsniper.brush.extrude: true voxelsniper.brush.filldown: true voxelsniper.brush.flatocean: true @@ -279,6 +282,7 @@ permissions: voxelsniper.brush.voxeldisc: true voxelsniper.brush.voxeldiscface: true voxelsniper.brush.warp: true + voxelsniper.brush.wallsider: true voxelsniper.brush.ball: default: op voxelsniper.brush.biome: @@ -333,6 +337,8 @@ permissions: default: op voxelsniper.brush.erode: default: op + voxelsniper.brush.erodeblend: + default: op voxelsniper.brush.extrude: default: op voxelsniper.brush.filldown: @@ -433,5 +439,7 @@ permissions: default: op voxelsniper.brush.voxeldiscface: default: op + voxelsniper.brush.wallsider: + default: op voxelsniper.brush.warp: default: op \ No newline at end of file diff --git a/worldedit-bukkit/build.gradle b/worldedit-bukkit/build.gradle index 5e5b3f48b..7795bc73a 100644 --- a/worldedit-bukkit/build.gradle +++ b/worldedit-bukkit/build.gradle @@ -10,7 +10,7 @@ repositories { dependencies { compile project(':worldedit-core') compile 'com.sk89q:dummypermscompat:1.8' - compile 'com.destroystokyo.paper:paper-api:1.13-R0.1-SNAPSHOT' + compile 'com.destroystokyo.paper:paper-api:1.13.2-R0.1-SNAPSHOT' compile 'org.spigotmc:spigot:1.13.2-R0.1-SNAPSHOT' testCompile 'org.mockito:mockito-core:1.9.0-rc1' compile 'net.milkbowl.vault:VaultAPI:1.5.6' diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncBlock.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncBlock.java index e13815f15..6dd902195 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncBlock.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncBlock.java @@ -10,6 +10,8 @@ import java.util.List; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.world.block.BlockTypes; + +import org.bukkit.FluidCollisionMode; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Biome; @@ -20,6 +22,8 @@ import org.bukkit.block.data.BlockData; import org.bukkit.inventory.ItemStack; import org.bukkit.metadata.MetadataValue; import org.bukkit.plugin.Plugin; +import org.bukkit.util.RayTraceResult; +import org.bukkit.util.Vector; public class AsyncBlock implements Block { @@ -343,4 +347,14 @@ public class AsyncBlock implements Block { public void removeMetadata(String metadataKey, Plugin owningPlugin) { this.getUnsafeBlock().removeMetadata(metadataKey, owningPlugin); } + + @Override + public boolean isPassable() { + return this.getUnsafeBlock().isPassable(); + } + + @Override + public RayTraceResult rayTrace(Location arg0, Vector arg1, double arg2, FluidCollisionMode arg3) { + return this.getUnsafeBlock().rayTrace(arg0, arg1, arg2, arg3); + } } diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncChunk.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncChunk.java index 84d9d33cc..4c5711ebd 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncChunk.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncChunk.java @@ -182,4 +182,14 @@ public class AsyncChunk implements Chunk { public boolean isSlimeChunk() { return false; } + + @Override + public boolean isForceLoaded() { + return world.isChunkForceLoaded(x, z); + } + + @Override + public void setForceLoaded(boolean arg0) { + world.getChunkAt(x, z).setForceLoaded(arg0); + } } 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 4b04493be..a34885550 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 @@ -18,6 +18,8 @@ import java.util.Collection; import java.util.List; import java.util.Set; import java.util.UUID; +import java.util.concurrent.CompletableFuture; +import java.util.function.Predicate; import java.util.function.Supplier; import com.sk89q.worldedit.world.block.BlockTypes; @@ -39,7 +41,9 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.material.MaterialData; import org.bukkit.metadata.MetadataValue; import org.bukkit.plugin.Plugin; +import org.bukkit.util.BoundingBox; import org.bukkit.util.Consumer; +import org.bukkit.util.RayTraceResult; import org.bukkit.util.Vector; /** @@ -1181,4 +1185,96 @@ public class AsyncWorld extends DelegateFaweQueue implements World, HasFaweQueue } }); } + + @Override + public CompletableFuture getChunkAtAsync(int arg0, int arg1, boolean arg2) { + return parent.getChunkAtAsync(arg0, arg1, arg2); + } + + @Override + public Collection getNearbyEntities(BoundingBox arg0) { + return parent.getNearbyEntities(arg0); + } + + @Override + public Collection getNearbyEntities(BoundingBox arg0, Predicate arg1) { + return parent.getNearbyEntities(arg0, arg1); + } + + @Override + public Collection getNearbyEntities(Location arg0, double arg1, double arg2, double arg3, + Predicate arg4) { + return parent.getNearbyEntities(arg0, arg1, arg2, arg3, arg4); + } + + @Override + public boolean isChunkForceLoaded(int arg0, int arg1) { + return parent.isChunkForceLoaded(arg0, arg1); + } + + @Override + public boolean isDayTime() { + return parent.isDayTime(); + } + + @Override + public Location locateNearestStructure(Location arg0, StructureType arg1, int arg2, boolean arg3) { + return parent.locateNearestStructure(arg0, arg1, arg2, arg3); + } + + @Override + public RayTraceResult rayTrace(Location arg0, Vector arg1, double arg2, FluidCollisionMode arg3, boolean arg4, + double arg5, Predicate arg6) { + return parent.rayTrace(arg0, arg1, arg2, arg3, arg4, arg5, arg6); + } + + @Override + public RayTraceResult rayTraceBlocks(Location arg0, Vector arg1, double arg2) { + return parent.rayTraceBlocks(arg0, arg1, arg2); + } + + @Override + public RayTraceResult rayTraceBlocks(Location arg0, Vector arg1, double arg2, FluidCollisionMode arg3) { + return parent.rayTraceBlocks(arg0, arg1, arg2, arg3); + } + + @Override + public RayTraceResult rayTraceBlocks(Location arg0, Vector arg1, double arg2, FluidCollisionMode arg3, + boolean arg4) { + return parent.rayTraceBlocks(arg0, arg1, arg2, arg3, arg4); + } + + @Override + public RayTraceResult rayTraceEntities(Location arg0, Vector arg1, double arg2) { + return parent.rayTraceEntities(arg0, arg1, arg2); + } + + @Override + public RayTraceResult rayTraceEntities(Location arg0, Vector arg1, double arg2, double arg3) { + return parent.rayTraceEntities(arg0, arg1, arg2, arg3); + } + + @Override + public RayTraceResult rayTraceEntities(Location arg0, Vector arg1, double arg2, Predicate arg3) { + return parent.rayTraceEntities(arg0, arg1, arg2, arg3); + } + + @Override + public RayTraceResult rayTraceEntities(Location arg0, Vector arg1, double arg2, double arg3, + Predicate arg4) { + return parent.rayTraceEntities(arg0, arg1, arg2, arg3, arg4); + } + + @Override + public void spawnParticle(Particle arg0, Location arg1, int arg2, double arg3, double arg4, double arg5, + double arg6, T arg7, boolean arg8) { + parent.spawnParticle(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); + } + + @Override + public void spawnParticle(Particle arg0, double arg1, double arg2, double arg3, int arg4, double arg5, + double arg6, double arg7, double arg8, T arg9, boolean arg10) { + parent.spawnParticle(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); + + } } diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/state/AsyncSign.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/state/AsyncSign.java index 54018dc14..1dfb8ab9d 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/state/AsyncSign.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/state/AsyncSign.java @@ -14,6 +14,8 @@ public class AsyncSign extends AsyncBlockState implements Sign { public AsyncSign(AsyncBlock block, int combined) { super(block, combined); } + + private boolean isEditable = false; @Override public String[] getLines() { @@ -51,4 +53,14 @@ public class AsyncSign extends AsyncBlockState implements Sign { map.put("Text" + (index + 1), new StringTag(toJson(line))); } } + + @Override + public boolean isEditable() { + return this.isEditable; + } + + @Override + public void setEditable(boolean arg0) { + this.isEditable = arg0; + } }