solid = new HashSet<>();
- protected Undo undo;
- protected boolean sorted = false;
- protected StampType stamp = StampType.DEFAULT;
-
- public StampBrush() {
- this.setName("Stamp");
- }
-
-
- public final void reSort() {
- this.sorted = false;
- }
-
- protected final boolean falling(final int id) {
- return (id > 7 && id < 14);
- }
-
- protected final boolean fallsOff(final int id) {
- return (BlockTypes.get(id).getMaterial().isFragileWhenPushed());
- }
-
- @SuppressWarnings("deprecation")
- protected final void setBlock(final BlockWrapper cb) {
- final AsyncBlock block = this.clampY(this.getTargetBlock().getX() + cb.x, this.getTargetBlock().getY() + cb.y, this.getTargetBlock().getZ() + cb.z);
- this.undo.put(block);
- block.setTypeId(cb.id);
- block.setPropertyId(cb.d);
- }
-
- @SuppressWarnings("deprecation")
- protected final void setBlockFill(final BlockWrapper cb) {
- final AsyncBlock block = this.clampY(this.getTargetBlock().getX() + cb.x, this.getTargetBlock().getY() + cb.y, this.getTargetBlock().getZ() + cb.z);
- if (block.isEmpty()) {
- this.undo.put(block);
- block.setTypeId(cb.id);
- block.setPropertyId(cb.d);
- }
- }
-
- protected final void setStamp(final StampType type) {
- this.stamp = type;
- }
-
- protected final void stamp(final SnipeData v) {
- this.undo = new Undo();
-
- if (this.sorted) {
- for (final BlockWrapper block : this.solid) {
- this.setBlock(block);
- }
- for (final BlockWrapper block : this.drop) {
- this.setBlock(block);
- }
- for (final BlockWrapper block : this.fall) {
- this.setBlock(block);
- }
- } else {
- this.fall.clear();
- this.drop.clear();
- this.solid.clear();
- for (final BlockWrapper block : this.clone) {
- if (this.fallsOff(block.id)) {
- this.fall.add(block);
- } else if (this.falling(block.id)) {
- this.drop.add(block);
- } else {
- this.solid.add(block);
- this.setBlock(block);
- }
- }
- for (final BlockWrapper block : this.drop) {
- this.setBlock(block);
- }
- for (final BlockWrapper block : this.fall) {
- this.setBlock(block);
- }
- this.sorted = true;
- }
-
- v.owner().storeUndo(this.undo);
- }
-
- protected final void stampFill(final SnipeData v) {
-
- this.undo = new Undo();
-
- if (this.sorted) {
- for (final BlockWrapper block : this.solid) {
- this.setBlockFill(block);
- }
- for (final BlockWrapper block : this.drop) {
- this.setBlockFill(block);
- }
- for (final BlockWrapper block : this.fall) {
- this.setBlockFill(block);
- }
- } else {
- this.fall.clear();
- this.drop.clear();
- this.solid.clear();
- for (final BlockWrapper block : this.clone) {
- if (this.fallsOff(block.id)) {
- this.fall.add(block);
- } else if (this.falling(block.id)) {
- this.drop.add(block);
- } else if (block.id != 0) {
- this.solid.add(block);
- this.setBlockFill(block);
- }
- }
- for (final BlockWrapper block : this.drop) {
- this.setBlockFill(block);
- }
- for (final BlockWrapper block : this.fall) {
- this.setBlockFill(block);
- }
- this.sorted = true;
- }
-
- v.owner().storeUndo(this.undo);
- }
-
- protected final void stampNoAir(final SnipeData v) {
-
- this.undo = new Undo();
-
- if (this.sorted) {
- for (final BlockWrapper block : this.solid) {
- this.setBlock(block);
- }
- for (final BlockWrapper block : this.drop) {
- this.setBlock(block);
- }
- for (final BlockWrapper block : this.fall) {
- this.setBlock(block);
- }
- } else {
- this.fall.clear();
- this.drop.clear();
- this.solid.clear();
- for (final BlockWrapper block : this.clone) {
- if (this.fallsOff(block.id)) {
- this.fall.add(block);
- } else if (this.falling(block.id)) {
- this.drop.add(block);
- } else if (block.id != 0) {
- this.solid.add(block);
- this.setBlock(block);
- }
- }
- for (final BlockWrapper block : this.drop) {
- this.setBlock(block);
- }
- for (final BlockWrapper block : this.fall) {
- this.setBlock(block);
- }
- this.sorted = true;
- }
-
- v.owner().storeUndo(this.undo);
- }
-
- @Override
- protected final void arrow(final SnipeData v) {
- switch (this.stamp) {
- case DEFAULT:
- this.stamp(v);
- break;
-
- case NO_AIR:
- this.stampNoAir(v);
- break;
-
- case FILL:
- this.stampFill(v);
- break;
-
- default:
- v.sendMessage(ChatColor.DARK_RED + "Error while stamping! Report");
- break;
- }
- }
-
- @Override
- protected void powder(final SnipeData v) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public void info(final Message vm) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public String getPermissionNode() {
- return "voxelsniper.brush.stamp";
- }
-
- protected enum StampType {
- NO_AIR, FILL, DEFAULT
- }
-
-
- protected class BlockWrapper {
- public int id;
- public int x;
- public int y;
- public int z;
- public int d;
-
- public BlockWrapper(final AsyncBlock b, final int blx, final int bly, final int blz) {
- this.id = b.getTypeId();
- this.d = b.getPropertyId();
- this.x = blx;
- this.y = bly;
- this.z = blz;
- }
- }
-}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/StencilBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/StencilBrush.java
deleted file mode 100644
index 1a6e9b82f..000000000
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/StencilBrush.java
+++ /dev/null
@@ -1,362 +0,0 @@
-package com.thevoxelbox.voxelsniper.brush;
-
-import com.boydti.fawe.bukkit.wrapper.AsyncBlock;
-import com.boydti.fawe.object.FaweInputStream;
-import com.boydti.fawe.object.FaweOutputStream;
-import com.boydti.fawe.object.io.PGZIPOutputStream;
-import com.google.common.io.Files;
-import com.sk89q.worldedit.world.block.BlockTypes;
-import com.thevoxelbox.voxelsniper.Message;
-import com.thevoxelbox.voxelsniper.SnipeData;
-import com.thevoxelbox.voxelsniper.Undo;
-import org.bukkit.ChatColor;
-
-import java.io.*;
-import java.util.zip.GZIPInputStream;
-
-/**
- * This is paste only currently. Assumes files exist, and thus has no usefulness until I add in saving stencils later. Uses sniper-exclusive stencil format: 3
- * shorts for X,Z,Y size of cuboid 3 shorts for X,Z,Y offsets from the -X,-Z,-Y corner. This is the reference point for pasting, corresponding to where you
- * click your brush. 1 long integer saying how many runs of blocks are in the schematic (data is compressed into runs) 1 per run: ( 1 boolean: true = compressed
- * line ahead, false = locally unique block ahead. This wastes a bit instead of a byte, and overall saves space, as long as at least 1/8 of all RUNS are going
- * to be size 1, which in Minecraft is almost definitely true. IF boolean was true, next unsigned byte stores the number of consecutive blocks of the same type,
- * up to 256. IF boolean was false, there is no byte here, goes straight to ID and data instead, which applies to just one block. 2 bytes to identify type of
- * block. First byte is ID, second is data. This applies to every one of the line of consecutive blocks if boolean was true. )
- *
- * TODO: Make limit a config option
- *
- * @author Gavjenks
- */
-public class StencilBrush extends Brush {
- private byte pasteOption = 1; // 0 = full, 1 = fill, 2 = replace
- private String filename = "NoFileLoaded";
- private short x;
- private short z;
- private short y;
- private short xRef;
- private short zRef;
- private short yRef;
- private byte pasteParam = 0;
- private int[] firstPoint = new int[3];
- private int[] secondPoint = new int[3];
- private int[] pastePoint = new int[3];
- private byte point = 1;
-
-public StencilBrush() {
- this.setName("Stencil");
- }
-
- @SuppressWarnings("deprecation")
- private void stencilPaste(final SnipeData v) {
- if (this.filename.matches("NoFileLoaded")) {
- v.sendMessage(ChatColor.RED + "You did not specify a filename. This is required.");
- return;
- }
-
- final Undo undo = new Undo();
- final File file = new File("plugins/VoxelSniper/stencils/" + this.filename + ".vstencil");
-
- if (file.exists()) {
- try (final FaweInputStream in = new FaweInputStream(new DataInputStream(new GZIPInputStream(new BufferedInputStream(new FileInputStream(file)))))) {
-
- this.x = in.readShort();
- this.z = in.readShort();
- this.y = in.readShort();
-
- this.xRef = in.readShort();
- this.zRef = in.readShort();
- this.yRef = in.readShort();
-
- final int numRuns = in.readInt();
-
- int currX = -this.xRef; // so if your ref point is +5 x, you want to start pasting -5 blocks from the clicked point (the reference) to get the
- // corner, for example.
- int currZ = -this.zRef;
- int currY = -this.yRef;
- int id;
- int blockPositionX = getTargetBlock().getX();
- int blockPositionY = getTargetBlock().getY();
- int blockPositionZ = getTargetBlock().getZ();
- if (this.pasteOption == 0) {
- for (int i = 1; i < numRuns + 1; i++) {
- if (in.readBoolean()) {
- final int numLoops = in.readByte() + 128;
- id = in.readVarInt();
- for (int j = 0; j < numLoops; j++) {
- undo.put(this.clampY(blockPositionX + currX, blockPositionY + currY, blockPositionZ + currZ));
- this.clampY(blockPositionX + currX, blockPositionY + currY, blockPositionZ + currZ).setCombinedId(id);
- currX++;
- if (currX == this.x - this.xRef) {
- currX = -this.xRef;
- currZ++;
- if (currZ == this.z - this.zRef) {
- currZ = -this.zRef;
- currY++;
- }
- }
- }
- } else {
- undo.put(this.clampY(blockPositionX + currX, blockPositionY + currY, blockPositionZ + currZ));
- int combined = in.readVarInt();
- this.clampY(blockPositionX + currX, blockPositionY + currY, blockPositionZ + currZ).setCombinedId(combined);
- currX++;
- if (currX == this.x - this.xRef) {
- currX = -this.xRef;
- currZ++;
- if (currZ == this.z - this.zRef) {
- currZ = -this.zRef;
- currY++;
- }
- }
- }
- }
- } else if (this.pasteOption == 1) {
- for (int i = 1; i < numRuns + 1; i++) {
- if (in.readBoolean()) {
- final int numLoops = in.readByte() + 128;
- id = (in.readVarInt());
- for (int j = 0; j < numLoops; j++) {
-
- if (!BlockTypes.getFromStateId(id).getMaterial().isAir() && this.clampY(blockPositionX + currX, blockPositionY + currY, blockPositionZ + currZ).isEmpty()) {
- undo.put(this.clampY(blockPositionX + currX, blockPositionY + currY, blockPositionZ + currZ));
- this.clampY(blockPositionX + currX, blockPositionY + currY, blockPositionZ + currZ).setCombinedId(id);
- }
- currX++;
- if (currX == this.x - this.xRef) {
- currX = -this.xRef;
- currZ++;
- if (currZ == this.z - this.zRef) {
- currZ = -this.zRef;
- currY++;
- }
- }
- }
- } else {
- id = (in.readVarInt());
- if (!BlockTypes.getFromStateId(id).getMaterial().isAir() && this.clampY(blockPositionX + currX, blockPositionY + currY, blockPositionZ + currZ).isEmpty()) {
- undo.put(this.clampY(blockPositionX + currX, blockPositionY + currY, blockPositionZ + currZ));
- // v.sendMessage("currX:" + currX + " currZ:"+currZ + " currY:" + currY + " id:" + id + " data:" + data);
- this.clampY(blockPositionX + currX, blockPositionY + currY, blockPositionZ + currZ).setCombinedId(id);
- }
- currX++;
- if (currX == this.x - this.xRef) {
- currX = -this.xRef;
- currZ++;
- if (currZ == this.z - this.zRef) {
- currZ = -this.zRef;
- currY++;
- }
- }
- }
- }
- } else { // replace
- for (int i = 1; i < numRuns + 1; i++) {
- if (in.readBoolean()) {
- final int numLoops = in.readByte() + 128;
- id = (in.readVarInt());
- for (int j = 0; j < (numLoops); j++) {
- if (!BlockTypes.getFromStateId(id).getMaterial().isAir()) {
- undo.put(this.clampY(blockPositionX + currX, blockPositionY + currY, blockPositionZ + currZ));
- this.clampY(blockPositionX + currX, blockPositionY + currY, blockPositionZ + currZ).setCombinedId(id);
- }
- currX++;
- if (currX == this.x - this.xRef) {
- currX = -this.xRef;
- currZ++;
- if (currZ == this.z - this.zRef) {
- currZ = -this.zRef;
- currY++;
- }
- }
- }
- } else {
- id = (in.readVarInt());
- if (id != 0) {
- undo.put(this.clampY(blockPositionX + currX, blockPositionY + currY, blockPositionZ + currZ));
- this.clampY(blockPositionX + currX, blockPositionY + currY, blockPositionZ + currZ).setCombinedId(id);
- }
- currX++;
- if (currX == this.x) {
- currX = 0;
- currZ++;
- if (currZ == this.z) {
- currZ = 0;
- currY++;
- }
- }
- }
- }
- }
- in.close();
- v.owner().storeUndo(undo);
-
- } catch (final Exception exception) {
- v.sendMessage(ChatColor.RED + "Something went wrong.");
- exception.printStackTrace();
- }
- } else {
- v.sendMessage(ChatColor.RED + "You need to type a stencil name / your specified stencil does not exist.");
- }
- }
-
- @SuppressWarnings("UnstableApiUsage")
- private void stencilSave(final SnipeData v) {
-
- final File file = new File("plugins/VoxelSniper/stencils/" + this.filename + ".vstencil");
- try {
- this.x = (short) (Math.abs((this.firstPoint[0] - this.secondPoint[0])) + 1);
- this.z = (short) (Math.abs((this.firstPoint[1] - this.secondPoint[1])) + 1);
- this.y = (short) (Math.abs((this.firstPoint[2] - this.secondPoint[2])) + 1);
- this.xRef = (short) ((this.firstPoint[0] > this.secondPoint[0]) ? (this.pastePoint[0] - this.secondPoint[0]) : (this.pastePoint[0] - this.firstPoint[0]));
- this.zRef = (short) ((this.firstPoint[1] > this.secondPoint[1]) ? (this.pastePoint[1] - this.secondPoint[1]) : (this.pastePoint[1] - this.firstPoint[1]));
- this.yRef = (short) ((this.firstPoint[2] > this.secondPoint[2]) ? (this.pastePoint[2] - this.secondPoint[2]) : (this.pastePoint[2] - this.firstPoint[2]));
-
- if ((this.x * this.y * this.z) > 50000) {
- v.sendMessage(ChatColor.AQUA + "Volume exceeds maximum limit.");
- return;
- }
-
- Files.createParentDirs(file);
- file.createNewFile();
- try (FaweOutputStream out = new FaweOutputStream(new DataOutputStream(new PGZIPOutputStream(new BufferedOutputStream(new FileOutputStream(file)))))) {
- int blockPositionX = Math.min(this.firstPoint[0], this.secondPoint[0]);
- int blockPositionZ = Math.min(this.firstPoint[1], this.secondPoint[1]);
- int blockPositionY = Math.min(this.firstPoint[2], this.secondPoint[2]);
- out.writeShort(this.x);
- out.writeShort(this.z);
- out.writeShort(this.y);
- out.writeShort(this.xRef);
- out.writeShort(this.zRef);
- out.writeShort(this.yRef);
-
- v.sendMessage(ChatColor.AQUA + "Volume: " + this.x * this.z * this.y + " blockPositionX:" + blockPositionX + " blockPositionZ:" + blockPositionZ + " blockPositionY:" + blockPositionY);
-
- int[] blockArray = new int[this.x * this.z * this.y];
- byte[] runSizeArray = new byte[this.x * this.z * this.y];
-
- int lastId = (this.getWorld().getBlockAt(blockPositionX, blockPositionY, blockPositionZ).getCombinedId());
- int thisId;
- int counter = 0;
- int arrayIndex = 0;
- for (int y = 0; y < this.y; y++) {
- for (int z = 0; z < this.z; z++) {
- for (int x = 0; x < this.x; x++) {
- AsyncBlock currentBlock = getWorld().getBlockAt(blockPositionX + x, blockPositionY + y, blockPositionZ + z);
- thisId = (currentBlock.getCombinedId());
- if (thisId != lastId || counter == 255) {
- blockArray[arrayIndex] = lastId;
- runSizeArray[arrayIndex] = (byte) (counter - 128);
- arrayIndex++;
- counter = 1;
- lastId = thisId;
- } else {
- counter++;
- lastId = thisId;
- }
- }
- }
- }
- blockArray[arrayIndex] = lastId; // saving last run, which will always be left over.
- runSizeArray[arrayIndex] = (byte) (counter - 128);
-
- out.writeInt(arrayIndex + 1);
- // v.sendMessage("number of runs = " + arrayIndex);
- for (int i = 0; i < arrayIndex + 1; i++) {
- if (runSizeArray[i] > -127) {
- out.writeBoolean(true);
- out.writeByte(runSizeArray[i]);
- out.writeVarInt(blockArray[i]);
- } else {
- out.writeBoolean(false);
- out.writeVarInt(blockArray[i]);
- }
- }
-
- v.sendMessage(ChatColor.BLUE + "Saved as '" + this.filename + "'.");
- }
-
- } catch (final Exception exception) {
- v.sendMessage(ChatColor.RED + "Something went wrong.");
- exception.printStackTrace();
- }
- }
-
- @Override
- protected final void arrow(final SnipeData v) { // will be used to copy/save later on?
- if (this.point == 1) {
- this.firstPoint[0] = this.getTargetBlock().getX();
- this.firstPoint[1] = this.getTargetBlock().getZ();
- this.firstPoint[2] = this.getTargetBlock().getY();
- v.sendMessage(ChatColor.GRAY + "First point");
- v.sendMessage("X:" + this.firstPoint[0] + " Z:" + this.firstPoint[1] + " Y:" + this.firstPoint[2]);
- this.point = 2;
- } else if (this.point == 2) {
- this.secondPoint[0] = this.getTargetBlock().getX();
- this.secondPoint[1] = this.getTargetBlock().getZ();
- this.secondPoint[2] = this.getTargetBlock().getY();
- if ((Math.abs(this.firstPoint[0] - this.secondPoint[0]) * Math.abs(this.firstPoint[1] - this.secondPoint[1]) * Math.abs(this.firstPoint[2] - this.secondPoint[2])) > 5000000) {
- v.sendMessage(ChatColor.DARK_RED + "Area selected is too large. (Limit is 5,000,000 blocks)");
- this.point = 1;
- } else {
- v.sendMessage(ChatColor.GRAY + "Second point");
- v.sendMessage("X:" + this.secondPoint[0] + " Z:" + this.secondPoint[1] + " Y:" + this.secondPoint[2]);
- this.point = 3;
- }
- } else if (this.point == 3) {
- this.pastePoint[0] = this.getTargetBlock().getX();
- this.pastePoint[1] = this.getTargetBlock().getZ();
- this.pastePoint[2] = this.getTargetBlock().getY();
- v.sendMessage(ChatColor.GRAY + "Paste Reference point");
- v.sendMessage("X:" + this.pastePoint[0] + " Z:" + this.pastePoint[1] + " Y:" + this.pastePoint[2]);
- this.point = 1;
-
- this.stencilSave(v);
- }
- }
-
- @Override
- protected final void powder(final SnipeData v) { // will be used to paste later on
- this.stencilPaste(v);
- }
-
- @Override
- public final void info(final Message vm) {
- vm.brushName(this.getName());
- vm.custom("File loaded: " + this.filename);
- }
-
- @Override
- public final void parameters(final String[] par, final SnipeData v) {
- if (par[1].equalsIgnoreCase("info")) {
- v.sendMessage(ChatColor.GOLD + "Stencil brush Parameters:");
- v.sendMessage(ChatColor.AQUA + "/b schem [optional: 'full' 'fill' or 'replace', with fill as default] [name] -- Loads the specified schematic. Allowed size of schematic is based on rank. Full/fill/replace must come first. Full = paste all blocks, fill = paste only into air blocks, replace = paste full blocks in only, but replace anything in their way.");
- v.sendMessage(ChatColor.BLUE + "Size of the stencils you are allowed to paste depends on rank (member / lite, sniper, curator, admin)");
- return;
- } else if (par[1].equalsIgnoreCase("full")) {
- this.pasteOption = 0;
- this.pasteParam = 1;
- } else if (par[1].equalsIgnoreCase("fill")) {
- this.pasteOption = 1;
- this.pasteParam = 1;
- } else if (par[1].equalsIgnoreCase("replace")) {
- this.pasteOption = 2;
- this.pasteParam = 1;
- }
- try {
- this.filename = par[1 + this.pasteParam];
- final File file = new File("plugins/VoxelSniper/stencils/" + this.filename + ".vstencil");
- if (file.exists()) {
- v.sendMessage(ChatColor.RED + "Stencil '" + this.filename + "' exists and was loaded. Make sure you are using powder if you do not want any chance of overwriting the file.");
- } else {
- v.sendMessage(ChatColor.AQUA + "Stencil '" + this.filename + "' does not exist. Ready to be saved to, but cannot be pasted.");
- }
- } catch (final Exception exception) {
- v.sendMessage(ChatColor.RED + "You need to type a stencil name.");
- }
- }
-
- @Override
- public String getPermissionNode() {
- return "voxelsniper.brush.stencil";
- }
-}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/StencilListBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/StencilListBrush.java
deleted file mode 100644
index 40550c890..000000000
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/StencilListBrush.java
+++ /dev/null
@@ -1,763 +0,0 @@
-package com.thevoxelbox.voxelsniper.brush;
-
-import com.thevoxelbox.voxelsniper.Message;
-import com.thevoxelbox.voxelsniper.SnipeData;
-import com.thevoxelbox.voxelsniper.Undo;
-import org.bukkit.ChatColor;
-
-import java.io.BufferedInputStream;
-import java.io.DataInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.util.HashMap;
-import java.util.Scanner;
-
-public class StencilListBrush extends Brush {
- private byte pasteOption = 1; // 0 = full, 1 = fill, 2 = replace
- private String filename = "NoFileLoaded";
- private short x;
- private short z;
- private short y;
- private short xRef;
- private short zRef;
- private short yRef;
- private byte pasteParam = 0;
- private HashMap stencilList = new HashMap<>();
-
- public StencilListBrush() {
- this.setName("StencilList");
- }
-
- private String readRandomStencil() {
- double rand = Math.random() * (this.stencilList.size());
- final int choice = (int) rand;
- return this.stencilList.get(choice);
- }
-
- private void readStencilList() {
- final File file = new File("plugins/VoxelSniper/stencilLists/" + this.filename + ".txt");
- if (file.exists()) {
- try {
- final Scanner scanner = new Scanner(file);
- int counter = 0;
- while (scanner.hasNext()) {
- this.stencilList.put(counter, scanner.nextLine());
- counter++;
- }
- scanner.close();
- } catch (final Exception exception) {
- exception.printStackTrace();
- }
- }
- }
-
- @SuppressWarnings("deprecation")
- private void stencilPaste(final SnipeData v) {
- if (this.filename.matches("NoFileLoaded")) {
- v.sendMessage(ChatColor.RED + "You did not specify a filename for the list. This is required.");
- return;
- }
-
- final String stencilName = this.readRandomStencil();
- v.sendMessage(stencilName);
-
- final Undo undo = new Undo();
- final File file = new File("plugins/VoxelSniper/stencils/" + stencilName + ".vstencil");
-
- if (file.exists()) {
- try (final DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(file)))){
- this.x = in.readShort();
- this.z = in.readShort();
- this.y = in.readShort();
-
- this.xRef = in.readShort();
- this.zRef = in.readShort();
- this.yRef = in.readShort();
-
- final int numRuns = in.readInt();
- // Something here that checks ranks using sanker'world thingie he added to Sniper and boots you out with error message if too big.
- final int volume = this.x * this.y * this.z;
- v.owner().getPlayer().sendMessage(ChatColor.AQUA + this.filename + " pasted. Volume is " + volume + " blocks.");
-
- int currX = -this.xRef; // so if your ref point is +5 x, you want to start pasting -5 blocks from the clicked point (the reference) to get the
- // corner, for example.
- int currZ = -this.zRef;
- int currY = -this.yRef;
- int id;
- int data;
- if (this.pasteOption == 0) {
- for (int i = 1; i < numRuns + 1; i++) {
- if (in.readBoolean()) {
- final int numLoops = in.readByte() + 128;
- id = (in.readByte() + 128);
- data = (in.readByte() + 128);
- for (int j = 0; j < numLoops; j++) {
- undo.put(this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ));
- this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).setTypeIdAndPropertyId(id, data, false);
- currX++;
- if (currX == this.x - this.xRef) {
- currX = -this.xRef;
- currZ++;
- if (currZ == this.z - this.zRef) {
- currZ = -this.zRef;
- currY++;
- }
- }
- }
- } else {
- undo.put(this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ));
- this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).setTypeIdAndPropertyId((in.readByte() + 128), (in.readByte() + 128), false);
- currX++;
- if (currX == this.x - this.xRef) {
- currX = -this.xRef;
- currZ++;
- if (currZ == this.z - this.zRef) {
- currZ = -this.zRef;
- currY++;
- }
- }
- }
- }
- } else if (this.pasteOption == 1) {
- for (int i = 1; i < numRuns + 1; i++) {
- if (in.readBoolean()) {
- final int numLoops = in.readByte() + 128;
- id = (in.readByte() + 128);
- data = (in.readByte() + 128);
- for (int j = 0; j < numLoops; j++) {
- if (id != 0 && this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).isEmpty()) {
- undo.put(this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ));
- this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).setTypeIdAndPropertyId(id, (data), false);
- }
- currX++;
- if (currX == this.x - this.xRef) {
- currX = -this.xRef;
- currZ++;
- if (currZ == this.z - this.zRef) {
- currZ = -this.zRef;
- currY++;
- }
- }
- }
- } else {
- id = (in.readByte() + 128);
- data = (in.readByte() + 128);
- if (id != 0 && this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).isEmpty()) {
- undo.put(this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ));
- this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).setTypeIdAndPropertyId(id, (data), false);
- }
- currX++;
- if (currX == this.x - this.xRef) {
- currX = -this.xRef;
- currZ++;
- if (currZ == this.z - this.zRef) {
- currZ = -this.zRef;
- currY++;
- }
- }
- }
- }
- } else { // replace
- for (int i = 1; i < numRuns + 1; i++) {
- if (in.readBoolean()) {
- final int numLoops = in.readByte() + 128;
- id = (in.readByte() + 128);
- data = (in.readByte() + 128);
- for (int j = 0; j < (numLoops); j++) {
- if (id != 0) {
- undo.put(this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ));
- this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).setTypeIdAndPropertyId(id, data, false);
- }
- currX++;
- if (currX == this.x - this.xRef) {
- currX = -this.xRef;
- currZ++;
- if (currZ == this.z - this.zRef) {
- currZ = -this.zRef;
- currY++;
- }
- }
- }
- } else {
- id = (in.readByte() + 128);
- data = (in.readByte() + 128);
- if (id != 0) {
- undo.put(this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ));
- this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).setTypeIdAndPropertyId(id, data, false);
- }
- currX++;
- if (currX == this.x) {
- currX = 0;
- currZ++;
- if (currZ == this.z) {
- currZ = 0;
- currY++;
- }
- }
- }
- }
- }
- in.close();
- v.owner().storeUndo(undo);
-
- } catch (final Exception exception) {
- v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong.");
- exception.printStackTrace();
- }
- } else {
- v.owner().getPlayer().sendMessage(ChatColor.RED + "You need to type a stencil name / your specified stencil does not exist.");
- }
- }
-
- @SuppressWarnings("deprecation")
- private void stencilPaste180(final SnipeData v) {
- if (this.filename.matches("NoFileLoaded")) {
- v.owner().getPlayer().sendMessage(ChatColor.RED + "You did not specify a filename for the list. This is required.");
- return;
- }
-
- final String stencilName = this.readRandomStencil();
-
- final Undo undo = new Undo();
- final File file = new File("plugins/VoxelSniper/stencils/" + stencilName + ".vstencil");
-
- if (file.exists()) {
- try (final DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(file)))) {
-
- this.x = in.readShort();
- this.z = in.readShort();
- this.y = in.readShort();
-
- this.xRef = in.readShort();
- this.zRef = in.readShort();
- this.yRef = in.readShort();
-
- final int numRuns = in.readInt();
- // Something here that checks ranks using sanker'world thingie he added to Sniper and boots you out with error message if too big.
- final int volume = this.x * this.y * this.z;
- v.owner().getPlayer().sendMessage(ChatColor.AQUA + this.filename + " pasted. Volume is " + volume + " blocks.");
-
- int currX = +this.xRef; // so if your ref point is +5 x, you want to start pasting -5 blocks from the clicked point (the reference) to get the
- // corner, for example.
- int currZ = +this.zRef;
- int currY = -this.yRef;
- int id;
- int data;
- if (this.pasteOption == 0) {
- for (int i = 1; i < numRuns + 1; i++) {
- if (in.readBoolean()) {
- final int numLoops = in.readByte() + 128;
- id = (in.readByte() + 128);
- data = (in.readByte() + 128);
- for (int j = 0; j < numLoops; j++) {
- undo.put(this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ));
- this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).setTypeIdAndPropertyId(id, data, false);
- currX--;
- if (currX == -this.x + this.xRef) {
- currX = this.xRef;
- currZ--;
- if (currZ == -this.z + this.zRef) {
- currZ = +this.zRef;
- currY++;
- }
- }
- }
- } else {
- undo.put(this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ));
- this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).setTypeIdAndPropertyId((in.readByte() + 128), (in.readByte() + 128), false);
- currX--;
- if (currX == -this.x + this.xRef) {
- currX = this.xRef;
- currZ--;
- if (currZ == -this.z + this.zRef) {
- currZ = +this.zRef;
- currY++;
- }
- }
- }
- }
- } else if (this.pasteOption == 1) {
- for (int i = 1; i < numRuns + 1; i++) {
- if (in.readBoolean()) {
- final int numLoops = in.readByte() + 128;
- id = (in.readByte() + 128);
- data = (in.readByte() + 128);
- for (int j = 0; j < numLoops; j++) {
- if (id != 0 && this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).isEmpty()) {
- undo.put(this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ));
- this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).setTypeIdAndPropertyId(id, (data), false);
- }
- currX--;
- if (currX == -this.x + this.xRef) {
- currX = this.xRef;
- currZ--;
- if (currZ == -this.z + this.zRef) {
- currZ = +this.zRef;
- currY++;
- }
- }
- }
- } else {
- id = (in.readByte() + 128);
- data = (in.readByte() + 128);
- if (id != 0 && this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).isEmpty()) {
- undo.put(this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ));
- this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).setTypeIdAndPropertyId(id, (data), false);
- }
- currX--;
- if (currX == -this.x + this.xRef) {
- currX = this.xRef;
- currZ--;
- if (currZ == -this.z + this.zRef) {
- currZ = +this.zRef;
- currY++;
- }
- }
- }
- }
- } else { // replace
- for (int i = 1; i < numRuns + 1; i++) {
- if (in.readBoolean()) {
- final int numLoops = in.readByte() + 128;
- id = (in.readByte() + 128);
- data = (in.readByte() + 128);
- for (int j = 0; j < (numLoops); j++) {
- if (id != 0) {
- undo.put(this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ));
- this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).setTypeIdAndPropertyId(id, data, false);
- }
- currX--;
- if (currX == -this.x + this.xRef) {
- currX = this.xRef;
- currZ--;
- if (currZ == -this.z + this.zRef) {
- currZ = +this.zRef;
- currY++;
- }
- }
- }
- } else {
- id = (in.readByte() + 128);
- data = (in.readByte() + 128);
- if (id != 0) {
- undo.put(this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ));
- this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).setTypeIdAndPropertyId(id, data, false);
- }
- currX--;
- if (currX == -this.x + this.xRef) {
- currX = this.xRef;
- currZ--;
- if (currZ == -this.z + this.zRef) {
- currZ = +this.zRef;
- currY++;
- }
- }
- }
- }
- }
- in.close();
- v.owner().storeUndo(undo);
-
- } catch (final Exception exception) {
- v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong.");
- exception.printStackTrace();
- }
- } else {
- v.owner().getPlayer().sendMessage(ChatColor.RED + "You need to type a stencil name / your specified stencil does not exist.");
- }
- }
-
- @SuppressWarnings("deprecation")
- private void stencilPaste270(final SnipeData v) {
- if (this.filename.matches("NoFileLoaded")) {
- v.owner().getPlayer().sendMessage(ChatColor.RED + "You did not specify a filename for the list. This is required.");
- return;
- }
-
- final String stencilName = this.readRandomStencil();
-
- final Undo undo = new Undo();
- final File file = new File("plugins/VoxelSniper/stencils/" + stencilName + ".vstencil");
-
- if (file.exists()) {
- try (final DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(file)))) {
-
- this.x = in.readShort();
- this.z = in.readShort();
- this.y = in.readShort();
-
- this.xRef = in.readShort();
- this.zRef = in.readShort();
- this.yRef = in.readShort();
-
- final int numRuns = in.readInt();
- // Something here that checks ranks using sanker'world thingie he added to Sniper and boots you out with error message if too big.
- final int volume = this.x * this.y * this.z;
- v.owner().getPlayer().sendMessage(ChatColor.AQUA + this.filename + " pasted. Volume is " + volume + " blocks.");
-
- int currX = +this.zRef; // so if your ref point is +5 x, you want to start pasting -5 blocks from the clicked point (the reference) to get the
- // corner, for example.
- int currZ = -this.xRef;
- int currY = -this.yRef;
- int id;
- int data;
- if (this.pasteOption == 0) {
- for (int i = 1; i < numRuns + 1; i++) {
- if (in.readBoolean()) {
- final int numLoops = in.readByte() + 128;
- id = (in.readByte() + 128);
- data = (in.readByte() + 128);
- for (int j = 0; j < numLoops; j++) {
- undo.put(this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ));
- this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).setTypeIdAndPropertyId(id, data, false);
- currZ++;
- if (currZ == this.x - this.xRef) {
- currZ = -this.xRef;
- currX--;
- if (currX == -this.z + this.zRef) {
- currX = +this.zRef;
- currY++;
- }
- }
- }
- } else {
- undo.put(this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ));
- this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).setTypeIdAndPropertyId((in.readByte() + 128), (in.readByte() + 128), false);
- currZ++;
- currZ++;
- if (currZ == this.x - this.xRef) {
- currZ = -this.xRef;
- currX--;
- if (currX == -this.z + this.zRef) {
- currX = +this.zRef;
- currY++;
- }
- }
- }
- }
- } else if (this.pasteOption == 1) {
- for (int i = 1; i < numRuns + 1; i++) {
- if (in.readBoolean()) {
- final int numLoops = in.readByte() + 128;
- id = (in.readByte() + 128);
- data = (in.readByte() + 128);
- for (int j = 0; j < numLoops; j++) {
- if (id != 0 && this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).isEmpty()) { // no reason to paste air over
- // air, and it prevents us
- // most of the time from
- // having to even check the
- // block.
- undo.put(this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ));
- this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).setTypeIdAndPropertyId(id, (data), false);
- }
- currZ++;
- if (currZ == this.x - this.xRef) {
- currZ = -this.xRef;
- currX--;
- if (currX == -this.z + this.zRef) {
- currX = +this.zRef;
- currY++;
- }
- }
- }
- } else {
- id = (in.readByte() + 128);
- data = (in.readByte() + 128);
- if (id != 0 && this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).isEmpty()) { // no reason to paste air over
- // air, and it prevents us most of
- // the time from having to even
- // check the block.
- undo.put(this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ));
- this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).setTypeIdAndPropertyId(id, (data), false);
- }
- currZ++;
- if (currZ == this.x - this.xRef) {
- currZ = -this.xRef;
- currX--;
- if (currX == -this.z + this.zRef) {
- currX = +this.zRef;
- currY++;
- }
- }
- }
- }
- } else { // replace
- for (int i = 1; i < numRuns + 1; i++) {
- if (in.readBoolean()) {
- final int numLoops = in.readByte() + 128;
- id = (in.readByte() + 128);
- data = (in.readByte() + 128);
- for (int j = 0; j < (numLoops); j++) {
- if (id != 0) {
- undo.put(this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ));
- this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).setTypeIdAndPropertyId(id, data, false);
- }
- currZ++;
- if (currZ == this.x - this.xRef) {
- currZ = -this.xRef;
- currX--;
- if (currX == -this.z + this.zRef) {
- currX = +this.zRef;
- currY++;
- }
- }
- }
- } else {
- id = (in.readByte() + 128);
- data = (in.readByte() + 128);
- if (id != 0) {
- undo.put(this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ));
- this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).setTypeIdAndPropertyId(id, data, false);
- }
- currZ++;
- if (currZ == this.x - this.xRef) {
- currZ = -this.xRef;
- currX--;
- if (currX == -this.z + this.zRef) {
- currX = +this.zRef;
- currY++;
- }
- }
- }
- }
- }
- in.close();
- v.owner().storeUndo(undo);
-
- } catch (final Exception exception) {
- v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong.");
- exception.printStackTrace();
- }
- } else {
- v.owner().getPlayer().sendMessage(ChatColor.RED + "You need to type a stencil name / your specified stencil does not exist.");
- }
- }
-
- @SuppressWarnings("deprecation")
- private void stencilPaste90(final SnipeData v) {
- if (this.filename.matches("NoFileLoaded")) {
- v.sendMessage(ChatColor.RED + "You did not specify a filename for the list. This is required.");
- return;
- }
-
- final String stencilName = this.readRandomStencil();
-
- final Undo undo = new Undo();
- final File file = new File("plugins/VoxelSniper/stencils/" + stencilName + ".vstencil");
-
- if (file.exists()) {
- try {
- final DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(file)));
-
- this.x = in.readShort();
- this.z = in.readShort();
- this.y = in.readShort();
-
- this.xRef = in.readShort();
- this.zRef = in.readShort();
- this.yRef = in.readShort();
-
- final int numRuns = in.readInt();
- // Something here that checks ranks using sanker'world thingie he added to Sniper and boots you out with error message if too big.
- final int volume = this.x * this.y * this.z;
- v.sendMessage(ChatColor.AQUA + this.filename + " pasted. Volume is " + volume + " blocks.");
-
- int currX = -this.zRef; // so if your ref point is +5 x, you want to start pasting -5 blocks from the clicked point (the reference) to get the
- // corner, for example.
- int currZ = +this.xRef;
- int currY = -this.yRef;
- int id;
- int data;
- if (this.pasteOption == 0) {
- for (int i = 1; i < numRuns + 1; i++) {
- if (in.readBoolean()) {
- final int numLoops = in.readByte() + 128;
- id = (in.readByte() + 128);
- data = (in.readByte() + 128);
- for (int j = 0; j < numLoops; j++) {
- undo.put(this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ));
- this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).setTypeIdAndPropertyId(id, data, false);
- currZ--;
- if (currZ == -this.x + this.xRef) {
- currZ = this.xRef;
- currX++;
- if (currX == this.z - this.zRef) {
- currX = -this.zRef;
- currY++;
- }
- }
- }
- } else {
- undo.put(this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ));
- this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).setTypeIdAndPropertyId((in.readByte() + 128), (in.readByte() + 128), false);
- currZ--;
- if (currZ == -this.x + this.xRef) {
- currZ = this.xRef;
- currX++;
- if (currX == this.z - this.zRef) {
- currX = -this.zRef;
- currY++;
- }
- }
- }
- }
- } else if (this.pasteOption == 1) {
- for (int i = 1; i < numRuns + 1; i++) {
- if (in.readBoolean()) {
- final int numLoops = in.readByte() + 128;
- id = (in.readByte() + 128);
- data = (in.readByte() + 128);
- for (int j = 0; j < numLoops; j++) {
- if (id != 0 && this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).isEmpty()) {
- undo.put(this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ));
- this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).setTypeIdAndPropertyId(id, (data), false);
- }
- currZ--;
- if (currZ == -this.x + this.xRef) {
- currZ = this.xRef;
- currX++;
- if (currX == this.z - this.zRef) {
- currX = -this.zRef;
- currY++;
- }
- }
- }
- } else {
- id = (in.readByte() + 128);
- data = (in.readByte() + 128);
- if (id != 0 && this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).isEmpty()) {
- undo.put(this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ));
- this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).setTypeIdAndPropertyId(id, (data), false);
- }
- currZ--;
- if (currZ == -this.x + this.xRef) {
- currZ = this.xRef;
- currX++;
- if (currX == this.z - this.zRef) {
- currX = -this.zRef;
- currY++;
- }
- }
- }
- }
- } else { // replace
- for (int i = 1; i < numRuns + 1; i++) {
- if (in.readBoolean()) {
- final int numLoops = in.readByte() + 128;
- id = (in.readByte() + 128);
- data = (in.readByte() + 128);
- for (int j = 0; j < (numLoops); j++) {
- if (id != 0) {
- undo.put(this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ));
- this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).setTypeIdAndPropertyId(id, data, false);
- }
- currZ--;
- if (currZ == -this.x + this.xRef) {
- currZ = this.xRef;
- currX++;
- if (currX == this.z - this.zRef) {
- currX = -this.zRef;
- currY++;
- }
- }
- }
- } else {
- id = (in.readByte() + 128);
- data = (in.readByte() + 128);
- if (id != 0) {
- undo.put(this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ));
- this.clampY(this.getTargetBlock().getX() + currX, this.getTargetBlock().getY() + currY, this.getTargetBlock().getZ() + currZ).setTypeIdAndPropertyId(id, data, false);
- }
- currZ--;
- if (currZ == -this.x + this.xRef) {
- currZ = this.xRef;
- currX++;
- if (currX == this.z - this.zRef) {
- currX = -this.zRef;
- currY++;
- }
- }
- }
- }
- }
- in.close();
- v.owner().storeUndo(undo);
-
- } catch (final Exception exception) {
- v.sendMessage(ChatColor.RED + "Something went wrong.");
- exception.printStackTrace();
- }
- } else {
- v.owner().getPlayer().sendMessage(ChatColor.RED + "You need to type a stencil name / your specified stencil does not exist.");
- }
- }
-
- private void stencilPasteRotation(final SnipeData v) {
- // just randomly chooses a rotation and then calls stencilPaste.
- this.readStencilList();
- final double random = Math.random();
- if (random < 0.26) {
- this.stencilPaste(v);
- } else if (random < 0.51) {
- this.stencilPaste90(v);
- } else if (random < 0.76) {
- this.stencilPaste180(v);
- } else {
- this.stencilPaste270(v);
- }
-
- }
-
- @Override
- protected final void arrow(final SnipeData v) {
- this.stencilPaste(v);
- }
-
- @Override
- protected final void powder(final SnipeData v) {
- this.stencilPasteRotation(v);
- }
-
-
- @Override
- public final void info(final Message vm) {
- vm.brushName(this.getName());
- vm.custom("File loaded: " + this.filename);
- }
-
- @Override
- public final void parameters(final String[] par, final SnipeData v) {
- if (par[1].equalsIgnoreCase("info")) {
- v.sendMessage(ChatColor.GOLD + "Stencil List brush Parameters:");
- v.sendMessage(ChatColor.AQUA + "/b schem [optional: 'full' 'fill' or 'replace', with fill as default] [name] -- Loads the specified stencil list. Full/fill/replace must come first. Full = paste all blocks, fill = paste only into air blocks, replace = paste full blocks in only, but replace anything in their way.");
- return;
- } else if (par[1].equalsIgnoreCase("full")) {
- this.pasteOption = 0;
- this.pasteParam = 1;
- } else if (par[1].equalsIgnoreCase("fill")) {
- this.pasteOption = 1;
- this.pasteParam = 1;
- } else if (par[1].equalsIgnoreCase("replace")) {
- this.pasteOption = 2;
- this.pasteParam = 1;
- }
- try {
- this.filename = par[1 + this.pasteParam];
- final File file = new File("plugins/VoxelSniper/stencilLists/" + this.filename + ".txt");
- if (file.exists()) {
- v.sendMessage(ChatColor.RED + "Stencil List '" + this.filename + "' exists and was loaded.");
- this.readStencilList();
- } else {
- v.sendMessage(ChatColor.AQUA + "Stencil List '" + this.filename + "' does not exist. This brush will not function without a valid stencil list.");
- this.filename = "NoFileLoaded";
- }
- } catch (final Exception exception) {
- v.sendMessage(ChatColor.RED + "You need to type a stencil name.");
- }
- }
-
- @Override
- public String getPermissionNode() {
- return "voxelsniper.brush.stencillist";
- }
-}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ThreePointCircleBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ThreePointCircleBrush.java
deleted file mode 100644
index 3a5c5500f..000000000
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/ThreePointCircleBrush.java
+++ /dev/null
@@ -1,204 +0,0 @@
-package com.thevoxelbox.voxelsniper.brush;
-
-import com.thevoxelbox.voxelsniper.Message;
-import com.thevoxelbox.voxelsniper.SnipeData;
-import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush;
-import org.bukkit.ChatColor;
-import org.bukkit.util.NumberConversions;
-import org.bukkit.util.Vector;
-
-public class ThreePointCircleBrush extends PerformBrush {
- private Vector coordsOne;
- private Vector coordsTwo;
- private Vector coordsThree;
- private Tolerance tolerance = Tolerance.DEFAULT;
-
- /**
- * Default Constructor.
- */
- public ThreePointCircleBrush() {
- this.setName("3-Point Circle");
- }
-
- @Override
- protected final void arrow(final SnipeData v) {
- if (this.coordsOne == null) {
- this.coordsOne = this.getTargetBlock().getLocation().toVector();
- v.sendMessage(ChatColor.GRAY + "First Corner set.");
- } else if (this.coordsTwo == null) {
- this.coordsTwo = this.getTargetBlock().getLocation().toVector();
- v.sendMessage(ChatColor.GRAY + "Second Corner set.");
- } else if (this.coordsThree == null) {
- this.coordsThree = this.getTargetBlock().getLocation().toVector();
- v.sendMessage(ChatColor.GRAY + "Third Corner set.");
- } else {
- this.coordsOne = this.getTargetBlock().getLocation().toVector();
- this.coordsTwo = null;
- this.coordsThree = null;
- v.sendMessage(ChatColor.GRAY + "First Corner set.");
- }
- }
-
- @Override
- protected final void powder(final SnipeData v) {
- if (this.coordsOne == null || this.coordsTwo == null || this.coordsThree == null) {
- return;
- }
-
- // Calculate triangle defining vectors
- final Vector vectorOne = this.coordsTwo.clone();
- vectorOne.subtract(this.coordsOne);
- final Vector vectorTwo = this.coordsThree.clone();
- vectorTwo.subtract(this.coordsOne);
- final Vector vectorThree = this.coordsThree.clone();
- vectorThree.subtract(vectorTwo);
-
- // Redundant data check
- if (vectorOne.length() == 0 || vectorTwo.length() == 0 || vectorThree.length() == 0 || vectorOne.angle(vectorTwo) == 0 || vectorOne.angle(vectorThree) == 0 || vectorThree.angle(vectorTwo) == 0) {
-
- v.sendMessage(ChatColor.RED + "ERROR: Invalid points, try again.");
- this.coordsOne = null;
- this.coordsTwo = null;
- this.coordsThree = null;
- return;
- }
-
- // Calculate normal vector of the plane.
- final Vector normalVector = vectorOne.clone();
- normalVector.crossProduct(vectorTwo);
-
- // Calculate constant term of the plane.
- final double planeConstant = normalVector.getX() * this.coordsOne.getX() + normalVector.getY() * this.coordsOne.getY() + normalVector.getZ() * this.coordsOne.getZ();
-
- final Vector midpointOne = this.coordsOne.getMidpoint(this.coordsTwo);
- final Vector midpointTwo = this.coordsOne.getMidpoint(this.coordsThree);
-
- // Find perpendicular vectors to two sides in the plane
- final Vector perpendicularOne = normalVector.clone();
- perpendicularOne.crossProduct(vectorOne);
- final Vector perpendicularTwo = normalVector.clone();
- perpendicularTwo.crossProduct(vectorTwo);
-
- // determine value of parametric variable at intersection of two perpendicular bisectors
- final Vector tNumerator = midpointTwo.clone();
- tNumerator.subtract(midpointOne);
- tNumerator.crossProduct(perpendicularTwo);
- final Vector tDenominator = perpendicularOne.clone();
- tDenominator.crossProduct(perpendicularTwo);
- final double t = tNumerator.length() / tDenominator.length();
-
- // Calculate Circumcenter and Brushcenter.
- final Vector circumcenter = new Vector();
- circumcenter.copy(perpendicularOne);
- circumcenter.multiply(t);
- circumcenter.add(midpointOne);
-
- final Vector brushCenter = new Vector(Math.round(circumcenter.getX()), Math.round(circumcenter.getY()), Math.round(circumcenter.getZ()));
-
- // Calculate radius of circumcircle and determine brushsize
- final double radius = circumcenter.distance(new Vector(this.coordsOne.getX(), this.coordsOne.getY(), this.coordsOne.getZ()));
- final int brushSize = NumberConversions.ceil(radius) + 1;
-
- for (int x = -brushSize; x <= brushSize; x++) {
- for (int y = -brushSize; y <= brushSize; y++) {
- for (int z = -brushSize; z <= brushSize; z++) {
- // Calculate distance from center
- final double tempDistance = Math.pow(Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2), .5);
-
- // gets corner-on blocks
- final double cornerConstant = normalVector.getX() * (circumcenter.getX() + x) + normalVector.getY() * (circumcenter.getY() + y) + normalVector.getZ() * (circumcenter.getZ() + z);
-
- // gets center-on blocks
- final double centerConstant = normalVector.getX() * (circumcenter.getX() + x + .5) + normalVector.getY() * (circumcenter.getY() + y + .5) + normalVector.getZ() * (circumcenter.getZ() + z + .5);
-
- // Check if point is within sphere and on plane (some tolerance given)
- if (tempDistance <= radius && (Math.abs(cornerConstant - planeConstant) < this.tolerance.getValue() || Math.abs(centerConstant - planeConstant) < this.tolerance.getValue())) {
- this.current.perform(this.clampY(brushCenter.getBlockX() + x, brushCenter.getBlockY() + y, brushCenter.getBlockZ() + z));
- }
-
- }
- }
- }
-
- v.sendMessage(ChatColor.GREEN + "Done.");
- v.owner().storeUndo(this.current.getUndo());
-
- // Reset Brush
- this.coordsOne = null;
- this.coordsTwo = null;
- this.coordsThree = null;
-
- }
-
- @Override
- public final void info(final Message vm) {
- vm.brushName(this.getName());
- switch (this.tolerance) {
- case ACCURATE:
- vm.custom(ChatColor.GOLD + "Mode: Accurate");
- break;
- case DEFAULT:
- vm.custom(ChatColor.GOLD + "Mode: Default");
- break;
- case SMOOTH:
- vm.custom(ChatColor.GOLD + "Mode: Smooth");
- break;
- default:
- vm.custom(ChatColor.GOLD + "Mode: Unknown");
- break;
- }
-
- }
-
- @Override
- public final void parameters(final String[] par, final SnipeData v) {
- if (par[1].equalsIgnoreCase("info")) {
- v.sendMessage(ChatColor.YELLOW + "3-Point Circle Brush instructions: Select three corners with the arrow brush, then generate the Circle with the powder brush.");
- StringBuilder toleranceOptions = new StringBuilder();
- for (final Tolerance tolerance : Tolerance.values()) {
- if (toleranceOptions.length() > 0) {
- toleranceOptions.append("|");
- }
- toleranceOptions.append(tolerance.name().toLowerCase());
- }
- v.sendMessage(ChatColor.GOLD + "/b tpc " + toleranceOptions + " -- Toggle the calculations to emphasize accuracy or smoothness");
- return;
- }
-
- for (int i = 1; i < par.length; i++) {
- final String parameter = par[i].toUpperCase();
- try {
- this.tolerance = Tolerance.valueOf(parameter);
- v.sendMessage(ChatColor.AQUA + "Brush set to " + this.tolerance.name().toLowerCase() + " tolerance.");
- return;
- } catch (final IllegalArgumentException exception) {
- v.getVoxelMessage().brushMessage("No such tolerance.");
- }
- }
- }
-
- @Override
- public String getPermissionNode() {
- return "voxelsniper.brush.threepointcircle";
- }
-
- /**
- * Enumeration on Tolerance values.
- *
- * @author MikeMatrix
- */
- private enum Tolerance {
- DEFAULT(1000),
- ACCURATE(10),
- SMOOTH(2000);
- private int value;
-
- Tolerance(final int value) {
- this.value = value;
- }
-
- public int getValue() {
- return this.value;
- }
- }
-}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/TreeSnipeBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/TreeSnipeBrush.java
deleted file mode 100644
index f2ad22f41..000000000
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/TreeSnipeBrush.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package com.thevoxelbox.voxelsniper.brush;
-
-import com.boydti.fawe.bukkit.wrapper.AsyncBlock;
-import com.boydti.fawe.bukkit.wrapper.AsyncBlockState;
-import com.google.common.base.Objects;
-import com.thevoxelbox.voxelsniper.Message;
-import com.thevoxelbox.voxelsniper.SnipeData;
-import com.thevoxelbox.voxelsniper.Undo;
-import com.thevoxelbox.voxelsniper.util.UndoDelegate;
-import org.bukkit.ChatColor;
-import org.bukkit.Material;
-import org.bukkit.TreeType;
-import org.bukkit.block.BlockFace;
-
-public class TreeSnipeBrush extends Brush {
- private TreeType treeType = TreeType.TREE;
-
- public TreeSnipeBrush() {
- this.setName("Tree Snipe");
- }
-
- @SuppressWarnings("deprecation")
- private void single(final SnipeData v, AsyncBlock targetBlock) {
- UndoDelegate undoDelegate = new UndoDelegate(targetBlock.getWorld());
- AsyncBlock blockBelow = targetBlock.getRelative(BlockFace.DOWN);
- AsyncBlockState currentState = blockBelow.getState();
- undoDelegate.setBlock(blockBelow);
- blockBelow.setType(Material.GRASS);
- this.getWorld().generateTree(targetBlock.getLocation(), this.treeType, undoDelegate);
- Undo undo = undoDelegate.getUndo();
- blockBelow.setTypeIdAndPropertyId(currentState.getTypeId(), currentState.getPropertyId(), true);
- undo.put(blockBelow);
- v.owner().storeUndo(undo);
- }
-
- private int getYOffset() {
- for (int i = 1; i < (getTargetBlock().getWorld().getMaxHeight() - 1 - getTargetBlock().getY()); i++) {
- if (Objects.equal(getTargetBlock().getRelative(0, i + 1, 0).getType(), Material.AIR)) {
- return i;
- }
- }
- return 0;
- }
-
- private void printTreeType(final Message vm) {
- String printout = "";
-
- boolean delimiterHelper = true;
- for (final TreeType treeType : TreeType.values()) {
- if (delimiterHelper) {
- delimiterHelper = false;
- } else {
- printout += ", ";
- }
- printout += ((treeType.equals(this.treeType)) ? ChatColor.GRAY + treeType.name().toLowerCase() : ChatColor.DARK_GRAY + treeType.name().toLowerCase()) + ChatColor.WHITE;
- }
-
- vm.custom(printout);
- }
-
- @Override
- protected final void arrow(final SnipeData v) {
- AsyncBlock targetBlock = getTargetBlock().getRelative(0, getYOffset(), 0);
- this.single(v, targetBlock);
- }
-
- @Override
- protected final void powder(final SnipeData v) {
- this.single(v, getTargetBlock());
- }
-
- @Override
- public final void info(final Message vm) {
- vm.brushName(this.getName());
- this.printTreeType(vm);
- }
-
- @Override
- public final void parameters(final String[] par, final SnipeData v) {
- for (int i = 1; i < par.length; i++) {
- if (par[i].equalsIgnoreCase("info")) {
- v.sendMessage(ChatColor.GOLD + "Tree snipe brush:");
- v.sendMessage(ChatColor.AQUA + "/b t treetype");
- this.printTreeType(v.getVoxelMessage());
- return;
- }
- try {
- this.treeType = TreeType.valueOf(par[i].toUpperCase());
- this.printTreeType(v.getVoxelMessage());
- } catch (final IllegalArgumentException exception) {
- v.getVoxelMessage().brushMessage("No such tree type.");
- }
- }
- }
-
- @Override
- public String getPermissionNode() {
- return "voxelsniper.brush.treesnipe";
- }
-}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/TriangleBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/TriangleBrush.java
deleted file mode 100644
index ac0a7d276..000000000
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/TriangleBrush.java
+++ /dev/null
@@ -1,293 +0,0 @@
-package com.thevoxelbox.voxelsniper.brush;
-
-import com.thevoxelbox.voxelsniper.Message;
-import com.thevoxelbox.voxelsniper.SnipeData;
-import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush;
-import org.bukkit.ChatColor;
-
-public class TriangleBrush extends PerformBrush {
- private double[] coordsOne = new double[3]; // Three corners
- private double[] coordsTwo = new double[3];
- private double[] coordsThree = new double[3];
- private int cornernumber = 1;
- private double[] currentCoords = new double[3]; // For loop tracking
- private double[] vectorOne = new double[3]; // Point 1 to 2
- private double[] vectorTwo = new double[3]; // Point 1 to 3
- private double[] vectorThree = new double[3]; // Point 2 to 3, for area calculations
- private double[] normalVector = new double[3];
-
- public TriangleBrush() {
- this.setName("Triangle");
- }
-
- private void triangleA(final SnipeData v) {
- switch (this.cornernumber) {
- case 1:
- this.coordsOne[0] = this.getTargetBlock().getX() + .5 * this.getTargetBlock().getX() / Math.abs(this.getTargetBlock().getX()); // I hate you sometimes, Notch. Really? Every quadrant is
- // different?
- this.coordsOne[1] = this.getTargetBlock().getY() + .5;
- this.coordsOne[2] = this.getTargetBlock().getZ() + .5 * this.getTargetBlock().getZ() / Math.abs(this.getTargetBlock().getZ());
- this.cornernumber = 2;
- v.sendMessage(ChatColor.GRAY + "First Corner set.");
- break;
- case 2:
- this.coordsTwo[0] = this.getTargetBlock().getX() + .5 * this.getTargetBlock().getX() / Math.abs(this.getTargetBlock().getX()); // I hate you sometimes, Notch. Really? Every quadrant is
- // different?
- this.coordsTwo[1] = this.getTargetBlock().getY() + .5;
- this.coordsTwo[2] = this.getTargetBlock().getZ() + .5 * this.getTargetBlock().getZ() / Math.abs(this.getTargetBlock().getZ());
- this.cornernumber = 3;
- v.sendMessage(ChatColor.GRAY + "Second Corner set.");
- break;
- case 3:
- this.coordsThree[0] = this.getTargetBlock().getX() + .5 * this.getTargetBlock().getX() / Math.abs(this.getTargetBlock().getX()); // I hate you sometimes, Notch. Really? Every quadrant is
- // different?
- this.coordsThree[1] = this.getTargetBlock().getY() + .5;
- this.coordsThree[2] = this.getTargetBlock().getZ() + .5 * this.getTargetBlock().getZ() / Math.abs(this.getTargetBlock().getZ());
- this.cornernumber = 1;
- v.sendMessage(ChatColor.GRAY + "Third Corner set.");
- break;
- default:
- break;
-
- }
-
- }
-
- private void triangleP(final SnipeData v) {
- double lengthOne;
- double lengthTwo;
- double lengthThree;
- double heronBig;
-
- // Calculate slope vectors
- for (int i = 0; i < 3; i++) {
- this.vectorOne[i] = this.coordsTwo[i] - this.coordsOne[i];
- this.vectorTwo[i] = this.coordsThree[i] - this.coordsOne[i];
- this.vectorThree[i] = this.coordsThree[i] - this.coordsTwo[i];
- }
-
- // Calculate the cross product of vectorone and vectortwo
- this.normalVector[0] = this.vectorOne[1] * this.vectorTwo[2] - this.vectorOne[2] * this.vectorTwo[1];
- this.normalVector[1] = this.vectorOne[2] * this.vectorTwo[0] - this.vectorOne[0] * this.vectorTwo[2];
- this.normalVector[2] = this.vectorOne[0] * this.vectorTwo[1] - this.vectorOne[1] * this.vectorTwo[0];
-
- // Calculate magnitude of slope vectors
- lengthOne = Math.pow(Math.pow(this.vectorOne[0], 2) + Math.pow(this.vectorOne[1], 2) + Math.pow(this.vectorOne[2], 2), .5);
- lengthTwo = Math.pow(Math.pow(this.vectorTwo[0], 2) + Math.pow(this.vectorTwo[1], 2) + Math.pow(this.vectorTwo[2], 2), .5);
- lengthThree = Math.pow(Math.pow(this.vectorThree[0], 2) + Math.pow(this.vectorThree[1], 2) + Math.pow(this.vectorThree[2], 2), .5);
-
- // Bigger vector determines brush size
- final int brushSize = (int) Math.ceil(Math.max(lengthOne, lengthTwo));
-
- // Calculate constant term
- final double planeConstant = this.normalVector[0] * this.coordsOne[0] + this.normalVector[1] * this.coordsOne[1] + this.normalVector[2] * this.coordsOne[2];
-
- // Calculate the area of the full triangle
- heronBig = .25 * Math.pow(Math.pow(Math.pow(lengthOne, 2) + Math.pow(lengthTwo, 2) + Math.pow(lengthThree, 2), 2) - 2 * (Math.pow(lengthOne, 4) + Math.pow(lengthTwo, 4) + Math.pow(lengthThree, 4)), .5);
-
- if (lengthOne == 0 || lengthTwo == 0 || (this.coordsOne[0] == 0 && this.coordsOne[1] == 0 && this.coordsOne[2] == 0) || (this.coordsTwo[0] == 0 && this.coordsTwo[1] == 0 && this.coordsTwo[2] == 0) || (this.coordsThree[0] == 0 && this.coordsThree[1] == 0 && this.coordsThree[2] == 0)) {
- v.sendMessage(ChatColor.RED + "ERROR: Invalid corners, please try again.");
- } else {
- // Make the Changes
- final double[] cVectorOne = new double[3];
- final double[] cVectorTwo = new double[3];
- final double[] cVectorThree = new double[3];
-
- for (int y = -brushSize; y <= brushSize; y++) { // X DEPENDENT
- for (int z = -brushSize; z <= brushSize; z++) {
- this.currentCoords[1] = this.coordsOne[1] + y;
- this.currentCoords[2] = this.coordsOne[2] + z;
- this.currentCoords[0] = (planeConstant - this.normalVector[1] * this.currentCoords[1] - this.normalVector[2] * this.currentCoords[2]) / this.normalVector[0];
-
- // Area of triangle currentcoords, coordsone, coordstwo
- for (int i = 0; i < 3; i++) {
- cVectorOne[i] = this.coordsTwo[i] - this.coordsOne[i];
- cVectorTwo[i] = this.currentCoords[i] - this.coordsOne[i];
- cVectorThree[i] = this.currentCoords[i] - this.coordsTwo[i];
- }
- double cLengthOne = Math.pow(Math.pow(cVectorOne[0], 2) + Math.pow(cVectorOne[1], 2) + Math.pow(cVectorOne[2], 2), .5);
- double cLengthTwo = Math.pow(Math.pow(cVectorTwo[0], 2) + Math.pow(cVectorTwo[1], 2) + Math.pow(cVectorTwo[2], 2), .5);
- double cLengthThree = Math.pow(Math.pow(cVectorThree[0], 2) + Math.pow(cVectorThree[1], 2) + Math.pow(cVectorThree[2], 2), .5);
-
- final double heronOne = .25 * Math.pow(Math.pow(Math.pow(cLengthOne, 2) + Math.pow(cLengthTwo, 2) + Math.pow(cLengthThree, 2), 2) - 2 * (Math.pow(cLengthOne, 4) + Math.pow(cLengthTwo, 4) + Math.pow(cLengthThree, 4)), .5);
-
- // Area of triangle currentcoords, coordsthree, coordstwo
- for (int i = 0; i < 3; i++) {
- cVectorOne[i] = this.coordsTwo[i] - this.coordsThree[i];
- cVectorTwo[i] = this.currentCoords[i] - this.coordsThree[i];
- cVectorThree[i] = this.currentCoords[i] - this.coordsTwo[i];
- }
- cLengthOne = Math.pow(Math.pow(cVectorOne[0], 2) + Math.pow(cVectorOne[1], 2) + Math.pow(cVectorOne[2], 2), .5);
- cLengthTwo = Math.pow(Math.pow(cVectorTwo[0], 2) + Math.pow(cVectorTwo[1], 2) + Math.pow(cVectorTwo[2], 2), .5);
- cLengthThree = Math.pow(Math.pow(cVectorThree[0], 2) + Math.pow(cVectorThree[1], 2) + Math.pow(cVectorThree[2], 2), .5);
- final double heronTwo = .25 * Math.pow(Math.pow(Math.pow(cLengthOne, 2) + Math.pow(cLengthTwo, 2) + Math.pow(cLengthThree, 2), 2) - 2 * (Math.pow(cLengthOne, 4) + Math.pow(cLengthTwo, 4) + Math.pow(cLengthThree, 4)), .5);
-
- // Area of triangle currentcoords, coordsthree, coordsone
- for (int i = 0; i < 3; i++) {
- cVectorOne[i] = this.coordsOne[i] - this.coordsThree[i];
- cVectorTwo[i] = this.currentCoords[i] - this.coordsThree[i];
- cVectorThree[i] = this.currentCoords[i] - this.coordsOne[i];
- }
- cLengthOne = Math.pow(Math.pow(cVectorOne[0], 2) + Math.pow(cVectorOne[1], 2) + Math.pow(cVectorOne[2], 2), .5);
- cLengthTwo = Math.pow(Math.pow(cVectorTwo[0], 2) + Math.pow(cVectorTwo[1], 2) + Math.pow(cVectorTwo[2], 2), .5);
- cLengthThree = Math.pow(Math.pow(cVectorThree[0], 2) + Math.pow(cVectorThree[1], 2) + Math.pow(cVectorThree[2], 2), .5);
- final double heronThree = .25 * Math.pow(Math.pow(Math.pow(cLengthOne, 2) + Math.pow(cLengthTwo, 2) + Math.pow(cLengthThree, 2), 2) - 2 * (Math.pow(cLengthOne, 4) + Math.pow(cLengthTwo, 4) + Math.pow(cLengthThree, 4)), .5);
-
- final double barycentric = (heronOne + heronTwo + heronThree) / heronBig;
-
- if (barycentric <= 1.1) {
-
- this.current.perform(this.clampY((int) this.currentCoords[0], (int) this.currentCoords[1], (int) this.currentCoords[2]));
-
- }
-
- }
- } // END X DEPENDENT
-
- for (int x = -brushSize; x <= brushSize; x++) { // Y DEPENDENT
- for (int z = -brushSize; z <= brushSize; z++) {
- this.currentCoords[0] = this.coordsOne[0] + x;
- this.currentCoords[2] = this.coordsOne[2] + z;
- this.currentCoords[1] = (planeConstant - this.normalVector[0] * this.currentCoords[0] - this.normalVector[2] * this.currentCoords[2]) / this.normalVector[1];
-
- // Area of triangle currentcoords, coordsone, coordstwo
- for (int i = 0; i < 3; i++) {
- cVectorOne[i] = this.coordsTwo[i] - this.coordsOne[i];
- cVectorTwo[i] = this.currentCoords[i] - this.coordsOne[i];
- cVectorThree[i] = this.currentCoords[i] - this.coordsTwo[i];
- }
- double cLengthOne = Math.pow(Math.pow(cVectorOne[0], 2) + Math.pow(cVectorOne[1], 2) + Math.pow(cVectorOne[2], 2), .5);
- double cLengthTwo = Math.pow(Math.pow(cVectorTwo[0], 2) + Math.pow(cVectorTwo[1], 2) + Math.pow(cVectorTwo[2], 2), .5);
- double cLengthThree = Math.pow(Math.pow(cVectorThree[0], 2) + Math.pow(cVectorThree[1], 2) + Math.pow(cVectorThree[2], 2), .5);
-
- final double heronOne = .25 * Math.pow(Math.pow(Math.pow(cLengthOne, 2) + Math.pow(cLengthTwo, 2) + Math.pow(cLengthThree, 2), 2) - 2 * (Math.pow(cLengthOne, 4) + Math.pow(cLengthTwo, 4) + Math.pow(cLengthThree, 4)), .5);
-
- // Area of triangle currentcoords, coordsthree, coordstwo
- for (int i = 0; i < 3; i++) {
- cVectorOne[i] = this.coordsTwo[i] - this.coordsThree[i];
- cVectorTwo[i] = this.currentCoords[i] - this.coordsThree[i];
- cVectorThree[i] = this.currentCoords[i] - this.coordsTwo[i];
- }
- cLengthOne = Math.pow(Math.pow(cVectorOne[0], 2) + Math.pow(cVectorOne[1], 2) + Math.pow(cVectorOne[2], 2), .5);
- cLengthTwo = Math.pow(Math.pow(cVectorTwo[0], 2) + Math.pow(cVectorTwo[1], 2) + Math.pow(cVectorTwo[2], 2), .5);
- cLengthThree = Math.pow(Math.pow(cVectorThree[0], 2) + Math.pow(cVectorThree[1], 2) + Math.pow(cVectorThree[2], 2), .5);
- final double heronTwo = .25 * Math.pow(Math.pow(Math.pow(cLengthOne, 2) + Math.pow(cLengthTwo, 2) + Math.pow(cLengthThree, 2), 2) - 2 * (Math.pow(cLengthOne, 4) + Math.pow(cLengthTwo, 4) + Math.pow(cLengthThree, 4)), .5);
-
- // Area of triangle currentcoords, coordsthree, coordsone
- for (int i = 0; i < 3; i++) {
- cVectorOne[i] = this.coordsOne[i] - this.coordsThree[i];
- cVectorTwo[i] = this.currentCoords[i] - this.coordsThree[i];
- cVectorThree[i] = this.currentCoords[i] - this.coordsOne[i];
- }
- cLengthOne = Math.pow(Math.pow(cVectorOne[0], 2) + Math.pow(cVectorOne[1], 2) + Math.pow(cVectorOne[2], 2), .5);
- cLengthTwo = Math.pow(Math.pow(cVectorTwo[0], 2) + Math.pow(cVectorTwo[1], 2) + Math.pow(cVectorTwo[2], 2), .5);
- cLengthThree = Math.pow(Math.pow(cVectorThree[0], 2) + Math.pow(cVectorThree[1], 2) + Math.pow(cVectorThree[2], 2), .5);
- final double heronThree = .25 * Math.pow(Math.pow(Math.pow(cLengthOne, 2) + Math.pow(cLengthTwo, 2) + Math.pow(cLengthThree, 2), 2) - 2 * (Math.pow(cLengthOne, 4) + Math.pow(cLengthTwo, 4) + Math.pow(cLengthThree, 4)), .5);
-
- final double barycentric = (heronOne + heronTwo + heronThree) / heronBig;
-
- if (barycentric <= 1.1) {
-
- this.current.perform(this.clampY((int) this.currentCoords[0], (int) this.currentCoords[1], (int) this.currentCoords[2]));
-
- }
-
- }
- } // END Y DEPENDENT
- for (int x = -brushSize; x <= brushSize; x++) { // Z DEPENDENT
- for (int y = -brushSize; y <= brushSize; y++) {
- this.currentCoords[0] = this.coordsOne[0] + x;
- this.currentCoords[1] = this.coordsOne[1] + y;
- this.currentCoords[2] = (planeConstant - this.normalVector[0] * this.currentCoords[0] - this.normalVector[1] * this.currentCoords[1]) / this.normalVector[2];
-
- // Area of triangle currentcoords, coordsone, coordstwo
- for (int i = 0; i < 3; i++) {
- cVectorOne[i] = this.coordsTwo[i] - this.coordsOne[i];
- cVectorTwo[i] = this.currentCoords[i] - this.coordsOne[i];
- cVectorThree[i] = this.currentCoords[i] - this.coordsTwo[i];
- }
- double cLengthOne = Math.pow(Math.pow(cVectorOne[0], 2) + Math.pow(cVectorOne[1], 2) + Math.pow(cVectorOne[2], 2), .5);
- double cLengthTwo = Math.pow(Math.pow(cVectorTwo[0], 2) + Math.pow(cVectorTwo[1], 2) + Math.pow(cVectorTwo[2], 2), .5);
- double cLengthThree = Math.pow(Math.pow(cVectorThree[0], 2) + Math.pow(cVectorThree[1], 2) + Math.pow(cVectorThree[2], 2), .5);
-
- final double heronOne = .25 * Math.pow(Math.pow(Math.pow(cLengthOne, 2) + Math.pow(cLengthTwo, 2) + Math.pow(cLengthThree, 2), 2) - 2 * (Math.pow(cLengthOne, 4) + Math.pow(cLengthTwo, 4) + Math.pow(cLengthThree, 4)), .5);
-
- // Area of triangle currentcoords, coordsthree, coordstwo
- for (int i = 0; i < 3; i++) {
- cVectorOne[i] = this.coordsTwo[i] - this.coordsThree[i];
- cVectorTwo[i] = this.currentCoords[i] - this.coordsThree[i];
- cVectorThree[i] = this.currentCoords[i] - this.coordsTwo[i];
- }
- cLengthOne = Math.pow(Math.pow(cVectorOne[0], 2) + Math.pow(cVectorOne[1], 2) + Math.pow(cVectorOne[2], 2), .5);
- cLengthTwo = Math.pow(Math.pow(cVectorTwo[0], 2) + Math.pow(cVectorTwo[1], 2) + Math.pow(cVectorTwo[2], 2), .5);
- cLengthThree = Math.pow(Math.pow(cVectorThree[0], 2) + Math.pow(cVectorThree[1], 2) + Math.pow(cVectorThree[2], 2), .5);
- final double heronTwo = .25 * Math.pow(Math.pow(Math.pow(cLengthOne, 2) + Math.pow(cLengthTwo, 2) + Math.pow(cLengthThree, 2), 2) - 2 * (Math.pow(cLengthOne, 4) + Math.pow(cLengthTwo, 4) + Math.pow(cLengthThree, 4)), .5);
-
- // Area of triangle currentcoords, coordsthree, coordsone
- for (int i = 0; i < 3; i++) {
- cVectorOne[i] = this.coordsOne[i] - this.coordsThree[i];
- cVectorTwo[i] = this.currentCoords[i] - this.coordsThree[i];
- cVectorThree[i] = this.currentCoords[i] - this.coordsOne[i];
- }
- cLengthOne = Math.pow(Math.pow(cVectorOne[0], 2) + Math.pow(cVectorOne[1], 2) + Math.pow(cVectorOne[2], 2), .5);
- cLengthTwo = Math.pow(Math.pow(cVectorTwo[0], 2) + Math.pow(cVectorTwo[1], 2) + Math.pow(cVectorTwo[2], 2), .5);
- cLengthThree = Math.pow(Math.pow(cVectorThree[0], 2) + Math.pow(cVectorThree[1], 2) + Math.pow(cVectorThree[2], 2), .5);
- final double heronThree = .25 * Math.pow(Math.pow(Math.pow(cLengthOne, 2) + Math.pow(cLengthTwo, 2) + Math.pow(cLengthThree, 2), 2) - 2 * (Math.pow(cLengthOne, 4) + Math.pow(cLengthTwo, 4) + Math.pow(cLengthThree, 4)), .5);
-
- final double barycentric = (heronOne + heronTwo + heronThree) / heronBig;
-
- // VoxelSniper.log.info("Bary: "+barycentric+", hb: "+heronbig+", h1: "+heronone+", h2: "+herontwo+", h3: "+heronthree);
-
- if (barycentric <= 1.1) {
- this.current.perform(this.clampY((int) this.currentCoords[0], (int) this.currentCoords[1], (int) this.currentCoords[2]));
- }
- }
- } // END Z DEPENDENT
-
- v.owner().storeUndo(this.current.getUndo());
-
- }
-
- // RESET BRUSH
- this.coordsOne[0] = 0;
- this.coordsOne[1] = 0;
- this.coordsOne[2] = 0;
- this.coordsTwo[0] = 0;
- this.coordsTwo[1] = 0;
- this.coordsTwo[2] = 0;
- this.coordsThree[0] = 0;
- this.coordsThree[1] = 0;
- this.coordsThree[2] = 0;
-
- this.cornernumber = 1;
-
- }
-
- @Override
- protected final void arrow(final SnipeData v) {
- this.triangleA(v);
- }
-
- @Override
- protected final void powder(final SnipeData v) { // Add a point
- this.triangleP(v);
- }
-
-
- @Override
- public final void info(final Message vm) { // Make the triangle
- vm.brushName(this.getName());
- }
-
- @Override
- public final void parameters(final String[] par, final SnipeData v) {
- if (par[1].equalsIgnoreCase("info")) {
- v.sendMessage(ChatColor.GOLD + "Triangle Brush instructions: Select three corners with the arrow brush, then generate the triangle with the powder brush.");
- }
- }
-
- @Override
- public String getPermissionNode() {
- return "voxelsniper.brush.triangle";
- }
-}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/UnderlayBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/UnderlayBrush.java
deleted file mode 100644
index db38e29ff..000000000
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/UnderlayBrush.java
+++ /dev/null
@@ -1,147 +0,0 @@
-package com.thevoxelbox.voxelsniper.brush;
-
-import com.sk89q.worldedit.world.block.BlockTypes;
-import com.sk89q.worldedit.world.registry.BlockMaterial;
-import com.thevoxelbox.voxelsniper.Message;
-import com.thevoxelbox.voxelsniper.SnipeData;
-import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush;
-import org.bukkit.ChatColor;
-
-public class UnderlayBrush extends PerformBrush {
- private static final int DEFAULT_DEPTH = 3;
- private int depth = DEFAULT_DEPTH;
- private boolean allBlocks = false;
-
- public UnderlayBrush() {
- this.setName("Underlay (Reverse Overlay)");
- }
-
- @SuppressWarnings("deprecation")
- private void underlay(final SnipeData v) {
- final int[][] memory = new int[v.getBrushSize() * 2 + 1][v.getBrushSize() * 2 + 1];
- final double brushSizeSquared = Math.pow(v.getBrushSize() + 0.5, 2);
-
- for (int z = v.getBrushSize(); z >= -v.getBrushSize(); z--) {
- for (int x = v.getBrushSize(); x >= -v.getBrushSize(); x--) {
- for (int y = this.getTargetBlock().getY(); y < this.getTargetBlock().getY() + this.depth; y++) { // start scanning from the height you clicked at
- if (memory[x + v.getBrushSize()][z + v.getBrushSize()] != 1) { // if haven't already found the surface in this column
- if ((Math.pow(x, 2) + Math.pow(z, 2)) <= brushSizeSquared) { // if inside of the column...
- if (!this.allBlocks) { // if the override parameter has not been activated, go to the switch that filters out manmade stuff.
- int id = this.getBlockIdAt(this.getTargetBlock().getX() + x, y, this.getTargetBlock().getZ() + z);
- BlockMaterial mat = BlockTypes.get(id).getMaterial();
- if (!mat.isReplacedDuringPlacement() && mat.isFullCube()) {
- for (int d = 0; (d < this.depth); d++) {
- if (!this.clampY(this.getTargetBlock().getX() + x, y + d, this.getTargetBlock().getZ() + z).isEmpty()) {
- this.current.perform(this.clampY(this.getTargetBlock().getX() + x, y + d, this.getTargetBlock().getZ() + z)); // fills down as many layers as you specify in
- // parameters
- memory[x + v.getBrushSize()][z + v.getBrushSize()] = 1; // stop it from checking any other blocks in this vertical 1x1 column.
- }
- }
- break;
-
- }
- } else {
- for (int d = 0; (d < this.depth); d++) {
- if (!this.clampY(this.getTargetBlock().getX() + x, y + d, this.getTargetBlock().getZ() + z).isEmpty()) {
- this.current.perform(this.clampY(this.getTargetBlock().getX() + x, y + d, this.getTargetBlock().getZ() + z)); // fills down as many layers as you specify in
- // parameters
- memory[x + v.getBrushSize()][z + v.getBrushSize()] = 1; // stop it from checking any other blocks in this vertical 1x1 column.
- }
- }
- }
- }
-
- }
- }
- }
- }
-
- v.owner().storeUndo(this.current.getUndo());
- }
-
- private void underlay2(final SnipeData v) {
- final int[][] memory = new int[v.getBrushSize() * 2 + 1][v.getBrushSize() * 2 + 1];
- final double brushSizeSquared = Math.pow(v.getBrushSize() + 0.5, 2);
-
- for (int z = v.getBrushSize(); z >= -v.getBrushSize(); z--) {
- for (int x = v.getBrushSize(); x >= -v.getBrushSize(); x--) {
- for (int y = this.getTargetBlock().getY(); y < this.getTargetBlock().getY() + this.depth; y++) { // start scanning from the height you clicked at
- if (memory[x + v.getBrushSize()][z + v.getBrushSize()] != 1) { // if haven't already found the surface in this column
- if ((Math.pow(x, 2) + Math.pow(z, 2)) <= brushSizeSquared) { // if inside of the column...
-
- if (!this.allBlocks) { // if the override parameter has not been activated, go to the switch that filters out manmade stuff.
-
- int id = this.getBlockIdAt(this.getTargetBlock().getX() + x, y, this.getTargetBlock().getZ() + z);
- BlockMaterial mat = BlockTypes.get(id).getMaterial();
- if (!mat.isReplacedDuringPlacement() && mat.isFullCube()) {
- for (int d = -1; (d < this.depth - 1); d++) {
- this.current.perform(this.clampY(this.getTargetBlock().getX() + x, y - d, this.getTargetBlock().getZ() + z)); // fills down as many layers as you specify in
- // parameters
- memory[x + v.getBrushSize()][z + v.getBrushSize()] = 1; // stop it from checking any other blocks in this vertical 1x1 column.
- }
- break;
- }
- } else {
- for (int d = -1; (d < this.depth - 1); d++) {
- this.current.perform(this.clampY(this.getTargetBlock().getX() + x, y - d, this.getTargetBlock().getZ() + z)); // fills down as many layers as you specify in
- // parameters
- memory[x + v.getBrushSize()][z + v.getBrushSize()] = 1; // stop it from checking any other blocks in this vertical 1x1 column.
- }
- }
- }
- }
- }
- }
- }
-
- v.owner().storeUndo(this.current.getUndo());
- }
-
- @Override
- public final void arrow(final SnipeData v) {
- this.underlay(v);
- }
-
- @Override
- public final void powder(final SnipeData v) {
- this.underlay2(v);
- }
-
- @Override
- public final void info(final Message vm) {
- vm.brushName(this.getName());
- vm.size();
- }
-
- @Override
- public final void parameters(final String[] par, final SnipeData v) {
- for (int i = 1; i < par.length; i++) {
- if (par[i].equalsIgnoreCase("info")) {
- v.owner().getPlayer().sendMessage(ChatColor.GOLD + "Reverse Overlay brush parameters:");
- v.owner().getPlayer().sendMessage(ChatColor.AQUA + "d[number] (ex: d3) The number of blocks thick to change.");
- v.owner().getPlayer().sendMessage(ChatColor.BLUE + "all (ex: /b reover all) Sets the brush to affect ALL materials");
- if (this.depth < 1) {
- this.depth = 1;
- }
- return;
- }
- if (par[i].startsWith("d")) {
- this.depth = Integer.parseInt(par[i].replace("d", ""));
- v.owner().getPlayer().sendMessage(ChatColor.AQUA + "Depth set to " + this.depth);
- } else if (par[i].startsWith("all")) {
- this.allBlocks = true;
- v.owner().getPlayer().sendMessage(ChatColor.BLUE + "Will underlay over any block." + this.depth);
- } else if (par[i].startsWith("some")) {
- this.allBlocks = false;
- v.owner().getPlayer().sendMessage(ChatColor.BLUE + "Will underlay only natural block types." + this.depth);
- } else {
- v.owner().getPlayer().sendMessage(ChatColor.RED + "Invalid brush parameters! Use the info parameter to display parameter info.");
- }
- }
- }
-
- @Override
- public String getPermissionNode() {
- return "voxelsniper.brush.underlay";
- }
-}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/VoltMeterBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/VoltMeterBrush.java
deleted file mode 100644
index 2ded259b0..000000000
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/VoltMeterBrush.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.thevoxelbox.voxelsniper.brush;
-
-import com.boydti.fawe.bukkit.wrapper.AsyncBlock;
-import com.thevoxelbox.voxelsniper.Message;
-import com.thevoxelbox.voxelsniper.SnipeData;
-import org.bukkit.ChatColor;
-import org.bukkit.block.Block;
-import org.bukkit.block.BlockFace;
-
-public class VoltMeterBrush extends Brush {
-
- public VoltMeterBrush() {
- this.setName("VoltMeter");
- }
-
- private void data(final SnipeData v) {
- final AsyncBlock block = this.clampY(this.getTargetBlock().getX(), this.getTargetBlock().getY(), this.getTargetBlock().getZ());
- final int data = block.getPropertyId();
- v.sendMessage(ChatColor.AQUA + "Blocks until repeater needed: " + data);
- }
-
- private void volt(final SnipeData v) {
- final Block block = this.clampY(this.getTargetBlock().getX(), this.getTargetBlock().getY(), this.getTargetBlock().getZ());
- final boolean indirect = block.isBlockIndirectlyPowered();
- final boolean direct = block.isBlockPowered();
- v.sendMessage(ChatColor.AQUA + "Direct Power? " + direct + " Indirect Power? " + indirect);
- v.sendMessage(ChatColor.BLUE + "Top Direct? " + block.isBlockFacePowered(BlockFace.UP) + " Top Indirect? " + block.isBlockFaceIndirectlyPowered(BlockFace.UP));
- v.sendMessage(ChatColor.BLUE + "Bottom Direct? " + block.isBlockFacePowered(BlockFace.DOWN) + " Bottom Indirect? " + block.isBlockFaceIndirectlyPowered(BlockFace.DOWN));
- v.sendMessage(ChatColor.BLUE + "East Direct? " + block.isBlockFacePowered(BlockFace.EAST) + " East Indirect? " + block.isBlockFaceIndirectlyPowered(BlockFace.EAST));
- v.sendMessage(ChatColor.BLUE + "West Direct? " + block.isBlockFacePowered(BlockFace.WEST) + " West Indirect? " + block.isBlockFaceIndirectlyPowered(BlockFace.WEST));
- v.sendMessage(ChatColor.BLUE + "North Direct? " + block.isBlockFacePowered(BlockFace.NORTH) + " North Indirect? " + block.isBlockFaceIndirectlyPowered(BlockFace.NORTH));
- v.sendMessage(ChatColor.BLUE + "South Direct? " + block.isBlockFacePowered(BlockFace.SOUTH) + " South Indirect? " + block.isBlockFaceIndirectlyPowered(BlockFace.SOUTH));
- }
-
- @Override
- protected final void arrow(final SnipeData v) {
- this.volt(v);
- }
-
- @Override
- protected final void powder(final SnipeData v) {
- this.data(v);
- }
-
- @Override
- public final void info(final Message vm) {
- vm.brushName(this.getName());
- vm.brushMessage("Right click with arrow to see if blocks/faces are powered. Powder measures wire current.");
- }
-
- @Override
- public String getPermissionNode() {
- return "voxelsniper.brush.voltmeter";
- }
-}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/VoxelBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/VoxelBrush.java
deleted file mode 100644
index 473e7e469..000000000
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/VoxelBrush.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.thevoxelbox.voxelsniper.brush;
-
-import com.thevoxelbox.voxelsniper.Message;
-import com.thevoxelbox.voxelsniper.SnipeData;
-import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush;
-
-
-public class VoxelBrush extends PerformBrush {
-
- public VoxelBrush() {
- this.setName("Voxel");
- }
-
- private void voxel(final SnipeData v) {
- for (int z = v.getBrushSize(); z >= -v.getBrushSize(); z--) {
- for (int x = v.getBrushSize(); x >= -v.getBrushSize(); x--) {
- for (int y = v.getBrushSize(); y >= -v.getBrushSize(); y--) {
- this.current.perform(this.clampY(this.getTargetBlock().getX() + x, this.getTargetBlock().getY() + z, this.getTargetBlock().getZ() + y));
- }
- }
- }
- v.owner().storeUndo(this.current.getUndo());
- }
-
- @Override
- protected final void arrow(final SnipeData v) {
- this.voxel(v);
- }
-
- @Override
- protected final void powder(final SnipeData v) {
- this.voxel(v);
- }
-
- @Override
- public final void info(final Message vm) {
- vm.brushName(this.getName());
- vm.size();
- }
-
- @Override
- public String getPermissionNode() {
- return "voxelsniper.brush.voxel";
- }
-}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/VoxelDiscBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/VoxelDiscBrush.java
deleted file mode 100644
index 11f0c780d..000000000
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/VoxelDiscBrush.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.thevoxelbox.voxelsniper.brush;
-
-import com.boydti.fawe.bukkit.wrapper.AsyncBlock;
-import com.thevoxelbox.voxelsniper.Message;
-import com.thevoxelbox.voxelsniper.SnipeData;
-import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush;
-
-
-public class VoxelDiscBrush extends PerformBrush {
-
- public VoxelDiscBrush() {
- this.setName("Voxel Disc");
- }
-
- private void disc(final SnipeData v, AsyncBlock targetBlock) {
- for (int x = v.getBrushSize(); x >= -v.getBrushSize(); x--) {
- for (int z = v.getBrushSize(); z >= -v.getBrushSize(); z--) {
- current.perform(targetBlock.getRelative(x, 0, z));
- }
- }
- v.owner().storeUndo(this.current.getUndo());
- }
-
- @Override
- protected final void arrow(final SnipeData v) {
- this.disc(v, this.getTargetBlock());
- }
-
- @Override
- protected final void powder(final SnipeData v) {
- this.disc(v, this.getLastBlock());
- }
-
- @Override
- public final void info(final Message vm) {
- vm.brushName(this.getName());
- vm.size();
- }
-
- @Override
- public String getPermissionNode() {
- return "voxelsniper.brush.voxeldisc";
- }
-}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/VoxelDiscFaceBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/VoxelDiscFaceBrush.java
deleted file mode 100644
index d6b795863..000000000
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/VoxelDiscFaceBrush.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package com.thevoxelbox.voxelsniper.brush;
-
-import com.thevoxelbox.voxelsniper.Message;
-import com.thevoxelbox.voxelsniper.SnipeData;
-import com.thevoxelbox.voxelsniper.brush.perform.PerformBrush;
-import org.bukkit.block.Block;
-import org.bukkit.block.BlockFace;
-
-
-public class VoxelDiscFaceBrush extends PerformBrush {
-
- public VoxelDiscFaceBrush() {
- this.setName("Voxel Disc Face");
- }
-
- private void disc(final SnipeData v, Block targetBlock) {
- for (int x = v.getBrushSize(); x >= -v.getBrushSize(); x--) {
- for (int y = v.getBrushSize(); y >= -v.getBrushSize(); y--) {
- this.current.perform(this.clampY(targetBlock.getX() + x, targetBlock.getY(), targetBlock.getZ() + y));
- }
- }
-
- v.owner().storeUndo(this.current.getUndo());
- }
-
- private void discNS(final SnipeData v, Block targetBlock) {
- for (int x = v.getBrushSize(); x >= -v.getBrushSize(); x--) {
- for (int y = v.getBrushSize(); y >= -v.getBrushSize(); y--) {
- this.current.perform(this.clampY(targetBlock.getX() + x, targetBlock.getY() + y, targetBlock.getZ()));
- }
- }
-
- v.owner().storeUndo(this.current.getUndo());
- }
-
- private void discEW(final SnipeData v, Block targetBlock) {
- for (int x = v.getBrushSize(); x >= -v.getBrushSize(); x--) {
- for (int y = v.getBrushSize(); y >= -v.getBrushSize(); y--) {
- this.current.perform(this.clampY(targetBlock.getX(), targetBlock.getY() + x, targetBlock.getZ() + y));
- }
- }
-
- v.owner().storeUndo(this.current.getUndo());
- }
-
- private void pre(final SnipeData v, final BlockFace bf, Block targetBlock) {
- if (bf == null) {
- return;
- }
- switch (bf) {
- case NORTH:
- case SOUTH:
- this.discNS(v, targetBlock);
- break;
-
- case EAST:
- case WEST:
- this.discEW(v, targetBlock);
- break;
-
- case UP:
- case DOWN:
- this.disc(v, targetBlock);
- break;
-
- default:
- break;
- }
- }
-
- @Override
- protected final void arrow(final SnipeData v) {
- this.pre(v, this.getTargetBlock().getFace(this.getLastBlock()), this.getTargetBlock());
- }
-
- @Override
- protected final void powder(final SnipeData v) {
- this.pre(v, this.getTargetBlock().getFace(this.getLastBlock()), this.getLastBlock());
- }
-
- @Override
- public final void info(final Message vm) {
- vm.brushName(this.getName());
- vm.size();
- }
-
- @Override
- public String getPermissionNode() {
- return "voxelsniper.brush.voxeldiscface";
- }
-}
diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/WallSider.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/WallSider.java
deleted file mode 100644
index 6f086f76c..000000000
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/WallSider.java
+++ /dev/null
@@ -1,128 +0,0 @@
-package com.thevoxelbox.voxelsniper.brush;
-
-import com.boydti.fawe.bukkit.wrapper.AsyncBlock;
-import com.thevoxelbox.voxelsniper.Message;
-import com.thevoxelbox.voxelsniper.SnipeData;
-import org.bukkit.ChatColor;
-import org.bukkit.block.Block;
-import org.bukkit.util.Vector;
-
-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 " + 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/java/com/thevoxelbox/voxelsniper/brush/WarpBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/WarpBrush.java
deleted file mode 100644
index e242a5625..000000000
--- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/WarpBrush.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- This file is part of VoxelSniper, licensed under the MIT License (MIT).
-
- Copyright (c) The VoxelBox
- Copyright (c) contributors
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- */
-package com.thevoxelbox.voxelsniper.brush;
-
-import com.boydti.fawe.object.RunnableVal;
-import com.boydti.fawe.util.TaskManager;
-import com.thevoxelbox.voxelsniper.Message;
-import com.thevoxelbox.voxelsniper.SnipeData;
-import org.bukkit.Bukkit;
-import org.bukkit.Location;
-import org.bukkit.entity.Player;
-
-public class WarpBrush extends Brush {
-
- public WarpBrush() {
- this.setName("Warp");
- }
-
- @Override
- public final void info(final Message vm) {
- vm.brushName(this.getName());
- }
-
- @Override
- protected final void arrow(final SnipeData v) {
- Player player = v.owner().getPlayer();
- Location location = this.getLastBlock().getLocation();
- Location playerLocation = player.getLocation();
- location.setPitch(playerLocation.getPitch());
- location.setYaw(playerLocation.getYaw());
- location.setWorld(Bukkit.getWorld(location.getWorld().getName()));
- TaskManager.IMP.sync(new RunnableVal