Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-24 18:10:08 +01:00
Lets show FAVS some love ❤️
Dieser Commit ist enthalten in:
Ursprung
7ae8d567f3
Commit
20098a78c8
@ -158,12 +158,9 @@ public class Message
|
||||
}
|
||||
else
|
||||
{
|
||||
StringBuilder returnValueBuilder = new StringBuilder();
|
||||
returnValueBuilder.append(ChatColor.DARK_GREEN);
|
||||
returnValueBuilder.append("Block Types Selected: ");
|
||||
returnValueBuilder.append(ChatColor.AQUA);
|
||||
returnValueBuilder.append(snipeData.getVoxelList());
|
||||
snipeData.sendMessage(returnValueBuilder.toString());
|
||||
String returnValueBuilder = ChatColor.DARK_GREEN + "Block Types Selected: " + ChatColor.AQUA
|
||||
+ snipeData.getVoxelList();
|
||||
snipeData.sendMessage(returnValueBuilder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,8 +40,8 @@ public final class PaintingWrapper
|
||||
@SuppressWarnings("deprecation")
|
||||
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();
|
||||
Chunk paintingChunk = p.getTargetBlock((Set<Material>) null, 4).getLocation().getChunk();
|
||||
Location targetLocation = p.getTargetBlock(null, 4).getLocation();
|
||||
Chunk paintingChunk = p.getTargetBlock(null, 4).getLocation().getChunk();
|
||||
|
||||
Double bestDistanceMatch = 50D;
|
||||
Painting bestMatch = null;
|
||||
@ -66,7 +66,7 @@ public final class PaintingWrapper
|
||||
{
|
||||
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);
|
||||
|
||||
if (art == null)
|
||||
|
@ -94,7 +94,7 @@ public class Sniper {
|
||||
}
|
||||
|
||||
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) {
|
||||
@ -169,17 +169,10 @@ public class Sniper {
|
||||
try {
|
||||
Player player = getPlayer();
|
||||
final FawePlayer<Player> fp = FawePlayer.wrap(player);
|
||||
TaskManager.IMP.taskNow(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!fp.runAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
snipeOnCurrentThread(fp, action, itemInHand, clickedBlock, clickedFace, sniperTool, toolId);
|
||||
}
|
||||
}, false, true)) {
|
||||
BBC.WORLDEDIT_COMMAND_LIMIT.send(fp);
|
||||
}
|
||||
TaskManager.IMP.taskNow(() -> {
|
||||
if (!fp.runAction(
|
||||
() -> snipeOnCurrentThread(fp, action, itemInHand, clickedBlock, clickedFace, sniperTool, toolId), false, true)) {
|
||||
BBC.WORLDEDIT_COMMAND_LIMIT.send(fp);
|
||||
}
|
||||
}, Fawe.isMainThread());
|
||||
return true;
|
||||
@ -660,9 +653,7 @@ public class Sniper {
|
||||
private IBrush instantiateBrush(Class<? extends IBrush> brush) {
|
||||
try {
|
||||
return brush.newInstance();
|
||||
} catch (InstantiationException e) {
|
||||
return null;
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -26,9 +26,10 @@ package com.thevoxelbox.voxelsniper;
|
||||
|
||||
import org.bukkit.World;
|
||||
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.
|
||||
*/
|
||||
public class Undo {
|
||||
|
@ -79,35 +79,32 @@ public class VoxelSniperListener implements Listener
|
||||
}
|
||||
|
||||
FawePlayer fp = FawePlayer.wrap(player);
|
||||
if (!fp.runAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ExceptionConverter exceptionConverter = CommandManager.getInstance().getExceptionConverter();
|
||||
if (!fp.runAction(() -> {
|
||||
ExceptionConverter exceptionConverter = CommandManager.getInstance().getExceptionConverter();
|
||||
try {
|
||||
try {
|
||||
try {
|
||||
found.onCommand(player, split);
|
||||
return;
|
||||
} catch (Throwable t) {
|
||||
Throwable next = t;
|
||||
found.onCommand(player, split);
|
||||
return;
|
||||
} catch (Throwable t) {
|
||||
Throwable next = t;
|
||||
exceptionConverter.convert(next);
|
||||
while (next.getCause() != null) {
|
||||
next = next.getCause();
|
||||
exceptionConverter.convert(next);
|
||||
while (next.getCause() != null) {
|
||||
next = next.getCause();
|
||||
exceptionConverter.convert(next);
|
||||
}
|
||||
throw next;
|
||||
}
|
||||
} catch (CommandException e) {
|
||||
String message = e.getMessage();
|
||||
if (message != null) {
|
||||
fp.sendMessage(e.getMessage());
|
||||
return;
|
||||
}
|
||||
e.printStackTrace();
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
throw next;
|
||||
}
|
||||
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)) {
|
||||
BBC.WORLDEDIT_COMMAND_LIMIT.send(fp);
|
||||
}
|
||||
|
@ -82,17 +82,18 @@ public class BiomeBrush extends Brush
|
||||
if (args[1].equalsIgnoreCase("info"))
|
||||
{
|
||||
v.sendMessage(ChatColor.GOLD + "Biome Brush Parameters:");
|
||||
String availableBiomes = "";
|
||||
StringBuilder availableBiomes = new StringBuilder();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
@ -100,15 +101,15 @@ public class BiomeBrush extends Brush
|
||||
else
|
||||
{
|
||||
// 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++)
|
||||
{
|
||||
biomeName += " " + args[i];
|
||||
biomeName.append(" ").append(args[i]);
|
||||
}
|
||||
|
||||
for (final Biome biome : Biome.values())
|
||||
{
|
||||
if (biome.name().equalsIgnoreCase(biomeName))
|
||||
if (biome.name().equalsIgnoreCase(biomeName.toString()))
|
||||
{
|
||||
this.selectedBiome = biome;
|
||||
break;
|
||||
|
@ -49,10 +49,8 @@ public class BlendBallBrush extends BlendBrushBase
|
||||
{
|
||||
for (int y = 0; y <= brushSizeDoubled; y++)
|
||||
{
|
||||
for (int z = 0; z <= brushSizeDoubled; z++)
|
||||
{
|
||||
newMaterials[x][y][z] = oldMaterials[x + 1][y + 1][z + 1];
|
||||
}
|
||||
System.arraycopy(oldMaterials[x + 1][y + 1], 1, newMaterials[x][y], 0,
|
||||
brushSizeDoubled + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,10 +42,7 @@ public class BlendDiscBrush extends BlendBrushBase
|
||||
// Log current materials into newmats
|
||||
for (int x = 0; x <= brushSizeDoubled; x++)
|
||||
{
|
||||
for (int z = 0; z <= brushSizeDoubled; z++)
|
||||
{
|
||||
newMaterials[x][z] = oldMaterials[x + 1][z + 1];
|
||||
}
|
||||
System.arraycopy(oldMaterials[x + 1], 1, newMaterials[x], 0, brushSizeDoubled + 1);
|
||||
}
|
||||
|
||||
// Blend materials
|
||||
|
@ -49,10 +49,8 @@ public class BlendVoxelBrush extends BlendBrushBase
|
||||
{
|
||||
for (int y = 0; y <= brushSizeDoubled; y++)
|
||||
{
|
||||
for (int z = 0; z <= brushSizeDoubled; z++)
|
||||
{
|
||||
newMaterials[x][y][z] = oldMaterials[x + 1][y + 1][z + 1];
|
||||
}
|
||||
System.arraycopy(oldMaterials[x + 1][y + 1], 1, newMaterials[x][y], 0,
|
||||
brushSizeDoubled + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,10 +42,7 @@ public class BlendVoxelDiscBrush extends BlendBrushBase
|
||||
// Log current materials into newmats
|
||||
for (int x = 0; x <= brushSizeDoubled; x++)
|
||||
{
|
||||
for (int z = 0; z <= brushSizeDoubled; z++)
|
||||
{
|
||||
newMaterials[x][z] = oldMaterials[x + 1][z + 1];
|
||||
}
|
||||
System.arraycopy(oldMaterials[x + 1], 1, newMaterials[x], 0, brushSizeDoubled + 1);
|
||||
}
|
||||
|
||||
// Blend materials
|
||||
|
@ -120,10 +120,7 @@ public class BlobBrush extends PerformBrush
|
||||
{
|
||||
for (int y = brushSizeDoubled; y >= 0; y--)
|
||||
{
|
||||
for (int z = brushSizeDoubled; z >= 0; z--)
|
||||
{
|
||||
splat[x][y][z] = tempSplat[x][y][z];
|
||||
}
|
||||
System.arraycopy(tempSplat[x][y], 0, splat[x][y], 0, brushSizeDoubled + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -218,10 +215,7 @@ public class BlobBrush extends PerformBrush
|
||||
{
|
||||
for (int y = brushSizeDoubled; y >= 0; y--)
|
||||
{
|
||||
for (int z = brushSizeDoubled; z >= 0; z--)
|
||||
{
|
||||
splat[x][y][z] = tempSplat[x][y][z];
|
||||
}
|
||||
System.arraycopy(tempSplat[x][y], 0, splat[x][y], 0, brushSizeDoubled + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -83,11 +83,11 @@ public class JockeyBrush extends Brush
|
||||
{
|
||||
if (jockeyType == JockeyType.INVERSE_PLAYER_ONLY || jockeyType == JockeyType.INVERSE_ALL_ENTITIES)
|
||||
{
|
||||
player.setPassenger(closest);
|
||||
player.addPassenger(closest);
|
||||
}
|
||||
else
|
||||
{
|
||||
closest.setPassenger(player);
|
||||
closest.addPassenger(player);
|
||||
jockeyedEntity = closest;
|
||||
}
|
||||
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)
|
||||
{
|
||||
lastEntity.setPassenger(entity);
|
||||
lastEntity.addPassenger(entity);
|
||||
lastEntity = entity;
|
||||
stackHeight++;
|
||||
}
|
||||
@ -121,7 +121,7 @@ public class JockeyBrush extends Brush
|
||||
{
|
||||
if (entity instanceof Player)
|
||||
{
|
||||
lastEntity.setPassenger(entity);
|
||||
lastEntity.addPassenger(entity);
|
||||
lastEntity = entity;
|
||||
stackHeight++;
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.thevoxelbox.voxelsniper.brush;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
||||
@ -14,8 +15,7 @@ import org.bukkit.Material;
|
||||
*
|
||||
* @author Gavjenks
|
||||
*/
|
||||
public class OverlayBrush extends PerformBrush
|
||||
{
|
||||
public class OverlayBrush extends PerformBrush {
|
||||
private static final int DEFAULT_DEPTH = 3;
|
||||
private int depth = DEFAULT_DEPTH;
|
||||
private boolean allBlocks = false;
|
||||
@ -23,40 +23,38 @@ public class OverlayBrush extends PerformBrush
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public OverlayBrush()
|
||||
{
|
||||
public OverlayBrush() {
|
||||
this.setName("Overlay (Topsoil Filling)");
|
||||
}
|
||||
|
||||
private void overlay(final SnipeData v)
|
||||
{
|
||||
private void overlay(final SnipeData v) {
|
||||
final int brushSize = v.getBrushSize();
|
||||
final double brushSizeSquared = Math.pow(brushSize + 0.5, 2);
|
||||
|
||||
|
||||
for (int z = brushSize; z >= -brushSize; z--)
|
||||
{
|
||||
for (int x = brushSize; x >= -brushSize; x--)
|
||||
{
|
||||
for (int z = brushSize; z >= -brushSize; z--) {
|
||||
for (int x = brushSize; x >= -brushSize; x--) {
|
||||
// check if column is valid
|
||||
// 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);
|
||||
if (isIgnoredBlock(materialId))
|
||||
{
|
||||
if ((Math.pow(x, 2) + Math.pow(z, 2)) <= brushSizeSquared)
|
||||
{
|
||||
for (int y = this.getTargetBlock().getY(); y > 0; y--)
|
||||
{
|
||||
final int materialId = this.getBlockIdAt(this.getTargetBlock().getX() + x,
|
||||
this.getTargetBlock().getY() + 1, this.getTargetBlock().getZ() + z);
|
||||
if (isIgnoredBlock(materialId)) {
|
||||
if ((Math.pow(x, 2) + Math.pow(z, 2)) <= brushSizeSquared) {
|
||||
for (int y = this.getTargetBlock().getY(); y > 0; y--) {
|
||||
// check for surface
|
||||
final int layerBlockId = this.getBlockIdAt(this.getTargetBlock().getX() + x, y, this.getTargetBlock().getZ() + z);
|
||||
if (!isIgnoredBlock(layerBlockId))
|
||||
{
|
||||
for (int currentDepth = y; y - currentDepth < depth; currentDepth--)
|
||||
{
|
||||
final int currentBlockId = this.getBlockIdAt(this.getTargetBlock().getX() + x, currentDepth, this.getTargetBlock().getZ() + z);
|
||||
if (isOverrideableMaterial(currentBlockId))
|
||||
{
|
||||
this.current.perform(this.clampY(this.getTargetBlock().getX() + x, currentDepth, this.getTargetBlock().getZ() + z));
|
||||
final int layerBlockId =
|
||||
this.getBlockIdAt(this.getTargetBlock().getX() + x, y,
|
||||
this.getTargetBlock().getZ() + z);
|
||||
if (!isIgnoredBlock(layerBlockId)) {
|
||||
for (int currentDepth = y;
|
||||
y - currentDepth < depth; currentDepth--) {
|
||||
final int currentBlockId =
|
||||
this.getBlockIdAt(this.getTargetBlock().getX() + x,
|
||||
currentDepth, this.getTargetBlock().getZ() + z);
|
||||
if (isOverrideableMaterial(currentBlockId)) {
|
||||
this.current.perform(
|
||||
this.clampY(this.getTargetBlock().getX() + x,
|
||||
currentDepth, this.getTargetBlock().getZ() + z));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -70,9 +68,7 @@ public class OverlayBrush extends PerformBrush
|
||||
v.owner().storeUndo(this.current.getUndo());
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private boolean isIgnoredBlock(int materialId)
|
||||
{
|
||||
@SuppressWarnings("deprecation") private boolean isIgnoredBlock(int materialId) {
|
||||
BlockType type = BlockTypes.get(materialId);
|
||||
switch (type.getResource().toUpperCase()) {
|
||||
case "WATER":
|
||||
@ -84,68 +80,65 @@ public class OverlayBrush extends PerformBrush
|
||||
return mat.isTranslucent();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private boolean isOverrideableMaterial(int materialId)
|
||||
{
|
||||
@SuppressWarnings("deprecation") private boolean isOverrideableMaterial(int materialId) {
|
||||
BlockMaterial mat = BlockTypes.get(materialId).getMaterial();
|
||||
if (allBlocks && !(mat.isAir()))
|
||||
{
|
||||
if (allBlocks && !(mat.isAir())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!mat.isFragileWhenPushed() && mat.isFullCube()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return !mat.isFragileWhenPushed() && mat.isFullCube();
|
||||
}
|
||||
|
||||
private void overlayTwo(final SnipeData v)
|
||||
{
|
||||
private void overlayTwo(final SnipeData v) {
|
||||
final int brushSize = v.getBrushSize();
|
||||
final double brushSizeSquared = Math.pow(brushSize + 0.5, 2);
|
||||
final int[][] memory = new int[brushSize * 2 + 1][brushSize * 2 + 1];
|
||||
|
||||
for (int z = brushSize; z >= -brushSize; z--)
|
||||
{
|
||||
for (int x = brushSize; x >= -brushSize; x--)
|
||||
{
|
||||
for (int z = brushSize; z >= -brushSize; z--) {
|
||||
for (int x = brushSize; x >= -brushSize; x--) {
|
||||
boolean surfaceFound = false;
|
||||
for (int y = this.getTargetBlock().getY(); y > 0 && !surfaceFound; y--)
|
||||
{ // start scanning from the height you clicked at
|
||||
if (memory[x + brushSize][z + brushSize] != 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.getBlockAt(this.getTargetBlock().getX() + x, y - 1, this.getTargetBlock().getZ() + z).isEmpty())
|
||||
{ // if not a floating block (like one of Notch'world pools)
|
||||
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
|
||||
for (int y = this.getTargetBlock().getY();
|
||||
y > 0 && !surfaceFound; y--) { // start scanning from the height you clicked at
|
||||
if (memory[x + brushSize][z + brushSize]
|
||||
!= 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.getBlockAt(this.getTargetBlock().getX() + x, y - 1,
|
||||
this.getTargetBlock().getZ() + z)
|
||||
.isEmpty()) { // if not a floating block (like one of Notch'world pools)
|
||||
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.
|
||||
if (!this.allBlocks)
|
||||
{ // if the override parameter has not been activated, go to the switch that filters out manmade stuff.
|
||||
if (!this.allBlocks) { // 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();
|
||||
if (mat.isSolid() && mat.isFullCube() && !mat.hasContainer()) {
|
||||
if (mat.isSolid() && mat.isFullCube() && !mat
|
||||
.hasContainer()) {
|
||||
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
|
||||
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;
|
||||
continue;
|
||||
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
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
|
||||
} 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 + 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;
|
||||
}
|
||||
@ -161,74 +154,58 @@ public class OverlayBrush extends PerformBrush
|
||||
v.owner().storeUndo(this.current.getUndo());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void arrow(final SnipeData v)
|
||||
{
|
||||
@Override protected final void arrow(final SnipeData v) {
|
||||
this.overlay(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void powder(final SnipeData v)
|
||||
{
|
||||
@Override protected final void powder(final SnipeData v) {
|
||||
this.overlayTwo(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void info(final Message vm)
|
||||
{
|
||||
@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++)
|
||||
{
|
||||
@Override public final void parameters(final String[] par, final SnipeData v) {
|
||||
for (int i = 1; i < par.length; i++) {
|
||||
final String parameter = par[i];
|
||||
|
||||
if (parameter.equalsIgnoreCase("info"))
|
||||
{
|
||||
if (parameter.equalsIgnoreCase("info")) {
|
||||
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.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.");
|
||||
v.sendMessage(ChatColor.AQUA
|
||||
+ "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;
|
||||
}
|
||||
if (parameter.startsWith("d"))
|
||||
{
|
||||
if (parameter.startsWith("d")) {
|
||||
try {
|
||||
this.depth = Integer.parseInt(parameter.replace("d", ""));
|
||||
|
||||
if (this.depth < 1)
|
||||
{
|
||||
if (this.depth < 1) {
|
||||
this.depth = 1;
|
||||
}
|
||||
|
||||
v.sendMessage(ChatColor.AQUA + "Depth set to " + this.depth);
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (NumberFormatException e) {
|
||||
v.sendMessage(ChatColor.RED + "Depth isn't a number.");
|
||||
}
|
||||
}
|
||||
else if (parameter.startsWith("all"))
|
||||
{
|
||||
} else if (parameter.startsWith("all")) {
|
||||
this.allBlocks = true;
|
||||
v.sendMessage(ChatColor.BLUE + "Will overlay over any block." + this.depth);
|
||||
}
|
||||
else if (parameter.startsWith("some"))
|
||||
{
|
||||
} else if (parameter.startsWith("some")) {
|
||||
this.allBlocks = false;
|
||||
v.sendMessage(ChatColor.BLUE + "Will overlay only natural block types." + this.depth);
|
||||
}
|
||||
else
|
||||
{
|
||||
v.sendMessage(ChatColor.RED + "Invalid brush parameters! use the info parameter to display parameter info.");
|
||||
v.sendMessage(
|
||||
ChatColor.BLUE + "Will overlay only natural block types." + this.depth);
|
||||
} else {
|
||||
v.sendMessage(ChatColor.RED
|
||||
+ "Invalid brush parameters! use the info parameter to display parameter info.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPermissionNode()
|
||||
{
|
||||
@Override public String getPermissionNode() {
|
||||
return "voxelsniper.brush.overlay";
|
||||
}
|
||||
}
|
||||
|
@ -163,16 +163,11 @@ public class Rot2DBrush extends Brush
|
||||
{
|
||||
this.bSize = v.getBrushSize();
|
||||
|
||||
switch (this.mode)
|
||||
{
|
||||
case 0:
|
||||
this.getMatrix();
|
||||
this.rotate(v);
|
||||
break;
|
||||
|
||||
default:
|
||||
v.sendMessage(ChatColor.RED + "Something went wrong.");
|
||||
break;
|
||||
if (this.mode == 0) {
|
||||
this.getMatrix();
|
||||
this.rotate(v);
|
||||
} else {
|
||||
v.sendMessage(ChatColor.RED + "Something went wrong.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,16 +176,11 @@ public class Rot2DBrush extends Brush
|
||||
{
|
||||
this.bSize = v.getBrushSize();
|
||||
|
||||
switch (this.mode)
|
||||
{
|
||||
case 0:
|
||||
this.getMatrix();
|
||||
this.rotate(v);
|
||||
break;
|
||||
|
||||
default:
|
||||
v.sendMessage(ChatColor.RED + "Something went wrong.");
|
||||
break;
|
||||
if (this.mode == 0) {
|
||||
this.getMatrix();
|
||||
this.rotate(v);
|
||||
} else {
|
||||
v.sendMessage(ChatColor.RED + "Something went wrong.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -164,16 +164,11 @@ public class Rot2DvertBrush extends Brush
|
||||
{
|
||||
this.bSize = v.getBrushSize();
|
||||
|
||||
switch (this.mode)
|
||||
{
|
||||
case 0:
|
||||
this.getMatrix();
|
||||
this.rotate(v);
|
||||
break;
|
||||
|
||||
default:
|
||||
v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong.");
|
||||
break;
|
||||
if (this.mode == 0) {
|
||||
this.getMatrix();
|
||||
this.rotate(v);
|
||||
} else {
|
||||
v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -182,16 +177,11 @@ public class Rot2DvertBrush extends Brush
|
||||
{
|
||||
this.bSize = v.getBrushSize();
|
||||
|
||||
switch (this.mode)
|
||||
{
|
||||
case 0:
|
||||
this.getMatrix();
|
||||
this.rotate(v);
|
||||
break;
|
||||
|
||||
default:
|
||||
v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong.");
|
||||
break;
|
||||
if (this.mode == 0) {
|
||||
this.getMatrix();
|
||||
this.rotate(v);
|
||||
} else {
|
||||
v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -248,16 +248,11 @@ public class Rot3DBrush extends Brush
|
||||
{
|
||||
this.bSize = v.getBrushSize();
|
||||
|
||||
switch (this.mode)
|
||||
{
|
||||
case 0:
|
||||
this.getMatrix();
|
||||
this.rotate(v);
|
||||
break;
|
||||
|
||||
default:
|
||||
v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong.");
|
||||
break;
|
||||
if (this.mode == 0) {
|
||||
this.getMatrix();
|
||||
this.rotate(v);
|
||||
} else {
|
||||
v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -266,16 +261,11 @@ public class Rot3DBrush extends Brush
|
||||
{
|
||||
this.bSize = v.getBrushSize();
|
||||
|
||||
switch (this.mode)
|
||||
{
|
||||
case 0:
|
||||
this.getMatrix();
|
||||
this.rotate(v);
|
||||
break;
|
||||
|
||||
default:
|
||||
v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong.");
|
||||
break;
|
||||
if (this.mode == 0) {
|
||||
this.getMatrix();
|
||||
this.rotate(v);
|
||||
} else {
|
||||
v.owner().getPlayer().sendMessage(ChatColor.RED + "Something went wrong.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,10 +50,8 @@ public class ShellBallBrush extends Brush
|
||||
{
|
||||
for (int y = 0; y <= brushSizeDoubled; y++)
|
||||
{
|
||||
for (int z = 0; z <= brushSizeDoubled; z++)
|
||||
{
|
||||
newMaterials[x][y][z] = oldMaterials[x + 1][y + 1][z + 1];
|
||||
}
|
||||
System.arraycopy(oldMaterials[x + 1][y + 1], 1, newMaterials[x][y], 0,
|
||||
brushSizeDoubled + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,10 +49,8 @@ public class ShellVoxelBrush extends Brush
|
||||
{
|
||||
for (int y = 0; y <= brushSizeSquared; y++)
|
||||
{
|
||||
for (int z = 0; z <= brushSizeSquared; z++)
|
||||
{
|
||||
newMaterials[x][y][z] = oldMaterials[x + 1][y + 1][z + 1];
|
||||
}
|
||||
System.arraycopy(oldMaterials[x + 1][y + 1], 1, newMaterials[x][y], 0,
|
||||
brushSizeSquared + 1);
|
||||
}
|
||||
}
|
||||
int temp;
|
||||
|
@ -152,22 +152,17 @@ public class SnowConeBrush extends Brush
|
||||
@Override
|
||||
protected final void powder(final SnipeData v)
|
||||
{
|
||||
switch (getTargetBlock().getType())
|
||||
{
|
||||
case SNOW:
|
||||
this.addSnow(v, this.getTargetBlock());
|
||||
break;
|
||||
default:
|
||||
Block blockAbove = getTargetBlock().getRelative(BlockFace.UP);
|
||||
if (blockAbove != null && BukkitAdapter.adapt(blockAbove.getType()).getMaterial().isAir())
|
||||
{
|
||||
addSnow(v, blockAbove);
|
||||
}
|
||||
else
|
||||
{
|
||||
v.owner().getPlayer().sendMessage(ChatColor.RED + "Error: Center block neither snow nor air.");
|
||||
}
|
||||
break;
|
||||
if (getTargetBlock().getType() == Material.SNOW) {
|
||||
this.addSnow(v, this.getTargetBlock());
|
||||
} else {
|
||||
Block blockAbove = getTargetBlock().getRelative(BlockFace.UP);
|
||||
if (blockAbove != null && BukkitAdapter.adapt(blockAbove.getType()).getMaterial()
|
||||
.isAir()) {
|
||||
addSnow(v, blockAbove);
|
||||
} else {
|
||||
v.owner().getPlayer()
|
||||
.sendMessage(ChatColor.RED + "Error: Center block neither snow nor air.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -730,9 +730,7 @@ public class SpiralStaircaseBrush extends Brush
|
||||
v.sendMessage(ChatColor.BLUE + "Staircase type: " + this.stairtype);
|
||||
return;
|
||||
} catch (InputParseException ignore) {}
|
||||
switch (par[i].toLowerCase()) {
|
||||
case "block":
|
||||
|
||||
if ("block".equals(par[i].toLowerCase())) {
|
||||
}
|
||||
if (par[i].equalsIgnoreCase("block") || par[i].equalsIgnoreCase("step") || par[i].equalsIgnoreCase("woodstair") || par[i].equalsIgnoreCase("cobblestair"))
|
||||
{
|
||||
|
@ -130,10 +130,9 @@ public class SplatterBallBrush extends PerformBrush
|
||||
{
|
||||
for (int y = 2 * v.getBrushSize(); y >= 0; y--)
|
||||
{
|
||||
for (int z = 2 * v.getBrushSize(); z >= 0; z--)
|
||||
{
|
||||
splat[x][y][z] = tempSplat[x][y][z];
|
||||
}
|
||||
if (2 * v.getBrushSize() + 1 >= 0)
|
||||
System.arraycopy(tempSplat[x][y], 0, splat[x][y], 0,
|
||||
2 * v.getBrushSize() + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -115,10 +115,8 @@ public class SplatterDiscBrush extends PerformBrush
|
||||
// integrate tempsplat back into splat at end of iteration
|
||||
for (int x = 2 * v.getBrushSize(); x >= 0; x--)
|
||||
{
|
||||
for (int y = 2 * v.getBrushSize(); y >= 0; y--)
|
||||
{
|
||||
splat[x][y] = tempSplat[x][y];
|
||||
}
|
||||
if (2 * v.getBrushSize() + 1 >= 0)
|
||||
System.arraycopy(tempSplat[x], 0, splat[x], 0, 2 * v.getBrushSize() + 1);
|
||||
}
|
||||
}
|
||||
this.growPercent = gref;
|
||||
|
@ -104,10 +104,8 @@ public class SplatterOverlayBrush extends PerformBrush
|
||||
// integrate tempsplat back into splat at end of iteration
|
||||
for (int x = 2 * v.getBrushSize(); x >= 0; x--)
|
||||
{
|
||||
for (int y = 2 * v.getBrushSize(); y >= 0; y--)
|
||||
{
|
||||
splat[x][y] = tempSplat[x][y];
|
||||
}
|
||||
if (2 * v.getBrushSize() + 1 >= 0)
|
||||
System.arraycopy(tempSplat[x], 0, splat[x], 0, 2 * v.getBrushSize() + 1);
|
||||
}
|
||||
}
|
||||
this.growPercent = gref;
|
||||
@ -240,10 +238,8 @@ public class SplatterOverlayBrush extends PerformBrush
|
||||
// integrate tempsplat back into splat at end of iteration
|
||||
for (int x = 2 * v.getBrushSize(); x >= 0; x--)
|
||||
{
|
||||
for (int y = 2 * v.getBrushSize(); y >= 0; y--)
|
||||
{
|
||||
splat[x][y] = tempsplat[x][y];
|
||||
}
|
||||
if (2 * v.getBrushSize() + 1 >= 0)
|
||||
System.arraycopy(tempsplat[x], 0, splat[x], 0, 2 * v.getBrushSize() + 1);
|
||||
}
|
||||
}
|
||||
this.growPercent = gref;
|
||||
|
@ -130,10 +130,9 @@ public class SplatterVoxelBrush extends PerformBrush
|
||||
{
|
||||
for (int y = 2 * v.getBrushSize(); y >= 0; y--)
|
||||
{
|
||||
for (int z = 2 * v.getBrushSize(); z >= 0; z--)
|
||||
{
|
||||
splat[x][y][z] = tempSplat[x][y][z];
|
||||
}
|
||||
if (2 * v.getBrushSize() + 1 >= 0)
|
||||
System.arraycopy(tempSplat[x][y], 0, splat[x][y], 0,
|
||||
2 * v.getBrushSize() + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -111,10 +111,8 @@ public class SplatterVoxelDiscBrush extends PerformBrush
|
||||
// integrate tempsplat back into splat at end of iteration
|
||||
for (int x = 2 * v.getBrushSize(); x >= 0; x--)
|
||||
{
|
||||
for (int y = 2 * v.getBrushSize(); y >= 0; y--)
|
||||
{
|
||||
splat[x][y] = tempSplat[x][y];
|
||||
}
|
||||
if (2 * v.getBrushSize() + 1 >= 0)
|
||||
System.arraycopy(tempSplat[x], 0, splat[x], 0, 2 * v.getBrushSize() + 1);
|
||||
}
|
||||
}
|
||||
this.growPercent = gref;
|
||||
|
@ -104,7 +104,7 @@ public class WallSider extends Brush{
|
||||
if (this.c > 4 || this.c < 0) {
|
||||
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")) {
|
||||
this.e = 0.5;
|
||||
|
@ -12,7 +12,7 @@ import com.thevoxelbox.voxelsniper.Message;
|
||||
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);
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ public enum PerformerE
|
||||
public static String performer_list_short = "";
|
||||
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;
|
||||
short_name = s;
|
||||
@ -116,28 +116,12 @@ public enum PerformerE
|
||||
p = pclass.getConstructor().newInstance();
|
||||
return p;
|
||||
}
|
||||
catch (InstantiationException 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)
|
||||
catch (InstantiationException | IllegalAccessException | InvocationTargetException | IllegalArgumentException ex)
|
||||
{
|
||||
Logger.getLogger(PerformerE.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
catch (NoSuchMethodException ex)
|
||||
{
|
||||
Logger.getLogger(PerformerE.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
catch (SecurityException ex)
|
||||
catch (NoSuchMethodException | SecurityException ex)
|
||||
{
|
||||
Logger.getLogger(PerformerE.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.thevoxelbox.voxelsniper.util;
|
||||
|
||||
import com.boydti.fawe.bukkit.wrapper.AsyncBlock;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
|
||||
/**
|
||||
@ -10,6 +11,7 @@ public class BlockWrapper
|
||||
{
|
||||
|
||||
private int id;
|
||||
private Material type;
|
||||
private int x;
|
||||
private int y;
|
||||
private int z;
|
||||
@ -38,6 +40,10 @@ public class BlockWrapper
|
||||
return this.data;
|
||||
}
|
||||
|
||||
public Material getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
@ -131,4 +137,9 @@ public class BlockWrapper
|
||||
{
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public void setType(Material type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren