Lets show FAVS some love ❤️

Dieser Commit ist enthalten in:
matt 2019-03-28 21:19:40 -04:00
Ursprung 7ae8d567f3
Commit 20098a78c8
29 geänderte Dateien mit 218 neuen und 326 gelöschten Zeilen

Datei anzeigen

@ -158,12 +158,9 @@ public class Message
} }
else else
{ {
StringBuilder returnValueBuilder = new StringBuilder(); String returnValueBuilder = ChatColor.DARK_GREEN + "Block Types Selected: " + ChatColor.AQUA
returnValueBuilder.append(ChatColor.DARK_GREEN); + snipeData.getVoxelList();
returnValueBuilder.append("Block Types Selected: "); snipeData.sendMessage(returnValueBuilder);
returnValueBuilder.append(ChatColor.AQUA);
returnValueBuilder.append(snipeData.getVoxelList());
snipeData.sendMessage(returnValueBuilder.toString());
} }
} }
} }

Datei anzeigen

@ -40,8 +40,8 @@ public final class PaintingWrapper
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public static void paint(final Player p, final boolean auto, final boolean back, final int choice) public static void paint(final Player p, final boolean auto, final boolean back, final int choice)
{ {
Location targetLocation = p.getTargetBlock((Set<Material>) null, 4).getLocation(); Location targetLocation = p.getTargetBlock(null, 4).getLocation();
Chunk paintingChunk = p.getTargetBlock((Set<Material>) null, 4).getLocation().getChunk(); Chunk paintingChunk = p.getTargetBlock(null, 4).getLocation().getChunk();
Double bestDistanceMatch = 50D; Double bestDistanceMatch = 50D;
Painting bestMatch = null; Painting bestMatch = null;
@ -66,7 +66,7 @@ public final class PaintingWrapper
{ {
try try
{ {
final int i = bestMatch.getArt().getId() + (back ? -1 : 1) + Art.values().length % Art.values().length; final int i = bestMatch.getArt().getId() + (back ? -1 : 1);
Art art = Art.getById(i); Art art = Art.getById(i);
if (art == null) if (art == null)

Datei anzeigen

@ -94,7 +94,7 @@ public class Sniper {
} }
public String getCurrentToolId() { public String getCurrentToolId() {
return getToolId((getPlayer().getItemInHand() != null) ? getPlayer().getItemInHand().getType() : null); return getToolId((getPlayer().getInventory().getItemInMainHand() != null) ? getPlayer().getInventory().getItemInMainHand().getType() : null);
} }
public String getToolId(Material itemInHand) { public String getToolId(Material itemInHand) {
@ -169,17 +169,10 @@ public class Sniper {
try { try {
Player player = getPlayer(); Player player = getPlayer();
final FawePlayer<Player> fp = FawePlayer.wrap(player); final FawePlayer<Player> fp = FawePlayer.wrap(player);
TaskManager.IMP.taskNow(new Runnable() { TaskManager.IMP.taskNow(() -> {
@Override if (!fp.runAction(
public void run() { () -> snipeOnCurrentThread(fp, action, itemInHand, clickedBlock, clickedFace, sniperTool, toolId), false, true)) {
if (!fp.runAction(new Runnable() { BBC.WORLDEDIT_COMMAND_LIMIT.send(fp);
@Override
public void run() {
snipeOnCurrentThread(fp, action, itemInHand, clickedBlock, clickedFace, sniperTool, toolId);
}
}, false, true)) {
BBC.WORLDEDIT_COMMAND_LIMIT.send(fp);
}
} }
}, Fawe.isMainThread()); }, Fawe.isMainThread());
return true; return true;
@ -660,9 +653,7 @@ public class Sniper {
private IBrush instantiateBrush(Class<? extends IBrush> brush) { private IBrush instantiateBrush(Class<? extends IBrush> brush) {
try { try {
return brush.newInstance(); return brush.newInstance();
} catch (InstantiationException e) { } catch (InstantiationException | IllegalAccessException e) {
return null;
} catch (IllegalAccessException e) {
return null; return null;
} }
} }
@ -671,4 +662,4 @@ public class Sniper {
public static Class<?> inject() { public static Class<?> inject() {
return Sniper.class; return Sniper.class;
} }
} }

Datei anzeigen

@ -26,9 +26,10 @@ package com.thevoxelbox.voxelsniper;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
/** /**
* Holds {@link org.bukkit.block.BlockState}s that can be later on used to reset those block * Holds {@link BlockState}s that can be later on used to reset those block
* locations back to the recorded states. * locations back to the recorded states.
*/ */
public class Undo { public class Undo {
@ -67,4 +68,4 @@ public class Undo {
public void undo() { public void undo() {
} }
} }

Datei anzeigen

@ -79,35 +79,32 @@ public class VoxelSniperListener implements Listener
} }
FawePlayer fp = FawePlayer.wrap(player); FawePlayer fp = FawePlayer.wrap(player);
if (!fp.runAction(new Runnable() { if (!fp.runAction(() -> {
@Override ExceptionConverter exceptionConverter = CommandManager.getInstance().getExceptionConverter();
public void run() { try {
ExceptionConverter exceptionConverter = CommandManager.getInstance().getExceptionConverter();
try { try {
try { found.onCommand(player, split);
found.onCommand(player, split); return;
return; } catch (Throwable t) {
} catch (Throwable t) { Throwable next = t;
Throwable next = t; exceptionConverter.convert(next);
while (next.getCause() != null) {
next = next.getCause();
exceptionConverter.convert(next); exceptionConverter.convert(next);
while (next.getCause() != null) {
next = next.getCause();
exceptionConverter.convert(next);
}
throw next;
} }
} catch (CommandException e) { throw next;
String message = e.getMessage();
if (message != null) {
fp.sendMessage(e.getMessage());
return;
}
e.printStackTrace();
} catch (Throwable e) {
e.printStackTrace();
} }
fp.sendMessage("An unknown FAWE error has occurred! Please see console."); } catch (CommandException e) {
String message = e.getMessage();
if (message != null) {
fp.sendMessage(e.getMessage());
return;
}
e.printStackTrace();
} catch (Throwable e) {
e.printStackTrace();
} }
fp.sendMessage("An unknown FAWE error has occurred! Please see console.");
}, false, true)) { }, false, true)) {
BBC.WORLDEDIT_COMMAND_LIMIT.send(fp); BBC.WORLDEDIT_COMMAND_LIMIT.send(fp);
} }

Datei anzeigen

@ -82,17 +82,18 @@ public class BiomeBrush extends Brush
if (args[1].equalsIgnoreCase("info")) if (args[1].equalsIgnoreCase("info"))
{ {
v.sendMessage(ChatColor.GOLD + "Biome Brush Parameters:"); v.sendMessage(ChatColor.GOLD + "Biome Brush Parameters:");
String availableBiomes = ""; StringBuilder availableBiomes = new StringBuilder();
for (final Biome biome : Biome.values()) for (final Biome biome : Biome.values())
{ {
if (availableBiomes.isEmpty()) if (availableBiomes.length() == 0)
{ {
availableBiomes = ChatColor.DARK_GREEN + biome.name(); availableBiomes = new StringBuilder(ChatColor.DARK_GREEN + biome.name());
continue; continue;
} }
availableBiomes += ChatColor.RED + ", " + ChatColor.DARK_GREEN + biome.name(); availableBiomes.append(ChatColor.RED + ", " + ChatColor.DARK_GREEN)
.append(biome.name());
} }
v.sendMessage(ChatColor.DARK_BLUE + "Available biomes: " + availableBiomes); v.sendMessage(ChatColor.DARK_BLUE + "Available biomes: " + availableBiomes);
@ -100,15 +101,15 @@ public class BiomeBrush extends Brush
else else
{ {
// allows biome names with spaces in their name // allows biome names with spaces in their name
String biomeName = args[1]; StringBuilder biomeName = new StringBuilder(args[1]);
for (int i = 2; i < args.length; i++) for (int i = 2; i < args.length; i++)
{ {
biomeName += " " + args[i]; biomeName.append(" ").append(args[i]);
} }
for (final Biome biome : Biome.values()) for (final Biome biome : Biome.values())
{ {
if (biome.name().equalsIgnoreCase(biomeName)) if (biome.name().equalsIgnoreCase(biomeName.toString()))
{ {
this.selectedBiome = biome; this.selectedBiome = biome;
break; break;

Datei anzeigen

@ -49,10 +49,8 @@ public class BlendBallBrush extends BlendBrushBase
{ {
for (int y = 0; y <= brushSizeDoubled; y++) for (int y = 0; y <= brushSizeDoubled; y++)
{ {
for (int z = 0; z <= brushSizeDoubled; z++) System.arraycopy(oldMaterials[x + 1][y + 1], 1, newMaterials[x][y], 0,
{ brushSizeDoubled + 1);
newMaterials[x][y][z] = oldMaterials[x + 1][y + 1][z + 1];
}
} }
} }

Datei anzeigen

@ -42,10 +42,7 @@ public class BlendDiscBrush extends BlendBrushBase
// Log current materials into newmats // Log current materials into newmats
for (int x = 0; x <= brushSizeDoubled; x++) for (int x = 0; x <= brushSizeDoubled; x++)
{ {
for (int z = 0; z <= brushSizeDoubled; z++) System.arraycopy(oldMaterials[x + 1], 1, newMaterials[x], 0, brushSizeDoubled + 1);
{
newMaterials[x][z] = oldMaterials[x + 1][z + 1];
}
} }
// Blend materials // Blend materials

Datei anzeigen

@ -49,10 +49,8 @@ public class BlendVoxelBrush extends BlendBrushBase
{ {
for (int y = 0; y <= brushSizeDoubled; y++) for (int y = 0; y <= brushSizeDoubled; y++)
{ {
for (int z = 0; z <= brushSizeDoubled; z++) System.arraycopy(oldMaterials[x + 1][y + 1], 1, newMaterials[x][y], 0,
{ brushSizeDoubled + 1);
newMaterials[x][y][z] = oldMaterials[x + 1][y + 1][z + 1];
}
} }
} }

Datei anzeigen

@ -42,10 +42,7 @@ public class BlendVoxelDiscBrush extends BlendBrushBase
// Log current materials into newmats // Log current materials into newmats
for (int x = 0; x <= brushSizeDoubled; x++) for (int x = 0; x <= brushSizeDoubled; x++)
{ {
for (int z = 0; z <= brushSizeDoubled; z++) System.arraycopy(oldMaterials[x + 1], 1, newMaterials[x], 0, brushSizeDoubled + 1);
{
newMaterials[x][z] = oldMaterials[x + 1][z + 1];
}
} }
// Blend materials // Blend materials

Datei anzeigen

@ -120,10 +120,7 @@ public class BlobBrush extends PerformBrush
{ {
for (int y = brushSizeDoubled; y >= 0; y--) for (int y = brushSizeDoubled; y >= 0; y--)
{ {
for (int z = brushSizeDoubled; z >= 0; z--) System.arraycopy(tempSplat[x][y], 0, splat[x][y], 0, brushSizeDoubled + 1);
{
splat[x][y][z] = tempSplat[x][y][z];
}
} }
} }
} }
@ -218,10 +215,7 @@ public class BlobBrush extends PerformBrush
{ {
for (int y = brushSizeDoubled; y >= 0; y--) for (int y = brushSizeDoubled; y >= 0; y--)
{ {
for (int z = brushSizeDoubled; z >= 0; z--) System.arraycopy(tempSplat[x][y], 0, splat[x][y], 0, brushSizeDoubled + 1);
{
splat[x][y][z] = tempSplat[x][y][z];
}
} }
} }
} }

Datei anzeigen

@ -83,11 +83,11 @@ public class JockeyBrush extends Brush
{ {
if (jockeyType == JockeyType.INVERSE_PLAYER_ONLY || jockeyType == JockeyType.INVERSE_ALL_ENTITIES) if (jockeyType == JockeyType.INVERSE_PLAYER_ONLY || jockeyType == JockeyType.INVERSE_ALL_ENTITIES)
{ {
player.setPassenger(closest); player.addPassenger(closest);
} }
else else
{ {
closest.setPassenger(player); closest.addPassenger(player);
jockeyedEntity = closest; jockeyedEntity = closest;
} }
v.sendMessage(ChatColor.GREEN + "You are now saddles on entity: " + closest.getEntityId()); v.sendMessage(ChatColor.GREEN + "You are now saddles on entity: " + closest.getEntityId());
@ -113,7 +113,7 @@ public class JockeyBrush extends Brush
{ {
if (jockeyType == JockeyType.STACK_ALL_ENTITIES) if (jockeyType == JockeyType.STACK_ALL_ENTITIES)
{ {
lastEntity.setPassenger(entity); lastEntity.addPassenger(entity);
lastEntity = entity; lastEntity = entity;
stackHeight++; stackHeight++;
} }
@ -121,7 +121,7 @@ public class JockeyBrush extends Brush
{ {
if (entity instanceof Player) if (entity instanceof Player)
{ {
lastEntity.setPassenger(entity); lastEntity.addPassenger(entity);
lastEntity = entity; lastEntity = entity;
stackHeight++; stackHeight++;
} }

Datei anzeigen

@ -1,5 +1,6 @@
package com.thevoxelbox.voxelsniper.brush; package com.thevoxelbox.voxelsniper.brush;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.registry.BlockMaterial; import com.sk89q.worldedit.world.registry.BlockMaterial;
@ -14,8 +15,7 @@ import org.bukkit.Material;
* *
* @author Gavjenks * @author Gavjenks
*/ */
public class OverlayBrush extends PerformBrush public class OverlayBrush extends PerformBrush {
{
private static final int DEFAULT_DEPTH = 3; private static final int DEFAULT_DEPTH = 3;
private int depth = DEFAULT_DEPTH; private int depth = DEFAULT_DEPTH;
private boolean allBlocks = false; private boolean allBlocks = false;
@ -23,40 +23,38 @@ public class OverlayBrush extends PerformBrush
/** /**
* *
*/ */
public OverlayBrush() public OverlayBrush() {
{
this.setName("Overlay (Topsoil Filling)"); this.setName("Overlay (Topsoil Filling)");
} }
private void overlay(final SnipeData v) private void overlay(final SnipeData v) {
{
final int brushSize = v.getBrushSize(); final int brushSize = v.getBrushSize();
final double brushSizeSquared = Math.pow(brushSize + 0.5, 2); final double brushSizeSquared = Math.pow(brushSize + 0.5, 2);
for (int z = brushSize; z >= -brushSize; z--) for (int z = brushSize; z >= -brushSize; z--) {
{ for (int x = brushSize; x >= -brushSize; x--) {
for (int x = brushSize; x >= -brushSize; x--)
{
// check if column is valid // check if column is valid
// column is valid if it has no solid block right above the clicked layer // column is valid if it has no solid block right above the clicked layer
final int materialId = this.getBlockIdAt(this.getTargetBlock().getX() + x, this.getTargetBlock().getY() + 1, this.getTargetBlock().getZ() + z); final int materialId = this.getBlockIdAt(this.getTargetBlock().getX() + x,
if (isIgnoredBlock(materialId)) this.getTargetBlock().getY() + 1, this.getTargetBlock().getZ() + z);
{ if (isIgnoredBlock(materialId)) {
if ((Math.pow(x, 2) + Math.pow(z, 2)) <= brushSizeSquared) if ((Math.pow(x, 2) + Math.pow(z, 2)) <= brushSizeSquared) {
{ for (int y = this.getTargetBlock().getY(); y > 0; y--) {
for (int y = this.getTargetBlock().getY(); y > 0; y--)
{
// check for surface // check for surface
final int layerBlockId = this.getBlockIdAt(this.getTargetBlock().getX() + x, y, this.getTargetBlock().getZ() + z); final int layerBlockId =
if (!isIgnoredBlock(layerBlockId)) this.getBlockIdAt(this.getTargetBlock().getX() + x, y,
{ this.getTargetBlock().getZ() + z);
for (int currentDepth = y; y - currentDepth < depth; currentDepth--) if (!isIgnoredBlock(layerBlockId)) {
{ for (int currentDepth = y;
final int currentBlockId = this.getBlockIdAt(this.getTargetBlock().getX() + x, currentDepth, this.getTargetBlock().getZ() + z); y - currentDepth < depth; currentDepth--) {
if (isOverrideableMaterial(currentBlockId)) final int currentBlockId =
{ this.getBlockIdAt(this.getTargetBlock().getX() + x,
this.current.perform(this.clampY(this.getTargetBlock().getX() + x, currentDepth, this.getTargetBlock().getZ() + z)); currentDepth, this.getTargetBlock().getZ() + z);
if (isOverrideableMaterial(currentBlockId)) {
this.current.perform(
this.clampY(this.getTargetBlock().getX() + x,
currentDepth, this.getTargetBlock().getZ() + z));
} }
} }
break; break;
@ -70,9 +68,7 @@ public class OverlayBrush extends PerformBrush
v.owner().storeUndo(this.current.getUndo()); v.owner().storeUndo(this.current.getUndo());
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation") private boolean isIgnoredBlock(int materialId) {
private boolean isIgnoredBlock(int materialId)
{
BlockType type = BlockTypes.get(materialId); BlockType type = BlockTypes.get(materialId);
switch (type.getResource().toUpperCase()) { switch (type.getResource().toUpperCase()) {
case "WATER": case "WATER":
@ -84,68 +80,65 @@ public class OverlayBrush extends PerformBrush
return mat.isTranslucent(); return mat.isTranslucent();
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation") private boolean isOverrideableMaterial(int materialId) {
private boolean isOverrideableMaterial(int materialId)
{
BlockMaterial mat = BlockTypes.get(materialId).getMaterial(); BlockMaterial mat = BlockTypes.get(materialId).getMaterial();
if (allBlocks && !(mat.isAir())) if (allBlocks && !(mat.isAir())) {
{
return true; return true;
} }
if (!mat.isFragileWhenPushed() && mat.isFullCube()) { return !mat.isFragileWhenPushed() && mat.isFullCube();
return true;
}
return false;
} }
private void overlayTwo(final SnipeData v) private void overlayTwo(final SnipeData v) {
{
final int brushSize = v.getBrushSize(); final int brushSize = v.getBrushSize();
final double brushSizeSquared = Math.pow(brushSize + 0.5, 2); final double brushSizeSquared = Math.pow(brushSize + 0.5, 2);
final int[][] memory = new int[brushSize * 2 + 1][brushSize * 2 + 1]; final int[][] memory = new int[brushSize * 2 + 1][brushSize * 2 + 1];
for (int z = brushSize; z >= -brushSize; z--) for (int z = brushSize; z >= -brushSize; z--) {
{ for (int x = brushSize; x >= -brushSize; x--) {
for (int x = brushSize; x >= -brushSize; x--)
{
boolean surfaceFound = false; boolean surfaceFound = false;
for (int y = this.getTargetBlock().getY(); y > 0 && !surfaceFound; y--) for (int y = this.getTargetBlock().getY();
{ // start scanning from the height you clicked at y > 0 && !surfaceFound; y--) { // start scanning from the height you clicked at
if (memory[x + brushSize][z + brushSize] != 1) if (memory[x + brushSize][z + brushSize]
{ // if haven't already found the surface in this column != 1) { // if haven't already found the surface in this column
if ((Math.pow(x, 2) + Math.pow(z, 2)) <= brushSizeSquared) if ((Math.pow(x, 2) + Math.pow(z, 2))
{ // if inside of the column... <= brushSizeSquared) { // if inside of the column...
if (!this.getBlockAt(this.getTargetBlock().getX() + x, y - 1, this.getTargetBlock().getZ() + z).isEmpty()) if (!this.getBlockAt(this.getTargetBlock().getX() + x, y - 1,
{ // if not a floating block (like one of Notch'world pools) this.getTargetBlock().getZ() + z)
if (this.getBlockAt(this.getTargetBlock().getX() + x, y + 1, this.getTargetBlock().getZ() + z).isEmpty()) .isEmpty()) { // if not a floating block (like one of Notch'world pools)
{ // must start at surface... this prevents it filling stuff in if if (this.getBlockAt(this.getTargetBlock().getX() + x, y + 1,
this.getTargetBlock().getZ() + z)
.isEmpty()) { // must start at surface... this prevents it filling stuff in if
// you click in a wall and it starts out below surface. // you click in a wall and it starts out below surface.
if (!this.allBlocks) if (!this.allBlocks) { // if the override parameter has not been activated, go to the switch that filters out manmade stuff.
{ // if the override parameter has not been activated, go to the switch that filters out manmade stuff.
BlockType type = BlockTypes.get(this.getBlockIdAt(this.getTargetBlock().getX() + x, y, this.getTargetBlock().getZ() + z)); BlockType type = BukkitAdapter.asBlockType((this
.getBlockType(this.getTargetBlock().getX() + x, y,
this.getTargetBlock().getZ() + z)));
BlockMaterial mat = type.getMaterial(); BlockMaterial mat = type.getMaterial();
if (mat.isSolid() && mat.isFullCube() && !mat.hasContainer()) { if (mat.isSolid() && mat.isFullCube() && !mat
.hasContainer()) {
for (int d = 1; (d < this.depth + 1); d++) { 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 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 // in parameters
memory[x + brushSize][z + brushSize] = 1; // stop it from checking any other blocks in this vertical 1x1 column. memory[x + brushSize][z + brushSize] =
1; // stop it from checking any other blocks in this vertical 1x1 column.
} }
surfaceFound = true; surfaceFound = true;
continue;
} else {
continue;
} }
} } else {
else for (int d = 1; (d < this.depth + 1); d++) {
{ this.current.perform(
for (int d = 1; (d < this.depth + 1); d++) this.clampY(this.getTargetBlock().getX() + x, y + d,
{ this.getTargetBlock().getZ()
this.current.perform(this.clampY(this.getTargetBlock().getX() + x, y + d, this.getTargetBlock().getZ() + z)); // fills down as many layers as you specify in + z)); // fills down as many layers as you specify in
// parameters // parameters
memory[x + brushSize][z + brushSize] = 1; // stop it from checking any other blocks in this vertical 1x1 column. memory[x + brushSize][z + brushSize] =
1; // stop it from checking any other blocks in this vertical 1x1 column.
} }
surfaceFound = true; surfaceFound = true;
} }
@ -161,74 +154,58 @@ public class OverlayBrush extends PerformBrush
v.owner().storeUndo(this.current.getUndo()); v.owner().storeUndo(this.current.getUndo());
} }
@Override @Override protected final void arrow(final SnipeData v) {
protected final void arrow(final SnipeData v)
{
this.overlay(v); this.overlay(v);
} }
@Override @Override protected final void powder(final SnipeData v) {
protected final void powder(final SnipeData v)
{
this.overlayTwo(v); this.overlayTwo(v);
} }
@Override @Override public final void info(final Message vm) {
public final void info(final Message vm)
{
vm.brushName(this.getName()); vm.brushName(this.getName());
vm.size(); vm.size();
} }
@Override @Override public final void parameters(final String[] par, final SnipeData v) {
public final void parameters(final String[] par, final SnipeData v) for (int i = 1; i < par.length; i++) {
{
for (int i = 1; i < par.length; i++)
{
final String parameter = par[i]; final String parameter = par[i];
if (parameter.equalsIgnoreCase("info")) if (parameter.equalsIgnoreCase("info")) {
{
v.sendMessage(ChatColor.GOLD + "Overlay brush parameters:"); v.sendMessage(ChatColor.GOLD + "Overlay brush parameters:");
v.sendMessage(ChatColor.AQUA + "d[number] (ex: d3) How many blocks deep you want to replace from the surface."); v.sendMessage(ChatColor.AQUA
v.sendMessage(ChatColor.BLUE + "all (ex: /b over all) Sets the brush to overlay over ALL materials, not just natural surface ones (will no longer ignore trees and buildings). The parameter /some will set it back to default."); + "d[number] (ex: d3) How many blocks deep you want to replace from the surface.");
v.sendMessage(ChatColor.BLUE
+ "all (ex: /b over all) Sets the brush to overlay over ALL materials, not just natural surface ones (will no longer ignore trees and buildings). The parameter /some will set it back to default.");
return; return;
} }
if (parameter.startsWith("d")) if (parameter.startsWith("d")) {
{
try { try {
this.depth = Integer.parseInt(parameter.replace("d", "")); this.depth = Integer.parseInt(parameter.replace("d", ""));
if (this.depth < 1) if (this.depth < 1) {
{
this.depth = 1; this.depth = 1;
} }
v.sendMessage(ChatColor.AQUA + "Depth set to " + this.depth); v.sendMessage(ChatColor.AQUA + "Depth set to " + this.depth);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
v.sendMessage(ChatColor.RED + "Depth isn't a number."); v.sendMessage(ChatColor.RED + "Depth isn't a number.");
} }
} } else if (parameter.startsWith("all")) {
else if (parameter.startsWith("all"))
{
this.allBlocks = true; this.allBlocks = true;
v.sendMessage(ChatColor.BLUE + "Will overlay over any block." + this.depth); v.sendMessage(ChatColor.BLUE + "Will overlay over any block." + this.depth);
} } else if (parameter.startsWith("some")) {
else if (parameter.startsWith("some"))
{
this.allBlocks = false; this.allBlocks = false;
v.sendMessage(ChatColor.BLUE + "Will overlay only natural block types." + this.depth); v.sendMessage(
} ChatColor.BLUE + "Will overlay only natural block types." + this.depth);
else } else {
{ v.sendMessage(ChatColor.RED
v.sendMessage(ChatColor.RED + "Invalid brush parameters! use the info parameter to display parameter info."); + "Invalid brush parameters! use the info parameter to display parameter info.");
} }
} }
} }
@Override @Override public String getPermissionNode() {
public String getPermissionNode()
{
return "voxelsniper.brush.overlay"; return "voxelsniper.brush.overlay";
} }
} }

Datei anzeigen

@ -163,16 +163,11 @@ public class Rot2DBrush extends Brush
{ {
this.bSize = v.getBrushSize(); this.bSize = v.getBrushSize();
switch (this.mode) if (this.mode == 0) {
{ this.getMatrix();
case 0: this.rotate(v);
this.getMatrix(); } else {
this.rotate(v); v.sendMessage(ChatColor.RED + "Something went wrong.");
break;
default:
v.sendMessage(ChatColor.RED + "Something went wrong.");
break;
} }
} }
@ -181,16 +176,11 @@ public class Rot2DBrush extends Brush
{ {
this.bSize = v.getBrushSize(); this.bSize = v.getBrushSize();
switch (this.mode) if (this.mode == 0) {
{ this.getMatrix();
case 0: this.rotate(v);
this.getMatrix(); } else {
this.rotate(v); v.sendMessage(ChatColor.RED + "Something went wrong.");
break;
default:
v.sendMessage(ChatColor.RED + "Something went wrong.");
break;
} }
} }

Datei anzeigen

@ -164,16 +164,11 @@ public class Rot2DvertBrush extends Brush
{ {
this.bSize = v.getBrushSize(); this.bSize = v.getBrushSize();
switch (this.mode) if (this.mode == 0) {
{ this.getMatrix();
case 0: this.rotate(v);
this.getMatrix(); } else {
this.rotate(v); v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong.");
break;
default:
v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong.");
break;
} }
} }
@ -182,16 +177,11 @@ public class Rot2DvertBrush extends Brush
{ {
this.bSize = v.getBrushSize(); this.bSize = v.getBrushSize();
switch (this.mode) if (this.mode == 0) {
{ this.getMatrix();
case 0: this.rotate(v);
this.getMatrix(); } else {
this.rotate(v); v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong.");
break;
default:
v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong.");
break;
} }
} }

Datei anzeigen

@ -248,16 +248,11 @@ public class Rot3DBrush extends Brush
{ {
this.bSize = v.getBrushSize(); this.bSize = v.getBrushSize();
switch (this.mode) if (this.mode == 0) {
{ this.getMatrix();
case 0: this.rotate(v);
this.getMatrix(); } else {
this.rotate(v); v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong.");
break;
default:
v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong.");
break;
} }
} }
@ -266,16 +261,11 @@ public class Rot3DBrush extends Brush
{ {
this.bSize = v.getBrushSize(); this.bSize = v.getBrushSize();
switch (this.mode) if (this.mode == 0) {
{ this.getMatrix();
case 0: this.rotate(v);
this.getMatrix(); } else {
this.rotate(v); v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong.");
break;
default:
v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong.");
break;
} }
} }

Datei anzeigen

@ -50,10 +50,8 @@ public class ShellBallBrush extends Brush
{ {
for (int y = 0; y <= brushSizeDoubled; y++) for (int y = 0; y <= brushSizeDoubled; y++)
{ {
for (int z = 0; z <= brushSizeDoubled; z++) System.arraycopy(oldMaterials[x + 1][y + 1], 1, newMaterials[x][y], 0,
{ brushSizeDoubled + 1);
newMaterials[x][y][z] = oldMaterials[x + 1][y + 1][z + 1];
}
} }
} }

Datei anzeigen

@ -49,10 +49,8 @@ public class ShellVoxelBrush extends Brush
{ {
for (int y = 0; y <= brushSizeSquared; y++) for (int y = 0; y <= brushSizeSquared; y++)
{ {
for (int z = 0; z <= brushSizeSquared; z++) System.arraycopy(oldMaterials[x + 1][y + 1], 1, newMaterials[x][y], 0,
{ brushSizeSquared + 1);
newMaterials[x][y][z] = oldMaterials[x + 1][y + 1][z + 1];
}
} }
} }
int temp; int temp;

Datei anzeigen

@ -152,22 +152,17 @@ public class SnowConeBrush extends Brush
@Override @Override
protected final void powder(final SnipeData v) protected final void powder(final SnipeData v)
{ {
switch (getTargetBlock().getType()) if (getTargetBlock().getType() == Material.SNOW) {
{ this.addSnow(v, this.getTargetBlock());
case SNOW: } else {
this.addSnow(v, this.getTargetBlock()); Block blockAbove = getTargetBlock().getRelative(BlockFace.UP);
break; if (blockAbove != null && BukkitAdapter.adapt(blockAbove.getType()).getMaterial()
default: .isAir()) {
Block blockAbove = getTargetBlock().getRelative(BlockFace.UP); addSnow(v, blockAbove);
if (blockAbove != null && BukkitAdapter.adapt(blockAbove.getType()).getMaterial().isAir()) } else {
{ v.owner().getPlayer()
addSnow(v, blockAbove); .sendMessage(ChatColor.RED + "Error: Center block neither snow nor air.");
} }
else
{
v.owner().getPlayer().sendMessage(ChatColor.RED + "Error: Center block neither snow nor air.");
}
break;
} }
} }

Datei anzeigen

@ -730,9 +730,7 @@ public class SpiralStaircaseBrush extends Brush
v.sendMessage(ChatColor.BLUE + "Staircase type: " + this.stairtype); v.sendMessage(ChatColor.BLUE + "Staircase type: " + this.stairtype);
return; return;
} catch (InputParseException ignore) {} } catch (InputParseException ignore) {}
switch (par[i].toLowerCase()) { if ("block".equals(par[i].toLowerCase())) {
case "block":
} }
if (par[i].equalsIgnoreCase("block") || par[i].equalsIgnoreCase("step") || par[i].equalsIgnoreCase("woodstair") || par[i].equalsIgnoreCase("cobblestair")) if (par[i].equalsIgnoreCase("block") || par[i].equalsIgnoreCase("step") || par[i].equalsIgnoreCase("woodstair") || par[i].equalsIgnoreCase("cobblestair"))
{ {

Datei anzeigen

@ -130,10 +130,9 @@ public class SplatterBallBrush extends PerformBrush
{ {
for (int y = 2 * v.getBrushSize(); y >= 0; y--) for (int y = 2 * v.getBrushSize(); y >= 0; y--)
{ {
for (int z = 2 * v.getBrushSize(); z >= 0; z--) if (2 * v.getBrushSize() + 1 >= 0)
{ System.arraycopy(tempSplat[x][y], 0, splat[x][y], 0,
splat[x][y][z] = tempSplat[x][y][z]; 2 * v.getBrushSize() + 1);
}
} }
} }
} }

Datei anzeigen

@ -115,10 +115,8 @@ public class SplatterDiscBrush extends PerformBrush
// integrate tempsplat back into splat at end of iteration // integrate tempsplat back into splat at end of iteration
for (int x = 2 * v.getBrushSize(); x >= 0; x--) for (int x = 2 * v.getBrushSize(); x >= 0; x--)
{ {
for (int y = 2 * v.getBrushSize(); y >= 0; y--) if (2 * v.getBrushSize() + 1 >= 0)
{ System.arraycopy(tempSplat[x], 0, splat[x], 0, 2 * v.getBrushSize() + 1);
splat[x][y] = tempSplat[x][y];
}
} }
} }
this.growPercent = gref; this.growPercent = gref;

Datei anzeigen

@ -104,10 +104,8 @@ public class SplatterOverlayBrush extends PerformBrush
// integrate tempsplat back into splat at end of iteration // integrate tempsplat back into splat at end of iteration
for (int x = 2 * v.getBrushSize(); x >= 0; x--) for (int x = 2 * v.getBrushSize(); x >= 0; x--)
{ {
for (int y = 2 * v.getBrushSize(); y >= 0; y--) if (2 * v.getBrushSize() + 1 >= 0)
{ System.arraycopy(tempSplat[x], 0, splat[x], 0, 2 * v.getBrushSize() + 1);
splat[x][y] = tempSplat[x][y];
}
} }
} }
this.growPercent = gref; this.growPercent = gref;
@ -240,10 +238,8 @@ public class SplatterOverlayBrush extends PerformBrush
// integrate tempsplat back into splat at end of iteration // integrate tempsplat back into splat at end of iteration
for (int x = 2 * v.getBrushSize(); x >= 0; x--) for (int x = 2 * v.getBrushSize(); x >= 0; x--)
{ {
for (int y = 2 * v.getBrushSize(); y >= 0; y--) if (2 * v.getBrushSize() + 1 >= 0)
{ System.arraycopy(tempsplat[x], 0, splat[x], 0, 2 * v.getBrushSize() + 1);
splat[x][y] = tempsplat[x][y];
}
} }
} }
this.growPercent = gref; this.growPercent = gref;

Datei anzeigen

@ -130,10 +130,9 @@ public class SplatterVoxelBrush extends PerformBrush
{ {
for (int y = 2 * v.getBrushSize(); y >= 0; y--) for (int y = 2 * v.getBrushSize(); y >= 0; y--)
{ {
for (int z = 2 * v.getBrushSize(); z >= 0; z--) if (2 * v.getBrushSize() + 1 >= 0)
{ System.arraycopy(tempSplat[x][y], 0, splat[x][y], 0,
splat[x][y][z] = tempSplat[x][y][z]; 2 * v.getBrushSize() + 1);
}
} }
} }
} }

Datei anzeigen

@ -111,10 +111,8 @@ public class SplatterVoxelDiscBrush extends PerformBrush
// integrate tempsplat back into splat at end of iteration // integrate tempsplat back into splat at end of iteration
for (int x = 2 * v.getBrushSize(); x >= 0; x--) for (int x = 2 * v.getBrushSize(); x >= 0; x--)
{ {
for (int y = 2 * v.getBrushSize(); y >= 0; y--) if (2 * v.getBrushSize() + 1 >= 0)
{ System.arraycopy(tempSplat[x], 0, splat[x], 0, 2 * v.getBrushSize() + 1);
splat[x][y] = tempSplat[x][y];
}
} }
} }
this.growPercent = gref; this.growPercent = gref;

Datei anzeigen

@ -104,7 +104,7 @@ public class WallSider extends Brush{
if (this.c > 4 || this.c < 0) { if (this.c > 4 || this.c < 0) {
this.c = 4; this.c = 4;
} }
snipeData.sendMessage(ChatColor.AQUA + "Orientation set to " + this.facings[this.c]); snipeData.sendMessage(ChatColor.AQUA + "Orientation set to " + facings[this.c]);
} }
else if (lowerCase.startsWith("true")) { else if (lowerCase.startsWith("true")) {
this.e = 0.5; this.e = 0.5;

Datei anzeigen

@ -12,7 +12,7 @@ import com.thevoxelbox.voxelsniper.Message;
public interface Performer public interface Performer
{ {
public void parse(String[] args, com.thevoxelbox.voxelsniper.SnipeData v); void parse(String[] args, com.thevoxelbox.voxelsniper.SnipeData v);
public void showInfo(Message vm); void showInfo(Message vm);
} }

Datei anzeigen

@ -99,7 +99,7 @@ public enum PerformerE
public static String performer_list_short = ""; public static String performer_list_short = "";
public static String performer_list_long = ""; public static String performer_list_long = "";
private PerformerE(Class<? extends vPerformer> c, String s, String l) PerformerE(Class<? extends vPerformer> c, String s, String l)
{ {
pclass = c; pclass = c;
short_name = s; short_name = s;
@ -116,28 +116,12 @@ public enum PerformerE
p = pclass.getConstructor().newInstance(); p = pclass.getConstructor().newInstance();
return p; return p;
} }
catch (InstantiationException ex) catch (InstantiationException | IllegalAccessException | InvocationTargetException | IllegalArgumentException ex)
{
Logger.getLogger(PerformerE.class.getName()).log(Level.SEVERE, null, ex);
}
catch (IllegalAccessException ex)
{
Logger.getLogger(PerformerE.class.getName()).log(Level.SEVERE, null, ex);
}
catch (IllegalArgumentException ex)
{
Logger.getLogger(PerformerE.class.getName()).log(Level.SEVERE, null, ex);
}
catch (InvocationTargetException ex)
{ {
Logger.getLogger(PerformerE.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(PerformerE.class.getName()).log(Level.SEVERE, null, ex);
} }
} }
catch (NoSuchMethodException ex) catch (NoSuchMethodException | SecurityException ex)
{
Logger.getLogger(PerformerE.class.getName()).log(Level.SEVERE, null, ex);
}
catch (SecurityException ex)
{ {
Logger.getLogger(PerformerE.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(PerformerE.class.getName()).log(Level.SEVERE, null, ex);
} }

Datei anzeigen

@ -1,6 +1,7 @@
package com.thevoxelbox.voxelsniper.util; package com.thevoxelbox.voxelsniper.util;
import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.boydti.fawe.bukkit.wrapper.AsyncBlock;
import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
/** /**
@ -10,6 +11,7 @@ public class BlockWrapper
{ {
private int id; private int id;
private Material type;
private int x; private int x;
private int y; private int y;
private int z; private int z;
@ -38,6 +40,10 @@ public class BlockWrapper
return this.data; return this.data;
} }
public Material getType() {
return type;
}
/** /**
* @return the id * @return the id
*/ */
@ -131,4 +137,9 @@ public class BlockWrapper
{ {
this.z = z; this.z = z;
} }
public void setType(Material type) {
this.type = type;
}
} }