3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-05 02:50:05 +01:00
Dieser Commit ist enthalten in:
NotMyFault 2019-04-19 19:01:17 +02:00
Ursprung c56ba112d1
Commit e27b6fb6c3
3 geänderte Dateien mit 71 neuen und 106 gelöschten Zeilen

Datei anzeigen

@ -7,8 +7,7 @@ import org.bukkit.World;
/**
* @author MikeMatrix
*/
public class BlockWrapper
{
public class BlockWrapper {
private int id;
private Material type;
@ -22,8 +21,7 @@ public class BlockWrapper
* @param block
*/
@SuppressWarnings("deprecation")
public BlockWrapper(final AsyncBlock block)
{
public BlockWrapper(final AsyncBlock block) {
this.setId(block.getTypeId());
this.setX(block.getX());
this.setY(block.getY());
@ -35,111 +33,93 @@ public class BlockWrapper
/**
* @return the data
*/
public final int getPropertyId()
{
public final int getPropertyId() {
return this.data;
}
/**
* @param data the data to set
*/
public final void setPropertyId(final int data) {
this.data = data;
}
public Material getType() {
return type;
}
public void setType(Material type) {
this.type = type;
}
/**
* @return the id
*/
public final int getId()
{
public final int getId() {
return this.id;
}
/**
* @param id the id to set
*/
public final void setId(final int id) {
this.id = id;
}
/**
* @return the world
*/
public final World getWorld()
{
public final World getWorld() {
return this.world;
}
/**
* @param world the world to set
*/
public final void setWorld(final World world) {
this.world = world;
}
/**
* @return the x
*/
public final int getX()
{
public final int getX() {
return this.x;
}
/**
* @param x the x to set
*/
public final void setX(final int x) {
this.x = x;
}
/**
* @return the y
*/
public final int getY()
{
public final int getY() {
return this.y;
}
/**
* @param y the y to set
*/
public final void setY(final int y) {
this.y = y;
}
/**
* @return the z
*/
public final int getZ()
{
public final int getZ() {
return this.z;
}
/**
* @param data
* the data to set
* @param z the z to set
*/
public final void setPropertyId(final int data)
{
this.data = data;
}
/**
* @param id
* the id to set
*/
public final void setId(final int id)
{
this.id = id;
}
/**
* @param world
* the world to set
*/
public final void setWorld(final World world)
{
this.world = world;
}
/**
* @param x
* the x to set
*/
public final void setX(final int x)
{
this.x = x;
}
/**
* @param y
* the y to set
*/
public final void setY(final int y)
{
this.y = y;
}
/**
* @param z
* the z to set
*/
public final void setZ(final int z)
{
public final void setZ(final int z) {
this.z = z;
}
public void setType(Material type) {
this.type = type;
}
}

Datei anzeigen

@ -1,4 +1,3 @@
package com.thevoxelbox.voxelsniper.util;
import com.thevoxelbox.voxelsniper.Undo;
@ -10,26 +9,23 @@ import org.bukkit.block.data.BlockData;
/**
*
*/
public class UndoDelegate implements BlockChangeDelegate
{
public class UndoDelegate implements BlockChangeDelegate {
private final World targetWorld;
private Undo currentUndo;
public Undo getUndo()
{
public UndoDelegate(World targetWorld) {
this.targetWorld = targetWorld;
this.currentUndo = new Undo();
}
public Undo getUndo() {
final Undo pastUndo = currentUndo;
currentUndo = new Undo();
return pastUndo;
}
public UndoDelegate(World targetWorld)
{
this.targetWorld = targetWorld;
this.currentUndo = new Undo();
}
@SuppressWarnings("deprecation")
public boolean setBlock(Block b)
{
public boolean setBlock(Block b) {
this.currentUndo.put(this.targetWorld.getBlockAt(b.getLocation()));
this.targetWorld.getBlockAt(b.getLocation()).setBlockData(b.getBlockData());
return true;
@ -48,14 +44,12 @@ public class UndoDelegate implements BlockChangeDelegate
}
@Override
public int getHeight()
{
public int getHeight() {
return this.targetWorld.getMaxHeight();
}
@Override
public boolean isEmpty(int x, int y, int z)
{
public boolean isEmpty(int x, int y, int z) {
return this.targetWorld.getBlockAt(x, y, z).isEmpty();
}
}

Datei anzeigen

@ -16,39 +16,34 @@ import java.util.List;
/**
* Container class for multiple ID/Datavalue pairs.
*/
public class VoxelList
{
public class VoxelList {
private BlockMask mask = new BlockMask();
/**
* Adds the specified id, data value pair to the VoxelList. A data value of -1 will operate on all data values of that id.
*
*
* @param i
*/
public void add(BlockState i)
{
public void add(BlockState i) {
this.mask = mask.toBuilder().add(i).build(NullExtent.INSTANCE);
}
public void add(BlockMask mask)
{
public void add(BlockMask mask) {
this.mask = (BlockMask) mask.and(mask);
}
/**
* Removes the specified id, data value pair from the VoxelList.
*
*
* @return true if this list contained the specified element
*/
public boolean removeValue(final BlockState state)
{
public boolean removeValue(final BlockState state) {
this.mask = mask.toBuilder().remove(state).build(NullExtent.INSTANCE);
return true;
}
public boolean removeValue(final BlockMask state)
{
public boolean removeValue(final BlockMask state) {
this.mask = (BlockMask) mask.and(state.inverse());
return true;
}
@ -57,16 +52,14 @@ public class VoxelList
* @param i
* @return true if this list contains the specified element
*/
public boolean contains(final BlockData i)
{
public boolean contains(final BlockData i) {
return mask.test(BukkitAdapter.adapt(i));
}
/**
* Clears the VoxelList.
*/
public void clear()
{
public void clear() {
mask = mask.toBuilder().clear().build(NullExtent.INSTANCE);
}
@ -75,8 +68,7 @@ public class VoxelList
*
* @return true if this list contains no elements
*/
public boolean isEmpty()
{
public boolean isEmpty() {
return mask.toBuilder().isEmpty();
}
@ -85,8 +77,7 @@ public class VoxelList
*
* @return defensive copy of the List with pairs
*/
public String toString()
{
public String toString() {
return mask.toString();
}