Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-09 13:00:05 +01:00
Removed trailing whitespaces.
Dieser Commit ist enthalten in:
Ursprung
b5b55a2775
Commit
f90e47da9a
@ -30,7 +30,7 @@ import com.sk89q.bukkit.migration.PermissionsResolverManager.MissingPluginExcept
|
|||||||
public class PermissionsExResolver implements PermissionsResolver {
|
public class PermissionsExResolver implements PermissionsResolver {
|
||||||
private final PermissionManager manager;
|
private final PermissionManager manager;
|
||||||
private final Server server;
|
private final Server server;
|
||||||
|
|
||||||
public PermissionsExResolver(Server server) throws MissingPluginException {
|
public PermissionsExResolver(Server server) throws MissingPluginException {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
manager = server.getServicesManager().load(PermissionManager.class);
|
manager = server.getServicesManager().load(PermissionManager.class);
|
||||||
@ -38,20 +38,20 @@ public class PermissionsExResolver implements PermissionsResolver {
|
|||||||
throw new MissingPluginException();
|
throw new MissingPluginException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void load() {
|
public void load() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasPermission(String name, String permission) {
|
public boolean hasPermission(String name, String permission) {
|
||||||
Player player = server.getPlayer(name);
|
Player player = server.getPlayer(name);
|
||||||
return manager.has(name, permission, player == null ? null : player.getWorld().getName());
|
return manager.has(name, permission, player == null ? null : player.getWorld().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasPermission(String worldName, String name, String permission) {
|
public boolean hasPermission(String worldName, String name, String permission) {
|
||||||
return manager.has(name, permission, worldName);
|
return manager.has(name, permission, worldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean inGroup(String player, String group) {
|
public boolean inGroup(String player, String group) {
|
||||||
PermissionUser user = manager.getUser(player);
|
PermissionUser user = manager.getUser(player);
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
@ -59,7 +59,7 @@ public class PermissionsExResolver implements PermissionsResolver {
|
|||||||
}
|
}
|
||||||
return user.inGroup(group);
|
return user.inGroup(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getGroups(String player) {
|
public String[] getGroups(String player) {
|
||||||
PermissionUser user = manager.getUser(player);
|
PermissionUser user = manager.getUser(player);
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
|
@ -25,7 +25,7 @@ import java.lang.annotation.RetentionPolicy;
|
|||||||
* Any command with this annotation will run the raw command as shown in the
|
* Any command with this annotation will run the raw command as shown in the
|
||||||
* thing, as long as it is registered in the current {@link CommandsManager}.
|
* thing, as long as it is registered in the current {@link CommandsManager}.
|
||||||
* Mostly to move commands around without breaking things.
|
* Mostly to move commands around without breaking things.
|
||||||
*
|
*
|
||||||
* @author zml2008
|
* @author zml2008
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
package com.sk89q.util;
|
package com.sk89q.util;
|
||||||
|
|
||||||
public class ArrayUtil {
|
public class ArrayUtil {
|
||||||
|
|
||||||
public static String[] removePortionOfArray(String[] array, int from, int to, String replace) {
|
public static String[] removePortionOfArray(String[] array, int from, int to, String replace) {
|
||||||
String[] newArray = new String[from + array.length - to - (replace == null ? 1 : 0)];
|
String[] newArray = new String[from + array.length - to - (replace == null ? 1 : 0)];
|
||||||
System.arraycopy(array, 0, newArray, 0, from);
|
System.arraycopy(array, 0, newArray, 0, from);
|
||||||
|
@ -36,10 +36,10 @@ public class BlockVector extends Vector {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the Vector object.
|
* Construct the Vector object.
|
||||||
*
|
*
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
* @param z
|
* @param z
|
||||||
*/
|
*/
|
||||||
public BlockVector(int x, int y, int z) {
|
public BlockVector(int x, int y, int z) {
|
||||||
super(x, y, z);
|
super(x, y, z);
|
||||||
@ -48,10 +48,10 @@ public class BlockVector extends Vector {
|
|||||||
/**
|
/**
|
||||||
* Construct the Vector object.
|
* Construct the Vector object.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
* @param z
|
* @param z
|
||||||
*/
|
*/
|
||||||
public BlockVector(float x, float y, float z) {
|
public BlockVector(float x, float y, float z) {
|
||||||
super(x, y, z);
|
super(x, y, z);
|
||||||
@ -60,15 +60,15 @@ public class BlockVector extends Vector {
|
|||||||
/**
|
/**
|
||||||
* Construct the Vector object.
|
* Construct the Vector object.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
* @param z
|
* @param z
|
||||||
*/
|
*/
|
||||||
public BlockVector(double x, double y, double z) {
|
public BlockVector(double x, double y, double z) {
|
||||||
super(x, y, z);
|
super(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if another object is equivalent.
|
* Checks if another object is equivalent.
|
||||||
*
|
*
|
||||||
|
@ -37,8 +37,8 @@ public class BlockVector2D extends Vector2D {
|
|||||||
/**
|
/**
|
||||||
* Construct the Vector object.
|
* Construct the Vector object.
|
||||||
*
|
*
|
||||||
* @param x
|
* @param x
|
||||||
* @param z
|
* @param z
|
||||||
*/
|
*/
|
||||||
public BlockVector2D(int x, int z) {
|
public BlockVector2D(int x, int z) {
|
||||||
super(x, z);
|
super(x, z);
|
||||||
@ -47,8 +47,8 @@ public class BlockVector2D extends Vector2D {
|
|||||||
/**
|
/**
|
||||||
* Construct the Vector object.
|
* Construct the Vector object.
|
||||||
*
|
*
|
||||||
* @param x
|
* @param x
|
||||||
* @param z
|
* @param z
|
||||||
*/
|
*/
|
||||||
public BlockVector2D(float x, float z) {
|
public BlockVector2D(float x, float z) {
|
||||||
super(x, z);
|
super(x, z);
|
||||||
@ -57,8 +57,8 @@ public class BlockVector2D extends Vector2D {
|
|||||||
/**
|
/**
|
||||||
* Construct the Vector object.
|
* Construct the Vector object.
|
||||||
*
|
*
|
||||||
* @param x
|
* @param x
|
||||||
* @param z
|
* @param z
|
||||||
*/
|
*/
|
||||||
public BlockVector2D(double x, double z) {
|
public BlockVector2D(double x, double z) {
|
||||||
super(x, z);
|
super(x, z);
|
||||||
|
@ -43,7 +43,7 @@ public class BlockWorldVector2D extends WorldVector2D {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if another object is equivalent.
|
* Checks if another object is equivalent.
|
||||||
*
|
*
|
||||||
* @param obj
|
* @param obj
|
||||||
* @return whether the other object is equivalent
|
* @return whether the other object is equivalent
|
||||||
*/
|
*/
|
||||||
|
@ -22,7 +22,7 @@ package com.sk89q.worldedit;
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author sk89q
|
* @author sk89q
|
||||||
* @param <T>
|
* @param <T>
|
||||||
*/
|
*/
|
||||||
public class Countable<T> implements Comparable<Countable<T>> {
|
public class Countable<T> implements Comparable<Countable<T>> {
|
||||||
/**
|
/**
|
||||||
@ -36,7 +36,7 @@ public class Countable<T> implements Comparable<Countable<T>> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the object.
|
* Construct the object.
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @param amount
|
* @param amount
|
||||||
*/
|
*/
|
||||||
@ -89,7 +89,7 @@ public class Countable<T> implements Comparable<Countable<T>> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Comparison.
|
* Comparison.
|
||||||
*
|
*
|
||||||
* @param other
|
* @param other
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -79,7 +79,7 @@ public class CuboidClipboard {
|
|||||||
*
|
*
|
||||||
* @param size
|
* @param size
|
||||||
* @param origin
|
* @param origin
|
||||||
* @param offset
|
* @param offset
|
||||||
*/
|
*/
|
||||||
public CuboidClipboard(Vector size, Vector origin, Vector offset) {
|
public CuboidClipboard(Vector size, Vector origin, Vector offset) {
|
||||||
this.size = size;
|
this.size = size;
|
||||||
@ -148,7 +148,7 @@ public class CuboidClipboard {
|
|||||||
for (int y = 0; y < height; ++y) {
|
for (int y = 0; y < height; ++y) {
|
||||||
BaseBlock block = data[x][y][z];
|
BaseBlock block = data[x][y][z];
|
||||||
newData[shiftX + newX][y][shiftZ + newZ] = block;
|
newData[shiftX + newX][y][shiftZ + newZ] = block;
|
||||||
|
|
||||||
if (reverse) {
|
if (reverse) {
|
||||||
for (int i = 0; i < numRotations; ++i) {
|
for (int i = 0; i < numRotations; ++i) {
|
||||||
block.rotate90Reverse();
|
block.rotate90Reverse();
|
||||||
@ -172,7 +172,7 @@ public class CuboidClipboard {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Flip the clipboard.
|
* Flip the clipboard.
|
||||||
*
|
*
|
||||||
* @param dir direction to flip
|
* @param dir direction to flip
|
||||||
*/
|
*/
|
||||||
public void flip(FlipDirection dir) {
|
public void flip(FlipDirection dir) {
|
||||||
@ -281,7 +281,7 @@ public class CuboidClipboard {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Places the blocks in a position from the minimum corner.
|
* Places the blocks in a position from the minimum corner.
|
||||||
*
|
*
|
||||||
* @param editSession
|
* @param editSession
|
||||||
* @param pos
|
* @param pos
|
||||||
* @param noAir
|
* @param noAir
|
||||||
@ -301,11 +301,11 @@ public class CuboidClipboard {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get one point in the copy. The point is relative to the origin
|
* Get one point in the copy. The point is relative to the origin
|
||||||
* of the copy (0, 0, 0) and not to the actual copy origin.
|
* of the copy (0, 0, 0) and not to the actual copy origin.
|
||||||
*
|
*
|
||||||
* @param pos
|
* @param pos
|
||||||
* @return null
|
* @return null
|
||||||
* @throws ArrayIndexOutOfBoundsException
|
* @throws ArrayIndexOutOfBoundsException
|
||||||
@ -313,10 +313,10 @@ public class CuboidClipboard {
|
|||||||
public BaseBlock getPoint(Vector pos) throws ArrayIndexOutOfBoundsException {
|
public BaseBlock getPoint(Vector pos) throws ArrayIndexOutOfBoundsException {
|
||||||
return data[pos.getBlockX()][pos.getBlockY()][pos.getBlockZ()];
|
return data[pos.getBlockX()][pos.getBlockY()][pos.getBlockZ()];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the size of the copy.
|
* Get the size of the copy.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Vector getSize() {
|
public Vector getSize() {
|
||||||
@ -390,7 +390,7 @@ public class CuboidClipboard {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
schematic.put("Blocks", new ByteArrayTag("Blocks", blocks));
|
schematic.put("Blocks", new ByteArrayTag("Blocks", blocks));
|
||||||
schematic.put("Data", new ByteArrayTag("Data", blockData));
|
schematic.put("Data", new ByteArrayTag("Data", blockData));
|
||||||
schematic.put("Entities", new ListTag("Entities", CompoundTag.class, new ArrayList<Tag>()));
|
schematic.put("Entities", new ListTag("Entities", CompoundTag.class, new ArrayList<Tag>()));
|
||||||
@ -405,7 +405,7 @@ public class CuboidClipboard {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a .schematic file into a clipboard.
|
* Load a .schematic file into a clipboard.
|
||||||
*
|
*
|
||||||
* @param path
|
* @param path
|
||||||
* @return clipboard
|
* @return clipboard
|
||||||
* @throws DataException
|
* @throws DataException
|
||||||
@ -546,8 +546,8 @@ public class CuboidClipboard {
|
|||||||
block = new BaseBlock(blocks[index], blockData[index]);
|
block = new BaseBlock(blocks[index], blockData[index]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block instanceof TileEntityBlock
|
if (block instanceof TileEntityBlock
|
||||||
&& tileEntitiesMap.containsKey(pt)) {
|
&& tileEntitiesMap.containsKey(pt)) {
|
||||||
((TileEntityBlock)block).fromTileEntityNBT(
|
((TileEntityBlock)block).fromTileEntityNBT(
|
||||||
tileEntitiesMap.get(pt));
|
tileEntitiesMap.get(pt));
|
||||||
@ -563,7 +563,7 @@ public class CuboidClipboard {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get child tag of a NBT structure.
|
* Get child tag of a NBT structure.
|
||||||
*
|
*
|
||||||
* @param items
|
* @param items
|
||||||
* @param key
|
* @param key
|
||||||
* @param expected
|
* @param expected
|
||||||
@ -572,7 +572,7 @@ public class CuboidClipboard {
|
|||||||
*/
|
*/
|
||||||
private static Tag getChildTag(Map<String,Tag> items, String key,
|
private static Tag getChildTag(Map<String,Tag> items, String key,
|
||||||
Class<? extends Tag> expected) throws DataException {
|
Class<? extends Tag> expected) throws DataException {
|
||||||
|
|
||||||
if (!items.containsKey(key)) {
|
if (!items.containsKey(key)) {
|
||||||
throw new DataException("Schematic file is missing a \"" + key + "\" tag");
|
throw new DataException("Schematic file is missing a \"" + key + "\" tag");
|
||||||
}
|
}
|
||||||
@ -606,7 +606,7 @@ public class CuboidClipboard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param offset
|
* @param offset
|
||||||
*/
|
*/
|
||||||
public void setOffset(Vector offset) {
|
public void setOffset(Vector offset) {
|
||||||
this.offset = offset;
|
this.offset = offset;
|
||||||
|
@ -25,7 +25,7 @@ package com.sk89q.worldedit;
|
|||||||
*/
|
*/
|
||||||
public class DisallowedItemException extends WorldEditException {
|
public class DisallowedItemException extends WorldEditException {
|
||||||
private static final long serialVersionUID = -8080026411461549979L;
|
private static final long serialVersionUID = -8080026411461549979L;
|
||||||
|
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
public DisallowedItemException(String type) {
|
public DisallowedItemException(String type) {
|
||||||
|
@ -30,8 +30,8 @@ import java.util.NoSuchElementException;
|
|||||||
* Double array lists to work like a Map, but not really.
|
* Double array lists to work like a Map, but not really.
|
||||||
*
|
*
|
||||||
* @author sk89q
|
* @author sk89q
|
||||||
* @param <A>
|
* @param <A>
|
||||||
* @param <B>
|
* @param <B>
|
||||||
*/
|
*/
|
||||||
public class DoubleArrayList<A,B> implements Iterable<Map.Entry<A,B>> {
|
public class DoubleArrayList<A,B> implements Iterable<Map.Entry<A,B>> {
|
||||||
/**
|
/**
|
||||||
@ -49,7 +49,7 @@ public class DoubleArrayList<A,B> implements Iterable<Map.Entry<A,B>> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the object.
|
* Construct the object.
|
||||||
*
|
*
|
||||||
* @param isReversed
|
* @param isReversed
|
||||||
*/
|
*/
|
||||||
public DoubleArrayList(boolean isReversed) {
|
public DoubleArrayList(boolean isReversed) {
|
||||||
@ -58,7 +58,7 @@ public class DoubleArrayList<A,B> implements Iterable<Map.Entry<A,B>> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an item.
|
* Add an item.
|
||||||
*
|
*
|
||||||
* @param a
|
* @param a
|
||||||
* @param b
|
* @param b
|
||||||
*/
|
*/
|
||||||
@ -102,12 +102,12 @@ public class DoubleArrayList<A,B> implements Iterable<Map.Entry<A,B>> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Entry iterator.
|
* Entry iterator.
|
||||||
*
|
*
|
||||||
* @param <T>
|
* @param <T>
|
||||||
*/
|
*/
|
||||||
public class ForwardEntryIterator<T extends Map.Entry<A,B>>
|
public class ForwardEntryIterator<T extends Map.Entry<A,B>>
|
||||||
implements Iterator<Map.Entry<A,B>> {
|
implements Iterator<Map.Entry<A,B>> {
|
||||||
|
|
||||||
private Iterator<A> keyIterator;
|
private Iterator<A> keyIterator;
|
||||||
private Iterator<B> valueIterator;
|
private Iterator<B> valueIterator;
|
||||||
|
|
||||||
@ -131,12 +131,12 @@ public class DoubleArrayList<A,B> implements Iterable<Map.Entry<A,B>> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Entry iterator.
|
* Entry iterator.
|
||||||
*
|
*
|
||||||
* @param <T>
|
* @param <T>
|
||||||
*/
|
*/
|
||||||
public class ReverseEntryIterator<T extends Map.Entry<A,B>>
|
public class ReverseEntryIterator<T extends Map.Entry<A,B>>
|
||||||
implements Iterator<Map.Entry<A,B>> {
|
implements Iterator<Map.Entry<A,B>> {
|
||||||
|
|
||||||
private ListIterator<A> keyIterator;
|
private ListIterator<A> keyIterator;
|
||||||
private ListIterator<B> valueIterator;
|
private ListIterator<B> valueIterator;
|
||||||
|
|
||||||
@ -160,9 +160,9 @@ public class DoubleArrayList<A,B> implements Iterable<Map.Entry<A,B>> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to masquerade as Map.Entry.
|
* Class to masquerade as Map.Entry.
|
||||||
*
|
*
|
||||||
* @param <C>
|
* @param <C>
|
||||||
* @param <D>
|
* @param <D>
|
||||||
*/
|
*/
|
||||||
public class Entry<C,D> implements Map.Entry<A,B> {
|
public class Entry<C,D> implements Map.Entry<A,B> {
|
||||||
private A key;
|
private A key;
|
||||||
|
@ -42,7 +42,7 @@ import com.sk89q.worldedit.patterns.*;
|
|||||||
* know how to handle some special types of items such as signs and torches. For
|
* know how to handle some special types of items such as signs and torches. For
|
||||||
* example, torches must be placed only after there is already a block below it,
|
* example, torches must be placed only after there is already a block below it,
|
||||||
* otherwise the torch will be placed as an item.
|
* otherwise the torch will be placed as an item.
|
||||||
*
|
*
|
||||||
* @author sk89q
|
* @author sk89q
|
||||||
*/
|
*/
|
||||||
public class EditSession {
|
public class EditSession {
|
||||||
@ -79,35 +79,35 @@ public class EditSession {
|
|||||||
private DoubleArrayList<BlockVector, BaseBlock> queueLast =
|
private DoubleArrayList<BlockVector, BaseBlock> queueLast =
|
||||||
new DoubleArrayList<BlockVector, BaseBlock>(
|
new DoubleArrayList<BlockVector, BaseBlock>(
|
||||||
false);
|
false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The maximum number of blocks to change at a time. If this number is
|
* The maximum number of blocks to change at a time. If this number is
|
||||||
* exceeded, a MaxChangedBlocksException exception will be raised. -1
|
* exceeded, a MaxChangedBlocksException exception will be raised. -1
|
||||||
* indicates no limit.
|
* indicates no limit.
|
||||||
*/
|
*/
|
||||||
private int maxBlocks = -1;
|
private int maxBlocks = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether some types of blocks should be queued for best
|
* Indicates whether some types of blocks should be queued for best
|
||||||
* reproduction.
|
* reproduction.
|
||||||
*/
|
*/
|
||||||
private boolean queued = false;
|
private boolean queued = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use the fast mode, which may leave chunks not flagged "dirty".
|
* Use the fast mode, which may leave chunks not flagged "dirty".
|
||||||
*/
|
*/
|
||||||
private boolean fastMode = false;
|
private boolean fastMode = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Block bag to use for getting blocks.
|
* Block bag to use for getting blocks.
|
||||||
*/
|
*/
|
||||||
private BlockBag blockBag;
|
private BlockBag blockBag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of missing blocks;
|
* List of missing blocks;
|
||||||
*/
|
*/
|
||||||
private Set<Integer> missingBlocks = new HashSet<Integer>();
|
private Set<Integer> missingBlocks = new HashSet<Integer>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mask to cover operations.
|
* Mask to cover operations.
|
||||||
*/
|
*/
|
||||||
@ -115,7 +115,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the object with a maximum number of blocks.
|
* Construct the object with a maximum number of blocks.
|
||||||
*
|
*
|
||||||
* @param world
|
* @param world
|
||||||
* @param maxBlocks
|
* @param maxBlocks
|
||||||
*/
|
*/
|
||||||
@ -130,7 +130,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the object with a maximum number of blocks and a block bag.
|
* Construct the object with a maximum number of blocks and a block bag.
|
||||||
*
|
*
|
||||||
* @param world
|
* @param world
|
||||||
* @param maxBlocks
|
* @param maxBlocks
|
||||||
* @param blockBag
|
* @param blockBag
|
||||||
@ -148,9 +148,9 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a block without changing history.
|
* Sets a block without changing history.
|
||||||
*
|
*
|
||||||
* @param pt
|
* @param pt
|
||||||
* @param block
|
* @param block
|
||||||
* @return Whether the block changed
|
* @return Whether the block changed
|
||||||
*/
|
*/
|
||||||
public boolean rawSetBlock(Vector pt, BaseBlock block) {
|
public boolean rawSetBlock(Vector pt, BaseBlock block) {
|
||||||
@ -161,7 +161,7 @@ public class EditSession {
|
|||||||
}
|
}
|
||||||
|
|
||||||
world.checkLoadedChuck(pt);
|
world.checkLoadedChuck(pt);
|
||||||
|
|
||||||
// No invalid blocks
|
// No invalid blocks
|
||||||
if (!world.isValidBlockType(type)) {
|
if (!world.isValidBlockType(type)) {
|
||||||
return false;
|
return false;
|
||||||
@ -237,11 +237,11 @@ public class EditSession {
|
|||||||
* Sets the block at position x, y, z with a block type. If queue mode is
|
* Sets the block at position x, y, z with a block type. If queue mode is
|
||||||
* enabled, blocks may not be actually set in world until flushQueue() is
|
* enabled, blocks may not be actually set in world until flushQueue() is
|
||||||
* called.
|
* called.
|
||||||
*
|
*
|
||||||
* @param pt
|
* @param pt
|
||||||
* @param block
|
* @param block
|
||||||
* @return Whether the block changed -- not entirely dependable
|
* @return Whether the block changed -- not entirely dependable
|
||||||
* @throws MaxChangedBlocksException
|
* @throws MaxChangedBlocksException
|
||||||
*/
|
*/
|
||||||
public boolean setBlock(Vector pt, BaseBlock block)
|
public boolean setBlock(Vector pt, BaseBlock block)
|
||||||
throws MaxChangedBlocksException {
|
throws MaxChangedBlocksException {
|
||||||
@ -262,9 +262,9 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert a contrived block change into the history.
|
* Insert a contrived block change into the history.
|
||||||
*
|
*
|
||||||
* @param pt
|
* @param pt
|
||||||
* @param existing
|
* @param existing
|
||||||
* @param block
|
* @param block
|
||||||
*/
|
*/
|
||||||
public void rememberChange(Vector pt, BaseBlock existing, BaseBlock block) {
|
public void rememberChange(Vector pt, BaseBlock existing, BaseBlock block) {
|
||||||
@ -276,11 +276,11 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a block with a pattern.
|
* Set a block with a pattern.
|
||||||
*
|
*
|
||||||
* @param pt
|
* @param pt
|
||||||
* @param pat
|
* @param pat
|
||||||
* @return Whether the block changed -- not entirely dependable
|
* @return Whether the block changed -- not entirely dependable
|
||||||
* @throws MaxChangedBlocksException
|
* @throws MaxChangedBlocksException
|
||||||
*/
|
*/
|
||||||
public boolean setBlock(Vector pt, Pattern pat)
|
public boolean setBlock(Vector pt, Pattern pat)
|
||||||
throws MaxChangedBlocksException {
|
throws MaxChangedBlocksException {
|
||||||
@ -289,7 +289,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a block only if there's no block already there.
|
* Set a block only if there's no block already there.
|
||||||
*
|
*
|
||||||
* @param pt
|
* @param pt
|
||||||
* @param block
|
* @param block
|
||||||
* @return if block was changed
|
* @return if block was changed
|
||||||
@ -306,7 +306,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Actually set the block. Will use queue.
|
* Actually set the block. Will use queue.
|
||||||
*
|
*
|
||||||
* @param pt
|
* @param pt
|
||||||
* @param block
|
* @param block
|
||||||
* @return
|
* @return
|
||||||
@ -333,7 +333,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the block type at a position x, y, z.
|
* Gets the block type at a position x, y, z.
|
||||||
*
|
*
|
||||||
* @param pt
|
* @param pt
|
||||||
* @return Block type
|
* @return Block type
|
||||||
*/
|
*/
|
||||||
@ -343,7 +343,7 @@ public class EditSession {
|
|||||||
if (queued) {
|
if (queued) {
|
||||||
/*
|
/*
|
||||||
* BlockVector blockPt = pt.toBlockVector();
|
* BlockVector blockPt = pt.toBlockVector();
|
||||||
*
|
*
|
||||||
* if (current.containsKey(blockPt)) { return current.get(blockPt);
|
* if (current.containsKey(blockPt)) { return current.get(blockPt);
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
@ -354,7 +354,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the block type at a position x, y, z.
|
* Gets the block type at a position x, y, z.
|
||||||
*
|
*
|
||||||
* @param pt
|
* @param pt
|
||||||
* @return Block type
|
* @return Block type
|
||||||
*/
|
*/
|
||||||
@ -364,7 +364,7 @@ public class EditSession {
|
|||||||
if (queued) {
|
if (queued) {
|
||||||
/*
|
/*
|
||||||
* BlockVector blockPt = pt.toBlockVector();
|
* BlockVector blockPt = pt.toBlockVector();
|
||||||
*
|
*
|
||||||
* if (current.containsKey(blockPt)) { return current.get(blockPt);
|
* if (current.containsKey(blockPt)) { return current.get(blockPt);
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
@ -379,7 +379,7 @@ public class EditSession {
|
|||||||
if (queued) {
|
if (queued) {
|
||||||
/*
|
/*
|
||||||
* BlockVector blockPt = pt.toBlockVector();
|
* BlockVector blockPt = pt.toBlockVector();
|
||||||
*
|
*
|
||||||
* if (current.containsKey(blockPt)) { return current.get(blockPt);
|
* if (current.containsKey(blockPt)) { return current.get(blockPt);
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
@ -389,7 +389,7 @@ public class EditSession {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Gets the block type at a position x, y, z.
|
* Gets the block type at a position x, y, z.
|
||||||
*
|
*
|
||||||
* @param pt
|
* @param pt
|
||||||
* @return BaseBlock
|
* @return BaseBlock
|
||||||
*/
|
*/
|
||||||
@ -445,8 +445,8 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Restores all blocks to their initial state.
|
* Restores all blocks to their initial state.
|
||||||
*
|
*
|
||||||
* @param sess
|
* @param sess
|
||||||
*/
|
*/
|
||||||
public void undo(EditSession sess) {
|
public void undo(EditSession sess) {
|
||||||
for (Map.Entry<BlockVector, BaseBlock> entry : original) {
|
for (Map.Entry<BlockVector, BaseBlock> entry : original) {
|
||||||
@ -458,8 +458,8 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets to new state.
|
* Sets to new state.
|
||||||
*
|
*
|
||||||
* @param sess
|
* @param sess
|
||||||
*/
|
*/
|
||||||
public void redo(EditSession sess) {
|
public void redo(EditSession sess) {
|
||||||
for (Map.Entry<BlockVector, BaseBlock> entry : current) {
|
for (Map.Entry<BlockVector, BaseBlock> entry : current) {
|
||||||
@ -471,8 +471,8 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of changed blocks.
|
* Get the number of changed blocks.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public int size() {
|
public int size() {
|
||||||
return original.size();
|
return original.size();
|
||||||
@ -481,7 +481,7 @@ public class EditSession {
|
|||||||
/**
|
/**
|
||||||
* Get the maximum number of blocks that can be changed. -1 will be returned
|
* Get the maximum number of blocks that can be changed. -1 will be returned
|
||||||
* if disabled.
|
* if disabled.
|
||||||
*
|
*
|
||||||
* @return block change limit
|
* @return block change limit
|
||||||
*/
|
*/
|
||||||
public int getBlockChangeLimit() {
|
public int getBlockChangeLimit() {
|
||||||
@ -490,7 +490,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the maximum number of blocks that can be changed.
|
* Set the maximum number of blocks that can be changed.
|
||||||
*
|
*
|
||||||
* @param maxBlocks -1 to disable
|
* @param maxBlocks -1 to disable
|
||||||
*/
|
*/
|
||||||
public void setBlockChangeLimit(int maxBlocks) {
|
public void setBlockChangeLimit(int maxBlocks) {
|
||||||
@ -502,7 +502,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns queue status.
|
* Returns queue status.
|
||||||
*
|
*
|
||||||
* @return whether the queue is enabled
|
* @return whether the queue is enabled
|
||||||
*/
|
*/
|
||||||
public boolean isQueueEnabled() {
|
public boolean isQueueEnabled() {
|
||||||
@ -528,7 +528,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set fast mode.
|
* Set fast mode.
|
||||||
*
|
*
|
||||||
* @param fastMode
|
* @param fastMode
|
||||||
*/
|
*/
|
||||||
public void setFastMode(boolean fastMode) {
|
public void setFastMode(boolean fastMode) {
|
||||||
@ -537,7 +537,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return fast mode status.
|
* Return fast mode status.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean hasFastMode() {
|
public boolean hasFastMode() {
|
||||||
@ -572,14 +572,14 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Fills an area recursively in the X/Z directions.
|
* Fills an area recursively in the X/Z directions.
|
||||||
*
|
*
|
||||||
* @param origin
|
* @param origin
|
||||||
* @param block
|
* @param block
|
||||||
* @param radius
|
* @param radius
|
||||||
* @param depth
|
* @param depth
|
||||||
* @param recursive
|
* @param recursive
|
||||||
* @return number of blocks affected
|
* @return number of blocks affected
|
||||||
* @throws MaxChangedBlocksException
|
* @throws MaxChangedBlocksException
|
||||||
*/
|
*/
|
||||||
public int fillXZ(Vector origin, BaseBlock block, double radius, int depth,
|
public int fillXZ(Vector origin, BaseBlock block, double radius, int depth,
|
||||||
boolean recursive) throws MaxChangedBlocksException {
|
boolean recursive) throws MaxChangedBlocksException {
|
||||||
@ -648,7 +648,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Recursively fills a block and below until it hits another block.
|
* Recursively fills a block and below until it hits another block.
|
||||||
*
|
*
|
||||||
* @param x
|
* @param x
|
||||||
* @param cy
|
* @param cy
|
||||||
* @param z
|
* @param z
|
||||||
@ -677,14 +677,14 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Fills an area recursively in the X/Z directions.
|
* Fills an area recursively in the X/Z directions.
|
||||||
*
|
*
|
||||||
* @param origin
|
* @param origin
|
||||||
* @param pattern
|
* @param pattern
|
||||||
* @param radius
|
* @param radius
|
||||||
* @param depth
|
* @param depth
|
||||||
* @param recursive
|
* @param recursive
|
||||||
* @return number of blocks affected
|
* @return number of blocks affected
|
||||||
* @throws MaxChangedBlocksException
|
* @throws MaxChangedBlocksException
|
||||||
*/
|
*/
|
||||||
public int fillXZ(Vector origin, Pattern pattern, double radius, int depth,
|
public int fillXZ(Vector origin, Pattern pattern, double radius, int depth,
|
||||||
boolean recursive) throws MaxChangedBlocksException {
|
boolean recursive) throws MaxChangedBlocksException {
|
||||||
@ -753,7 +753,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Recursively fills a block and below until it hits another block.
|
* Recursively fills a block and below until it hits another block.
|
||||||
*
|
*
|
||||||
* @param x
|
* @param x
|
||||||
* @param cy
|
* @param cy
|
||||||
* @param z
|
* @param z
|
||||||
@ -782,12 +782,12 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove blocks above.
|
* Remove blocks above.
|
||||||
*
|
*
|
||||||
* @param pos
|
* @param pos
|
||||||
* @param size
|
* @param size
|
||||||
* @param height
|
* @param height
|
||||||
* @return number of blocks affected
|
* @return number of blocks affected
|
||||||
* @throws MaxChangedBlocksException
|
* @throws MaxChangedBlocksException
|
||||||
*/
|
*/
|
||||||
public int removeAbove(Vector pos, int size, int height)
|
public int removeAbove(Vector pos, int size, int height)
|
||||||
throws MaxChangedBlocksException {
|
throws MaxChangedBlocksException {
|
||||||
@ -817,12 +817,12 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove blocks below.
|
* Remove blocks below.
|
||||||
*
|
*
|
||||||
* @param pos
|
* @param pos
|
||||||
* @param size
|
* @param size
|
||||||
* @param height
|
* @param height
|
||||||
* @return number of blocks affected
|
* @return number of blocks affected
|
||||||
* @throws MaxChangedBlocksException
|
* @throws MaxChangedBlocksException
|
||||||
*/
|
*/
|
||||||
public int removeBelow(Vector pos, int size, int height)
|
public int removeBelow(Vector pos, int size, int height)
|
||||||
throws MaxChangedBlocksException {
|
throws MaxChangedBlocksException {
|
||||||
@ -852,12 +852,12 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove nearby blocks of a type.
|
* Remove nearby blocks of a type.
|
||||||
*
|
*
|
||||||
* @param pos
|
* @param pos
|
||||||
* @param blockType
|
* @param blockType
|
||||||
* @param size
|
* @param size
|
||||||
* @return number of blocks affected
|
* @return number of blocks affected
|
||||||
* @throws MaxChangedBlocksException
|
* @throws MaxChangedBlocksException
|
||||||
*/
|
*/
|
||||||
public int removeNear(Vector pos, int blockType, int size)
|
public int removeNear(Vector pos, int blockType, int size)
|
||||||
throws MaxChangedBlocksException {
|
throws MaxChangedBlocksException {
|
||||||
@ -890,7 +890,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets all the blocks inside a region to a certain block type.
|
* Sets all the blocks inside a region to a certain block type.
|
||||||
*
|
*
|
||||||
* @param region
|
* @param region
|
||||||
* @param block
|
* @param block
|
||||||
* @return number of blocks affected
|
* @return number of blocks affected
|
||||||
@ -936,7 +936,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets all the blocks inside a region to a certain block type.
|
* Sets all the blocks inside a region to a certain block type.
|
||||||
*
|
*
|
||||||
* @param region
|
* @param region
|
||||||
* @param pattern
|
* @param pattern
|
||||||
* @return number of blocks affected
|
* @return number of blocks affected
|
||||||
@ -982,7 +982,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Replaces all the blocks of a type inside a region to another block type.
|
* Replaces all the blocks of a type inside a region to another block type.
|
||||||
*
|
*
|
||||||
* @param region
|
* @param region
|
||||||
* @param fromBlockTypes -1 for non-air
|
* @param fromBlockTypes -1 for non-air
|
||||||
* @param toBlock
|
* @param toBlock
|
||||||
@ -1038,7 +1038,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Replaces all the blocks of a type inside a region to another block type.
|
* Replaces all the blocks of a type inside a region to another block type.
|
||||||
*
|
*
|
||||||
* @param region
|
* @param region
|
||||||
* @param fromBlockTypes -1 for non-air
|
* @param fromBlockTypes -1 for non-air
|
||||||
* @param pattern
|
* @param pattern
|
||||||
@ -1094,7 +1094,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Make faces of the region (as if it was a cuboid if it's not).
|
* Make faces of the region (as if it was a cuboid if it's not).
|
||||||
*
|
*
|
||||||
* @param region
|
* @param region
|
||||||
* @param block
|
* @param block
|
||||||
* @return number of blocks affected
|
* @return number of blocks affected
|
||||||
@ -1218,7 +1218,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Make walls of the region (as if it was a cuboid if it's not).
|
* Make walls of the region (as if it was a cuboid if it's not).
|
||||||
*
|
*
|
||||||
* @param region
|
* @param region
|
||||||
* @param block
|
* @param block
|
||||||
* @return number of blocks affected
|
* @return number of blocks affected
|
||||||
@ -1318,7 +1318,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Overlays a layer of blocks over a cuboid area.
|
* Overlays a layer of blocks over a cuboid area.
|
||||||
*
|
*
|
||||||
* @param region
|
* @param region
|
||||||
* @param block
|
* @param block
|
||||||
* @return number of blocks affected
|
* @return number of blocks affected
|
||||||
@ -1360,7 +1360,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Overlays a layer of blocks over a cuboid area.
|
* Overlays a layer of blocks over a cuboid area.
|
||||||
*
|
*
|
||||||
* @param region
|
* @param region
|
||||||
* @param pattern
|
* @param pattern
|
||||||
* @return number of blocks affected
|
* @return number of blocks affected
|
||||||
@ -1475,7 +1475,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Stack a cuboid region.
|
* Stack a cuboid region.
|
||||||
*
|
*
|
||||||
* @param region
|
* @param region
|
||||||
* @param dir
|
* @param dir
|
||||||
* @param count
|
* @param count
|
||||||
@ -1526,7 +1526,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Move a cuboid region.
|
* Move a cuboid region.
|
||||||
*
|
*
|
||||||
* @param region
|
* @param region
|
||||||
* @param dir
|
* @param dir
|
||||||
* @param distance
|
* @param distance
|
||||||
@ -1592,7 +1592,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Drain nearby pools of water or lava.
|
* Drain nearby pools of water or lava.
|
||||||
*
|
*
|
||||||
* @param pos
|
* @param pos
|
||||||
* @param radius
|
* @param radius
|
||||||
* @return number of blocks affected
|
* @return number of blocks affected
|
||||||
@ -1658,11 +1658,11 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Level water.
|
* Level water.
|
||||||
*
|
*
|
||||||
* @param pos
|
* @param pos
|
||||||
* @param radius
|
* @param radius
|
||||||
* @param moving
|
* @param moving
|
||||||
* @param stationary
|
* @param stationary
|
||||||
* @return number of blocks affected
|
* @return number of blocks affected
|
||||||
* @throws MaxChangedBlocksException
|
* @throws MaxChangedBlocksException
|
||||||
*/
|
*/
|
||||||
@ -1708,7 +1708,7 @@ public class EditSession {
|
|||||||
if (setBlock(cur, stationaryBlock)){
|
if (setBlock(cur, stationaryBlock)){
|
||||||
++affected;
|
++affected;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check radius
|
// Check radius
|
||||||
if (pos.distance(cur) > radius) {
|
if (pos.distance(cur) > radius) {
|
||||||
continue;
|
continue;
|
||||||
@ -1725,7 +1725,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to draw the cylinder.
|
* Helper method to draw the cylinder.
|
||||||
*
|
*
|
||||||
* @param center
|
* @param center
|
||||||
* @param x
|
* @param x
|
||||||
* @param z
|
* @param z
|
||||||
@ -1773,7 +1773,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw a hollow cylinder.
|
* Draw a hollow cylinder.
|
||||||
*
|
*
|
||||||
* @param pos
|
* @param pos
|
||||||
* @param block
|
* @param block
|
||||||
* @param radius
|
* @param radius
|
||||||
@ -1821,7 +1821,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to draw the cylinder.
|
* Helper method to draw the cylinder.
|
||||||
*
|
*
|
||||||
* @param center
|
* @param center
|
||||||
* @param x
|
* @param x
|
||||||
* @param z
|
* @param z
|
||||||
@ -1861,7 +1861,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw a filled cylinder.
|
* Draw a filled cylinder.
|
||||||
*
|
*
|
||||||
* @param pos
|
* @param pos
|
||||||
* @param block
|
* @param block
|
||||||
* @param radius
|
* @param radius
|
||||||
@ -1908,7 +1908,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes a sphere or ellipsoid.
|
* Makes a sphere or ellipsoid.
|
||||||
*
|
*
|
||||||
* @param pos Center of the sphere or ellipsoid
|
* @param pos Center of the sphere or ellipsoid
|
||||||
* @param block The block pattern to use
|
* @param block The block pattern to use
|
||||||
* @param radiusX The sphere/ellipsoid's largest north/south extent
|
* @param radiusX The sphere/ellipsoid's largest north/south extent
|
||||||
@ -1976,7 +1976,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes a sphere or ellipsoid.
|
* Makes a sphere or ellipsoid.
|
||||||
*
|
*
|
||||||
* @param pos Center of the sphere or ellipsoid
|
* @param pos Center of the sphere or ellipsoid
|
||||||
* @param block The block pattern to use
|
* @param block The block pattern to use
|
||||||
* @param radiusX The sphere/ellipsoid's largest north/south extent
|
* @param radiusX The sphere/ellipsoid's largest north/south extent
|
||||||
@ -2071,7 +2071,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes a pyramid.
|
* Makes a pyramid.
|
||||||
*
|
*
|
||||||
* @param pos
|
* @param pos
|
||||||
* @param block
|
* @param block
|
||||||
* @param size
|
* @param size
|
||||||
@ -2084,14 +2084,14 @@ public class EditSession {
|
|||||||
int affected = 0;
|
int affected = 0;
|
||||||
|
|
||||||
int height = size;
|
int height = size;
|
||||||
|
|
||||||
for (int y = 0; y <= height; ++y) {
|
for (int y = 0; y <= height; ++y) {
|
||||||
size--;
|
size--;
|
||||||
for (int x = 0; x <= size; ++x) {
|
for (int x = 0; x <= size; ++x) {
|
||||||
for (int z = 0; z <= size; ++z) {
|
for (int z = 0; z <= size; ++z) {
|
||||||
|
|
||||||
if ((filled && z <= size && x <= size) || z == size || x == size) {
|
if ((filled && z <= size && x <= size) || z == size || x == size) {
|
||||||
|
|
||||||
if (setBlock(pos.add(x, y, z), block)) {
|
if (setBlock(pos.add(x, y, z), block)) {
|
||||||
++affected;
|
++affected;
|
||||||
}
|
}
|
||||||
@ -2114,7 +2114,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Thaw.
|
* Thaw.
|
||||||
*
|
*
|
||||||
* @param pos
|
* @param pos
|
||||||
* @param radius
|
* @param radius
|
||||||
* @return number of blocks affected
|
* @return number of blocks affected
|
||||||
@ -2173,7 +2173,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Make snow.
|
* Make snow.
|
||||||
*
|
*
|
||||||
* @param pos
|
* @param pos
|
||||||
* @param radius
|
* @param radius
|
||||||
* @return number of blocks affected
|
* @return number of blocks affected
|
||||||
@ -2238,7 +2238,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Green.
|
* Green.
|
||||||
*
|
*
|
||||||
* @param pos
|
* @param pos
|
||||||
* @param radius
|
* @param radius
|
||||||
* @return number of blocks affected
|
* @return number of blocks affected
|
||||||
@ -2285,12 +2285,12 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a block by chance.
|
* Set a block by chance.
|
||||||
*
|
*
|
||||||
* @param pos
|
* @param pos
|
||||||
* @param block
|
* @param block
|
||||||
* @param c 0-1 chance
|
* @param c 0-1 chance
|
||||||
* @return whether a block was changed
|
* @return whether a block was changed
|
||||||
* @throws MaxChangedBlocksException
|
* @throws MaxChangedBlocksException
|
||||||
*/
|
*/
|
||||||
public boolean setChanceBlockIfAir(Vector pos, BaseBlock block, double c)
|
public boolean setChanceBlockIfAir(Vector pos, BaseBlock block, double c)
|
||||||
throws MaxChangedBlocksException {
|
throws MaxChangedBlocksException {
|
||||||
@ -2302,7 +2302,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes a pumpkin patch.
|
* Makes a pumpkin patch.
|
||||||
*
|
*
|
||||||
* @param basePos
|
* @param basePos
|
||||||
*/
|
*/
|
||||||
private void makePumpkinPatch(Vector basePos)
|
private void makePumpkinPatch(Vector basePos)
|
||||||
@ -2321,7 +2321,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a pumpkin patch fine.
|
* Make a pumpkin patch fine.
|
||||||
*
|
*
|
||||||
* @param basePos
|
* @param basePos
|
||||||
* @param pos
|
* @param pos
|
||||||
*/
|
*/
|
||||||
@ -2392,11 +2392,11 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes pumpkin patches.
|
* Makes pumpkin patches.
|
||||||
*
|
*
|
||||||
* @param basePos
|
* @param basePos
|
||||||
* @param size
|
* @param size
|
||||||
* @return number of trees created
|
* @return number of trees created
|
||||||
* @throws MaxChangedBlocksException
|
* @throws MaxChangedBlocksException
|
||||||
*/
|
*/
|
||||||
public int makePumpkinPatches(Vector basePos, int size)
|
public int makePumpkinPatches(Vector basePos, int size)
|
||||||
throws MaxChangedBlocksException {
|
throws MaxChangedBlocksException {
|
||||||
@ -2434,13 +2434,13 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes a forest.
|
* Makes a forest.
|
||||||
*
|
*
|
||||||
* @param basePos
|
* @param basePos
|
||||||
* @param size
|
* @param size
|
||||||
* @param density
|
* @param density
|
||||||
* @param treeGenerator
|
* @param treeGenerator
|
||||||
* @return number of trees created
|
* @return number of trees created
|
||||||
* @throws MaxChangedBlocksException
|
* @throws MaxChangedBlocksException
|
||||||
*/
|
*/
|
||||||
public int makeForest(Vector basePos, int size, double density,
|
public int makeForest(Vector basePos, int size, double density,
|
||||||
TreeGenerator treeGenerator) throws MaxChangedBlocksException {
|
TreeGenerator treeGenerator) throws MaxChangedBlocksException {
|
||||||
@ -2478,7 +2478,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Count the number of blocks of a list of types in a region.
|
* Count the number of blocks of a list of types in a region.
|
||||||
*
|
*
|
||||||
* @param region
|
* @param region
|
||||||
* @param searchIDs
|
* @param searchIDs
|
||||||
* @return
|
* @return
|
||||||
@ -2522,7 +2522,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the block distribution inside a region.
|
* Get the block distribution inside a region.
|
||||||
*
|
*
|
||||||
* @param region
|
* @param region
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -2616,7 +2616,7 @@ public class EditSession {
|
|||||||
/**
|
/**
|
||||||
* Gets the list of missing blocks and clears the list for the next
|
* Gets the list of missing blocks and clears the list for the next
|
||||||
* operation.
|
* operation.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Set<Integer> popMissingBlocks() {
|
public Set<Integer> popMissingBlocks() {
|
||||||
@ -2642,7 +2642,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the world.
|
* Get the world.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public LocalWorld getWorld() {
|
public LocalWorld getWorld() {
|
||||||
@ -2651,7 +2651,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of blocks changed, including repeated block changes.
|
* Get the number of blocks changed, including repeated block changes.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public int getBlockChangeCount() {
|
public int getBlockChangeCount() {
|
||||||
@ -2660,7 +2660,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the mask.
|
* Get the mask.
|
||||||
*
|
*
|
||||||
* @return mask, may be null
|
* @return mask, may be null
|
||||||
*/
|
*/
|
||||||
public Mask getMask() {
|
public Mask getMask() {
|
||||||
@ -2669,7 +2669,7 @@ public class EditSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a mask.
|
* Set a mask.
|
||||||
*
|
*
|
||||||
* @param mask mask or null
|
* @param mask mask or null
|
||||||
*/
|
*/
|
||||||
public void setMask(Mask mask) {
|
public void setMask(Mask mask) {
|
||||||
|
@ -36,16 +36,16 @@ public abstract class LocalPlayer {
|
|||||||
* Server.
|
* Server.
|
||||||
*/
|
*/
|
||||||
protected ServerInterface server;
|
protected ServerInterface server;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the object.
|
* Construct the object.
|
||||||
*
|
*
|
||||||
* @param server
|
* @param server
|
||||||
*/
|
*/
|
||||||
protected LocalPlayer(ServerInterface server) {
|
protected LocalPlayer(ServerInterface server) {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the player is holding a pick axe.
|
* Returns true if the player is holding a pick axe.
|
||||||
*
|
*
|
||||||
@ -95,10 +95,10 @@ public abstract class LocalPlayer {
|
|||||||
++y;
|
++y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the player on the ground.
|
* Set the player on the ground.
|
||||||
*
|
*
|
||||||
* @param searchPos
|
* @param searchPos
|
||||||
*/
|
*/
|
||||||
public void setOnGround(WorldVector searchPos) {
|
public void setOnGround(WorldVector searchPos) {
|
||||||
@ -153,7 +153,7 @@ public abstract class LocalPlayer {
|
|||||||
++spots;
|
++spots;
|
||||||
if (spots == 2) {
|
if (spots == 2) {
|
||||||
int type = world.getBlockType(new Vector(x, y - 2, z));
|
int type = world.getBlockType(new Vector(x, y - 2, z));
|
||||||
|
|
||||||
// Don't get put in lava!
|
// Don't get put in lava!
|
||||||
if (type == BlockID.LAVA || type == BlockID.STATIONARY_LAVA) {
|
if (type == BlockID.LAVA || type == BlockID.STATIONARY_LAVA) {
|
||||||
return false;
|
return false;
|
||||||
@ -204,7 +204,7 @@ public abstract class LocalPlayer {
|
|||||||
setPosition(new Vector(x + 0.5, y + 1, z + 0.5));
|
setPosition(new Vector(x + 0.5, y + 1, z + 0.5));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
--y;
|
--y;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,7 +219,7 @@ public abstract class LocalPlayer {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Ascend to the ceiling above.
|
* Ascend to the ceiling above.
|
||||||
*
|
*
|
||||||
* @param clearance
|
* @param clearance
|
||||||
* @return whether the player was moved
|
* @return whether the player was moved
|
||||||
*/
|
*/
|
||||||
@ -230,7 +230,7 @@ public abstract class LocalPlayer {
|
|||||||
int y = Math.max(0, pos.getBlockY() + 2);
|
int y = Math.max(0, pos.getBlockY() + 2);
|
||||||
int z = pos.getBlockZ();
|
int z = pos.getBlockZ();
|
||||||
LocalWorld world = getPosition().getWorld();
|
LocalWorld world = getPosition().getWorld();
|
||||||
|
|
||||||
// No free space above
|
// No free space above
|
||||||
if (world.getBlockType(new Vector(x, y, z)) != 0) {
|
if (world.getBlockType(new Vector(x, y, z)) != 0) {
|
||||||
return false;
|
return false;
|
||||||
@ -308,7 +308,7 @@ public abstract class LocalPlayer {
|
|||||||
/**
|
/**
|
||||||
* Get the point of the block being looked at. May return null.
|
* Get the point of the block being looked at. May return null.
|
||||||
* Will return the farthest away air block if useLastBlock is true and no other block is found.
|
* Will return the farthest away air block if useLastBlock is true and no other block is found.
|
||||||
*
|
*
|
||||||
* @param range
|
* @param range
|
||||||
* @param useLastBlock
|
* @param useLastBlock
|
||||||
* @return point
|
* @return point
|
||||||
@ -366,7 +366,7 @@ public abstract class LocalPlayer {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns direction according to rotation. May return null.
|
* Returns direction according to rotation. May return null.
|
||||||
*
|
*
|
||||||
* @param rot
|
* @param rot
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -468,38 +468,38 @@ public abstract class LocalPlayer {
|
|||||||
boolean firstBlock = true;
|
boolean firstBlock = true;
|
||||||
int freeToFind = 2;
|
int freeToFind = 2;
|
||||||
boolean inFree = false;
|
boolean inFree = false;
|
||||||
|
|
||||||
while ((block = hitBlox.getNextBlock()) != null) {
|
while ((block = hitBlox.getNextBlock()) != null) {
|
||||||
boolean free = BlockType.canPassThrough(world.getBlockType(block));
|
boolean free = BlockType.canPassThrough(world.getBlockType(block));
|
||||||
|
|
||||||
if (firstBlock) {
|
if (firstBlock) {
|
||||||
firstBlock = false;
|
firstBlock = false;
|
||||||
|
|
||||||
if (!free) {
|
if (!free) {
|
||||||
--freeToFind;
|
--freeToFind;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
++searchDist;
|
++searchDist;
|
||||||
if (searchDist > 20) {
|
if (searchDist > 20) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inFree != free) {
|
if (inFree != free) {
|
||||||
if (free) {
|
if (free) {
|
||||||
--freeToFind;
|
--freeToFind;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (freeToFind == 0) {
|
if (freeToFind == 0) {
|
||||||
setOnGround(block);
|
setOnGround(block);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
inFree = free;
|
inFree = free;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -551,29 +551,29 @@ public abstract class LocalPlayer {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a player's list of groups.
|
* Get a player's list of groups.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public abstract String[] getGroups();
|
public abstract String[] getGroups();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get this player's block bag.
|
* Get this player's block bag.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public abstract BlockBag getInventoryBlockBag();
|
public abstract BlockBag getInventoryBlockBag();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a player has permission.
|
* Checks if a player has permission.
|
||||||
*
|
*
|
||||||
* @param perm
|
* @param perm
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public abstract boolean hasPermission(String perm);
|
public abstract boolean hasPermission(String perm);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open a file open dialog.
|
* Open a file open dialog.
|
||||||
*
|
*
|
||||||
* @param extensions null to allow all
|
* @param extensions null to allow all
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -581,10 +581,10 @@ public abstract class LocalPlayer {
|
|||||||
printError("File dialogs are not supported in your environment.");
|
printError("File dialogs are not supported in your environment.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open a file save dialog.
|
* Open a file save dialog.
|
||||||
*
|
*
|
||||||
* @param extensions null to allow all
|
* @param extensions null to allow all
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -592,24 +592,24 @@ public abstract class LocalPlayer {
|
|||||||
printError("File dialogs are not supported in your environment.");
|
printError("File dialogs are not supported in your environment.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the player can destroy bedrock.
|
* Returns true if the player can destroy bedrock.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean canDestroyBedrock() {
|
public boolean canDestroyBedrock() {
|
||||||
return hasPermission("worldedit.override.bedrock");
|
return hasPermission("worldedit.override.bedrock");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a CUI event.
|
* Send a CUI event.
|
||||||
*
|
*
|
||||||
* @param event
|
* @param event
|
||||||
*/
|
*/
|
||||||
public void dispatchCUIEvent(CUIEvent event) {
|
public void dispatchCUIEvent(CUIEvent event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send the CUI handshake.
|
* Send the CUI handshake.
|
||||||
*/
|
*/
|
||||||
|
@ -52,9 +52,9 @@ import com.sk89q.worldedit.regions.RegionSelector;
|
|||||||
public class LocalSession {
|
public class LocalSession {
|
||||||
public static int MAX_HISTORY_SIZE = 15;
|
public static int MAX_HISTORY_SIZE = 15;
|
||||||
public static int EXPIRATION_GRACE = 600000;
|
public static int EXPIRATION_GRACE = 600000;
|
||||||
|
|
||||||
private LocalConfiguration config;
|
private LocalConfiguration config;
|
||||||
|
|
||||||
private long expirationTime = 0;
|
private long expirationTime = 0;
|
||||||
private LocalWorld selectionWorld;
|
private LocalWorld selectionWorld;
|
||||||
private RegionSelector selector = new CuboidRegionSelector();
|
private RegionSelector selector = new CuboidRegionSelector();
|
||||||
@ -79,16 +79,16 @@ public class LocalSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the object.
|
* Construct the object.
|
||||||
*
|
*
|
||||||
* @param config
|
* @param config
|
||||||
*/
|
*/
|
||||||
public LocalSession(LocalConfiguration config) {
|
public LocalSession(LocalConfiguration config) {
|
||||||
this.config = config;
|
this.config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the session's timezone.
|
* Get the session's timezone.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public TimeZone getTimeZone() {
|
public TimeZone getTimeZone() {
|
||||||
@ -97,8 +97,8 @@ public class LocalSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the session's timezone.
|
* Set the session's timezone.
|
||||||
*
|
*
|
||||||
* @param timezone
|
* @param timezone
|
||||||
*/
|
*/
|
||||||
public void setTimezone(TimeZone timezone) {
|
public void setTimezone(TimeZone timezone) {
|
||||||
this.timezone = timezone;
|
this.timezone = timezone;
|
||||||
@ -115,7 +115,7 @@ public class LocalSession {
|
|||||||
/**
|
/**
|
||||||
* Remember an edit session for the undo history. If the history maximum
|
* Remember an edit session for the undo history. If the history maximum
|
||||||
* size is reached, old edit sessions will be discarded.
|
* size is reached, old edit sessions will be discarded.
|
||||||
*
|
*
|
||||||
* @param editSession
|
* @param editSession
|
||||||
*/
|
*/
|
||||||
public void remember(EditSession editSession) {
|
public void remember(EditSession editSession) {
|
||||||
@ -179,8 +179,8 @@ public class LocalSession {
|
|||||||
/**
|
/**
|
||||||
* Get the region selector for defining the selection. If the selection
|
* Get the region selector for defining the selection. If the selection
|
||||||
* was defined for a different world, the old selection will be discarded.
|
* was defined for a different world, the old selection will be discarded.
|
||||||
*
|
*
|
||||||
* @param world
|
* @param world
|
||||||
* @return position
|
* @return position
|
||||||
*/
|
*/
|
||||||
public RegionSelector getRegionSelector(LocalWorld world) {
|
public RegionSelector getRegionSelector(LocalWorld world) {
|
||||||
@ -196,7 +196,7 @@ public class LocalSession {
|
|||||||
/**
|
/**
|
||||||
* Get the region selector. This won't check worlds so make sure that
|
* Get the region selector. This won't check worlds so make sure that
|
||||||
* this region selector isn't used blindly.
|
* this region selector isn't used blindly.
|
||||||
*
|
*
|
||||||
* @return position
|
* @return position
|
||||||
*/
|
*/
|
||||||
public RegionSelector getRegionSelector() {
|
public RegionSelector getRegionSelector() {
|
||||||
@ -205,7 +205,7 @@ public class LocalSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the region selector.
|
* Set the region selector.
|
||||||
*
|
*
|
||||||
* @param world
|
* @param world
|
||||||
* @param selector
|
* @param selector
|
||||||
*/
|
*/
|
||||||
@ -216,8 +216,8 @@ public class LocalSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the region is fully defined.
|
* Returns true if the region is fully defined.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean isRegionDefined() {
|
public boolean isRegionDefined() {
|
||||||
@ -226,9 +226,9 @@ public class LocalSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the region is fully defined for the specified world.
|
* Returns true if the region is fully defined for the specified world.
|
||||||
*
|
*
|
||||||
* @param world
|
* @param world
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean isSelectionDefined(LocalWorld world) {
|
public boolean isSelectionDefined(LocalWorld world) {
|
||||||
if (selectionWorld == null || !selectionWorld.equals(world)) {
|
if (selectionWorld == null || !selectionWorld.equals(world)) {
|
||||||
@ -239,7 +239,7 @@ public class LocalSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Use <code>getSelection()</code>.
|
* Use <code>getSelection()</code>.
|
||||||
*
|
*
|
||||||
* @return region
|
* @return region
|
||||||
* @throws IncompleteRegionException
|
* @throws IncompleteRegionException
|
||||||
*/
|
*/
|
||||||
@ -253,8 +253,8 @@ public class LocalSession {
|
|||||||
* call learnRegionChanges(). If the selection is defined in
|
* call learnRegionChanges(). If the selection is defined in
|
||||||
* a different world, the <code>IncompleteRegionException</code>
|
* a different world, the <code>IncompleteRegionException</code>
|
||||||
* exception will be thrown.
|
* exception will be thrown.
|
||||||
*
|
*
|
||||||
* @param world
|
* @param world
|
||||||
* @return region
|
* @return region
|
||||||
* @throws IncompleteRegionException
|
* @throws IncompleteRegionException
|
||||||
*/
|
*/
|
||||||
@ -264,10 +264,10 @@ public class LocalSession {
|
|||||||
}
|
}
|
||||||
return selector.getRegion();
|
return selector.getRegion();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the selection world.
|
* Get the selection world.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public LocalWorld getSelectionWorld() {
|
public LocalWorld getSelectionWorld() {
|
||||||
@ -276,7 +276,7 @@ public class LocalSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the clipboard.
|
* Gets the clipboard.
|
||||||
*
|
*
|
||||||
* @return clipboard, may be null
|
* @return clipboard, may be null
|
||||||
* @throws EmptyClipboardException
|
* @throws EmptyClipboardException
|
||||||
*/
|
*/
|
||||||
@ -289,7 +289,7 @@ public class LocalSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the clipboard.
|
* Sets the clipboard.
|
||||||
*
|
*
|
||||||
* @param clipboard
|
* @param clipboard
|
||||||
*/
|
*/
|
||||||
public void setClipboard(CuboidClipboard clipboard) {
|
public void setClipboard(CuboidClipboard clipboard) {
|
||||||
@ -298,7 +298,7 @@ public class LocalSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* See if tool control is enabled.
|
* See if tool control is enabled.
|
||||||
*
|
*
|
||||||
* @return true if enabled
|
* @return true if enabled
|
||||||
*/
|
*/
|
||||||
public boolean isToolControlEnabled() {
|
public boolean isToolControlEnabled() {
|
||||||
@ -307,7 +307,7 @@ public class LocalSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Change tool control setting.
|
* Change tool control setting.
|
||||||
*
|
*
|
||||||
* @param toolControl
|
* @param toolControl
|
||||||
*/
|
*/
|
||||||
public void setToolControl(boolean toolControl) {
|
public void setToolControl(boolean toolControl) {
|
||||||
@ -325,7 +325,7 @@ public class LocalSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the maximum number of blocks that can be changed.
|
* Set the maximum number of blocks that can be changed.
|
||||||
*
|
*
|
||||||
* @param maxBlocksChanged
|
* @param maxBlocksChanged
|
||||||
*/
|
*/
|
||||||
public void setBlockChangeLimit(int maxBlocksChanged) {
|
public void setBlockChangeLimit(int maxBlocksChanged) {
|
||||||
@ -334,7 +334,7 @@ public class LocalSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether the super pick axe is enabled.
|
* Checks whether the super pick axe is enabled.
|
||||||
*
|
*
|
||||||
* @return status
|
* @return status
|
||||||
*/
|
*/
|
||||||
public boolean hasSuperPickAxe() {
|
public boolean hasSuperPickAxe() {
|
||||||
@ -367,8 +367,8 @@ public class LocalSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the placement position.
|
* Get the placement position.
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* @return position
|
* @return position
|
||||||
* @throws IncompleteRegionException
|
* @throws IncompleteRegionException
|
||||||
*/
|
*/
|
||||||
@ -383,17 +383,17 @@ public class LocalSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggle placement position.
|
* Toggle placement position.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean togglePlacementPosition() {
|
public boolean togglePlacementPosition() {
|
||||||
placeAtPos1 = !placeAtPos1;
|
placeAtPos1 = !placeAtPos1;
|
||||||
return placeAtPos1;
|
return placeAtPos1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a block bag for a player.
|
* Get a block bag for a player.
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -406,7 +406,7 @@ public class LocalSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the snapshot that has been selected.
|
* Get the snapshot that has been selected.
|
||||||
*
|
*
|
||||||
* @return the snapshot
|
* @return the snapshot
|
||||||
*/
|
*/
|
||||||
public Snapshot getSnapshot() {
|
public Snapshot getSnapshot() {
|
||||||
@ -415,7 +415,7 @@ public class LocalSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Select a snapshot.
|
* Select a snapshot.
|
||||||
*
|
*
|
||||||
* @param snapshot
|
* @param snapshot
|
||||||
*/
|
*/
|
||||||
public void setSnapshot(Snapshot snapshot) {
|
public void setSnapshot(Snapshot snapshot) {
|
||||||
@ -431,7 +431,7 @@ public class LocalSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the super pickaxe tool.
|
* Set the super pickaxe tool.
|
||||||
*
|
*
|
||||||
* @param tool
|
* @param tool
|
||||||
*/
|
*/
|
||||||
public void setSuperPickaxe(BlockTool tool) {
|
public void setSuperPickaxe(BlockTool tool) {
|
||||||
@ -440,8 +440,8 @@ public class LocalSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the tool assigned to the item.
|
* Get the tool assigned to the item.
|
||||||
*
|
*
|
||||||
* @param item
|
* @param item
|
||||||
* @return the tool
|
* @return the tool
|
||||||
*/
|
*/
|
||||||
public Tool getTool(int item) {
|
public Tool getTool(int item) {
|
||||||
@ -452,28 +452,28 @@ public class LocalSession {
|
|||||||
* Get the brush tool assigned to the item. If there is no tool assigned
|
* Get the brush tool assigned to the item. If there is no tool assigned
|
||||||
* or the tool is not assigned, the slot will be replaced with the
|
* or the tool is not assigned, the slot will be replaced with the
|
||||||
* brush tool.
|
* brush tool.
|
||||||
*
|
*
|
||||||
* @param item
|
* @param item
|
||||||
* @return the tool
|
* @return the tool
|
||||||
* @throws InvalidToolBindException
|
* @throws InvalidToolBindException
|
||||||
*/
|
*/
|
||||||
public BrushTool getBrushTool(int item) throws InvalidToolBindException {
|
public BrushTool getBrushTool(int item) throws InvalidToolBindException {
|
||||||
Tool tool = getTool(item);
|
Tool tool = getTool(item);
|
||||||
|
|
||||||
if (tool == null || !(tool instanceof BrushTool)) {
|
if (tool == null || !(tool instanceof BrushTool)) {
|
||||||
tool = new BrushTool("worldedit.brush.sphere");
|
tool = new BrushTool("worldedit.brush.sphere");
|
||||||
setTool(item, tool);
|
setTool(item, tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (BrushTool)tool;
|
return (BrushTool)tool;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the tool.
|
* Set the tool.
|
||||||
*
|
*
|
||||||
* @param item
|
* @param item
|
||||||
* @param tool the tool to set
|
* @param tool the tool to set
|
||||||
* @throws InvalidToolBindException
|
* @throws InvalidToolBindException
|
||||||
*/
|
*/
|
||||||
public void setTool(int item, Tool tool) throws InvalidToolBindException {
|
public void setTool(int item, Tool tool) throws InvalidToolBindException {
|
||||||
if (item > 0 && item < 255) {
|
if (item > 0 && item < 255) {
|
||||||
@ -483,13 +483,13 @@ public class LocalSession {
|
|||||||
} else if (item == config.navigationWand) {
|
} else if (item == config.navigationWand) {
|
||||||
throw new InvalidToolBindException(item, "Already used for the navigation wand");
|
throw new InvalidToolBindException(item, "Already used for the navigation wand");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.tools.put(item, tool);
|
this.tools.put(item, tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether inventory usage is enabled for this session.
|
* Returns whether inventory usage is enabled for this session.
|
||||||
*
|
*
|
||||||
* @return the useInventory
|
* @return the useInventory
|
||||||
*/
|
*/
|
||||||
public boolean isUsingInventory() {
|
public boolean isUsingInventory() {
|
||||||
@ -498,7 +498,7 @@ public class LocalSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the state of inventory usage.
|
* Set the state of inventory usage.
|
||||||
*
|
*
|
||||||
* @param useInventory the useInventory to set
|
* @param useInventory the useInventory to set
|
||||||
*/
|
*/
|
||||||
public void setUseInventory(boolean useInventory) {
|
public void setUseInventory(boolean useInventory) {
|
||||||
@ -507,7 +507,7 @@ public class LocalSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the last script used.
|
* Get the last script used.
|
||||||
*
|
*
|
||||||
* @return the lastScript
|
* @return the lastScript
|
||||||
*/
|
*/
|
||||||
public String getLastScript() {
|
public String getLastScript() {
|
||||||
@ -516,17 +516,17 @@ public class LocalSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the last script used.
|
* Set the last script used.
|
||||||
*
|
*
|
||||||
* @param lastScript the lastScript to set
|
* @param lastScript the lastScript to set
|
||||||
*/
|
*/
|
||||||
public void setLastScript(String lastScript) {
|
public void setLastScript(String lastScript) {
|
||||||
this.lastScript = lastScript;
|
this.lastScript = lastScript;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tell the player the WorldEdit version.
|
* Tell the player the WorldEdit version.
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
*/
|
*/
|
||||||
public void tellVersion(LocalPlayer player) {
|
public void tellVersion(LocalPlayer player) {
|
||||||
if (config.showFirstUseVersion) {
|
if (config.showFirstUseVersion) {
|
||||||
@ -537,10 +537,10 @@ public class LocalSession {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispatch a CUI event but only if the player has CUI support.
|
* Dispatch a CUI event but only if the player has CUI support.
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* @param event
|
* @param event
|
||||||
*/
|
*/
|
||||||
@ -549,10 +549,10 @@ public class LocalSession {
|
|||||||
player.dispatchCUIEvent(event);
|
player.dispatchCUIEvent(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispatch the initial setup CUI messages.
|
* Dispatch the initial setup CUI messages.
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
*/
|
*/
|
||||||
public void dispatchCUISetup(LocalPlayer player) {
|
public void dispatchCUISetup(LocalPlayer player) {
|
||||||
@ -560,45 +560,45 @@ public class LocalSession {
|
|||||||
dispatchCUISelection(player);
|
dispatchCUISelection(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send the selection information.
|
* Send the selection information.
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
*/
|
*/
|
||||||
public void dispatchCUISelection(LocalPlayer player) {
|
public void dispatchCUISelection(LocalPlayer player) {
|
||||||
if (!hasCUISupport) {
|
if (!hasCUISupport) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.dispatchCUIEvent(new SelectionShapeEvent(selector.getTypeId()));
|
player.dispatchCUIEvent(new SelectionShapeEvent(selector.getTypeId()));
|
||||||
|
|
||||||
if (selector instanceof CUIPointBasedRegion) {
|
if (selector instanceof CUIPointBasedRegion) {
|
||||||
((CUIPointBasedRegion) selector).describeCUI(player);
|
((CUIPointBasedRegion) selector).describeCUI(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the status of CUI support.
|
* Gets the status of CUI support.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean hasCUISupport() {
|
public boolean hasCUISupport() {
|
||||||
return hasCUISupport;
|
return hasCUISupport;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the status of CUI support.
|
* Sets the status of CUI support.
|
||||||
*
|
*
|
||||||
* @param support
|
* @param support
|
||||||
*/
|
*/
|
||||||
public void setCUISupport(boolean support) {
|
public void setCUISupport(boolean support) {
|
||||||
hasCUISupport = true;
|
hasCUISupport = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detect date from a user's input.
|
* Detect date from a user's input.
|
||||||
*
|
*
|
||||||
* @param input
|
* @param input
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -613,45 +613,45 @@ public class LocalSession {
|
|||||||
return date.getBeginCalendar();
|
return date.getBeginCalendar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the last update time for calculating expiration.
|
* Update the last update time for calculating expiration.
|
||||||
*/
|
*/
|
||||||
public void update() {
|
public void update() {
|
||||||
expirationTime = System.currentTimeMillis();
|
expirationTime = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether this session has expired.
|
* Returns whether this session has expired.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean hasExpired() {
|
public boolean hasExpired() {
|
||||||
return System.currentTimeMillis() - expirationTime > EXPIRATION_GRACE;
|
return System.currentTimeMillis() - expirationTime > EXPIRATION_GRACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new edit session.
|
* Construct a new edit session.
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public EditSession createEditSession(LocalPlayer player) {
|
public EditSession createEditSession(LocalPlayer player) {
|
||||||
BlockBag blockBag = getBlockBag(player);
|
BlockBag blockBag = getBlockBag(player);
|
||||||
|
|
||||||
// Create an edit session
|
// Create an edit session
|
||||||
EditSession editSession =
|
EditSession editSession =
|
||||||
new EditSession(player.getWorld(),
|
new EditSession(player.getWorld(),
|
||||||
getBlockChangeLimit(), blockBag);
|
getBlockChangeLimit(), blockBag);
|
||||||
editSession.setFastMode(fastMode);
|
editSession.setFastMode(fastMode);
|
||||||
editSession.setMask(mask);
|
editSession.setMask(mask);
|
||||||
|
|
||||||
return editSession;
|
return editSession;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the session has fast mode enabled.
|
* Checks if the session has fast mode enabled.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean hasFastMode() {
|
public boolean hasFastMode() {
|
||||||
@ -660,7 +660,7 @@ public class LocalSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set fast mode.
|
* Set fast mode.
|
||||||
*
|
*
|
||||||
* @param fastMode
|
* @param fastMode
|
||||||
*/
|
*/
|
||||||
public void setFastMode(boolean fastMode) {
|
public void setFastMode(boolean fastMode) {
|
||||||
@ -669,7 +669,7 @@ public class LocalSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the mask.
|
* Get the mask.
|
||||||
*
|
*
|
||||||
* @return mask, may be null
|
* @return mask, may be null
|
||||||
*/
|
*/
|
||||||
public Mask getMask() {
|
public Mask getMask() {
|
||||||
@ -678,7 +678,7 @@ public class LocalSession {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a mask.
|
* Set a mask.
|
||||||
*
|
*
|
||||||
* @param mask mask or null
|
* @param mask mask or null
|
||||||
*/
|
*/
|
||||||
public void setMask(Mask mask) {
|
public void setMask(Mask mask) {
|
||||||
|
@ -59,7 +59,7 @@ public class LogFormat extends Formatter {
|
|||||||
t.printStackTrace(new PrintWriter(writer));
|
t.printStackTrace(new PrintWriter(writer));
|
||||||
text.append(writer.toString());
|
text.append(writer.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
return text.toString();
|
return text.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ package com.sk89q.worldedit;
|
|||||||
*/
|
*/
|
||||||
public class MaxChangedBlocksException extends WorldEditException {
|
public class MaxChangedBlocksException extends WorldEditException {
|
||||||
private static final long serialVersionUID = -2621044030640945259L;
|
private static final long serialVersionUID = -2621044030640945259L;
|
||||||
|
|
||||||
int maxBlocks;
|
int maxBlocks;
|
||||||
|
|
||||||
public MaxChangedBlocksException(int maxBlocks) {
|
public MaxChangedBlocksException(int maxBlocks) {
|
||||||
|
@ -20,26 +20,26 @@
|
|||||||
package com.sk89q.worldedit;
|
package com.sk89q.worldedit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author sk89q
|
* @author sk89q
|
||||||
*/
|
*/
|
||||||
public abstract class ServerInterface {
|
public abstract class ServerInterface {
|
||||||
/**
|
/**
|
||||||
* Resolves an item name to its ID.
|
* Resolves an item name to its ID.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public abstract int resolveItem(String name);
|
public abstract int resolveItem(String name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a mob type is valid.
|
* Checks if a mob type is valid.
|
||||||
*
|
*
|
||||||
* @param type
|
* @param type
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public abstract boolean isValidMobType(String type);
|
public abstract boolean isValidMobType(String type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reload WorldEdit configuration.
|
* Reload WorldEdit configuration.
|
||||||
*/
|
*/
|
||||||
|
@ -25,9 +25,9 @@ package com.sk89q.worldedit;
|
|||||||
*/
|
*/
|
||||||
public class UnknownDirectionException extends WorldEditException {
|
public class UnknownDirectionException extends WorldEditException {
|
||||||
private static final long serialVersionUID = 5705931351293248358L;
|
private static final long serialVersionUID = 5705931351293248358L;
|
||||||
|
|
||||||
private String dir;
|
private String dir;
|
||||||
|
|
||||||
public UnknownDirectionException(String dir) {
|
public UnknownDirectionException(String dir) {
|
||||||
this.dir = dir;
|
this.dir = dir;
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ package com.sk89q.worldedit;
|
|||||||
*/
|
*/
|
||||||
public class UnknownItemException extends WorldEditException {
|
public class UnknownItemException extends WorldEditException {
|
||||||
private static final long serialVersionUID = 2661079183700565880L;
|
private static final long serialVersionUID = 2661079183700565880L;
|
||||||
|
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
public UnknownItemException(String type) {
|
public UnknownItemException(String type) {
|
||||||
|
@ -506,7 +506,7 @@ public class Vector {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Clamp the Y component.
|
* Clamp the Y component.
|
||||||
*
|
*
|
||||||
* @param min
|
* @param min
|
||||||
* @param max
|
* @param max
|
||||||
* @return
|
* @return
|
||||||
@ -517,7 +517,7 @@ public class Vector {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 2D transformation.
|
* 2D transformation.
|
||||||
*
|
*
|
||||||
* @param angle in degrees
|
* @param angle in degrees
|
||||||
* @param aboutX
|
* @param aboutX
|
||||||
* @param aboutZ
|
* @param aboutZ
|
||||||
@ -539,7 +539,7 @@ public class Vector {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a block point from a point.
|
* Get a block point from a point.
|
||||||
*
|
*
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
* @param z
|
* @param z
|
||||||
@ -553,7 +553,7 @@ public class Vector {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a block point from a point.
|
* Get a block point from a point.
|
||||||
*
|
*
|
||||||
* @return point
|
* @return point
|
||||||
*/
|
*/
|
||||||
public BlockVector toBlockPoint() {
|
public BlockVector toBlockPoint() {
|
||||||
@ -564,7 +564,7 @@ public class Vector {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if another object is equivalent.
|
* Checks if another object is equivalent.
|
||||||
*
|
*
|
||||||
* @param obj
|
* @param obj
|
||||||
* @return whether the other object is equivalent
|
* @return whether the other object is equivalent
|
||||||
*/
|
*/
|
||||||
@ -580,7 +580,7 @@ public class Vector {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the hash code.
|
* Gets the hash code.
|
||||||
*
|
*
|
||||||
* @return hash code
|
* @return hash code
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@ -602,16 +602,16 @@ public class Vector {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a BlockVector version.
|
* Gets a BlockVector version.
|
||||||
*
|
*
|
||||||
* @return BlockVector
|
* @return BlockVector
|
||||||
*/
|
*/
|
||||||
public BlockVector toBlockVector() {
|
public BlockVector toBlockVector() {
|
||||||
return new BlockVector(this);
|
return new BlockVector(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the minimum components of two vectors.
|
* Gets the minimum components of two vectors.
|
||||||
*
|
*
|
||||||
* @param v1
|
* @param v1
|
||||||
* @param v2
|
* @param v2
|
||||||
* @return minimum
|
* @return minimum
|
||||||
@ -622,10 +622,10 @@ public class Vector {
|
|||||||
Math.min(v1.getY(), v2.getY()),
|
Math.min(v1.getY(), v2.getY()),
|
||||||
Math.min(v1.getZ(), v2.getZ()));
|
Math.min(v1.getZ(), v2.getZ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the maximum components of two vectors.
|
* Gets the maximum components of two vectors.
|
||||||
*
|
*
|
||||||
* @param v1
|
* @param v1
|
||||||
* @param v2
|
* @param v2
|
||||||
* @return maximum
|
* @return maximum
|
||||||
|
@ -147,7 +147,7 @@ public class Vector2D {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a BlockVector version.
|
* Gets a BlockVector version.
|
||||||
*
|
*
|
||||||
* @return BlockVector
|
* @return BlockVector
|
||||||
*/
|
*/
|
||||||
public BlockVector2D toBlockVector2D() {
|
public BlockVector2D toBlockVector2D() {
|
||||||
|
@ -57,7 +57,7 @@ public class WorldVector2D extends Vector2D {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if another object is equivalent.
|
* Checks if another object is equivalent.
|
||||||
*
|
*
|
||||||
* @param obj
|
* @param obj
|
||||||
* @return whether the other object is equivalent
|
* @return whether the other object is equivalent
|
||||||
*/
|
*/
|
||||||
@ -74,7 +74,7 @@ public class WorldVector2D extends Vector2D {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the hash code.
|
* Gets the hash code.
|
||||||
*
|
*
|
||||||
* @return hash code
|
* @return hash code
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -50,7 +50,7 @@ public class BaseBlock {
|
|||||||
* Construct the block with its type and data.
|
* Construct the block with its type and data.
|
||||||
*
|
*
|
||||||
* @param type
|
* @param type
|
||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
public BaseBlock(int type, int data) {
|
public BaseBlock(int type, int data) {
|
||||||
this.type = (short) type;
|
this.type = (short) type;
|
||||||
@ -93,21 +93,21 @@ public class BaseBlock {
|
|||||||
public boolean isAir() {
|
public boolean isAir() {
|
||||||
return type == 0;
|
return type == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rotate this block 90 degrees.
|
* Rotate this block 90 degrees.
|
||||||
*/
|
*/
|
||||||
public void rotate90() {
|
public void rotate90() {
|
||||||
data = (byte) BlockData.rotate90(type, data);
|
data = (byte) BlockData.rotate90(type, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rotate this block -90 degrees.
|
* Rotate this block -90 degrees.
|
||||||
*/
|
*/
|
||||||
public void rotate90Reverse() {
|
public void rotate90Reverse() {
|
||||||
data = (byte) BlockData.rotate90Reverse(type, data);
|
data = (byte) BlockData.rotate90Reverse(type, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flip this block.
|
* Flip this block.
|
||||||
*/
|
*/
|
||||||
@ -132,7 +132,7 @@ public class BaseBlock {
|
|||||||
return (type == ((BaseBlock) o).type)
|
return (type == ((BaseBlock) o).type)
|
||||||
&& (data == ((BaseBlock) o).data || data == -1 || ((BaseBlock) o).data == -1);
|
&& (data == ((BaseBlock) o).data || data == -1 || ((BaseBlock) o).data == -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "BaseBlock id: " + getType() + " with damage: " + getData();
|
return "BaseBlock id: " + getType() + " with damage: " + getData();
|
||||||
|
@ -21,7 +21,7 @@ package com.sk89q.worldedit.blocks;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an item.
|
* Represents an item.
|
||||||
*
|
*
|
||||||
* @author sk89q
|
* @author sk89q
|
||||||
*/
|
*/
|
||||||
public class BaseItem {
|
public class BaseItem {
|
||||||
@ -48,7 +48,7 @@ public class BaseItem {
|
|||||||
* Construct the object.
|
* Construct the object.
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @param damage
|
* @param damage
|
||||||
*/
|
*/
|
||||||
public BaseItem(int id, short damage) {
|
public BaseItem(int id, short damage) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
@ -222,32 +222,32 @@ public enum BlockType {
|
|||||||
*/
|
*/
|
||||||
public static BlockType lookup(String name, boolean fuzzy) {
|
public static BlockType lookup(String name, boolean fuzzy) {
|
||||||
String testName = name.replace(" ", "").toLowerCase();
|
String testName = name.replace(" ", "").toLowerCase();
|
||||||
|
|
||||||
BlockType type = lookup.get(testName);
|
BlockType type = lookup.get(testName);
|
||||||
|
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fuzzy) {
|
if (!fuzzy) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
int minDist = -1;
|
int minDist = -1;
|
||||||
|
|
||||||
for (Entry<String, BlockType> entry : lookup.entrySet()) {
|
for (Entry<String, BlockType> entry : lookup.entrySet()) {
|
||||||
if (entry.getKey().charAt(0) != testName.charAt(0)) {
|
if (entry.getKey().charAt(0) != testName.charAt(0)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dist = StringUtil.getLevenshteinDistance(entry.getKey(), testName);
|
int dist = StringUtil.getLevenshteinDistance(entry.getKey(), testName);
|
||||||
|
|
||||||
if ((dist < minDist || minDist == -1) && dist < 2) {
|
if ((dist < minDist || minDist == -1) && dist < 2) {
|
||||||
minDist = dist;
|
minDist = dist;
|
||||||
type = entry.getValue();
|
type = entry.getValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,7 +315,7 @@ public enum BlockType {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks to see whether a block should be placed last.
|
* Checks to see whether a block should be placed last.
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -449,7 +449,7 @@ public enum BlockType {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the block uses its data value.
|
* Returns true if the block uses its data value.
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -470,7 +470,7 @@ public enum BlockType {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the block is a container block.
|
* Returns true if the block is a container block.
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -726,7 +726,7 @@ public enum BlockType {
|
|||||||
* Get the block or item that would have been dropped. If nothing is
|
* Get the block or item that would have been dropped. If nothing is
|
||||||
* dropped, 0 will be returned. If the block should not be destroyed
|
* dropped, 0 will be returned. If the block should not be destroyed
|
||||||
* (i.e. bedrock), -1 will be returned.
|
* (i.e. bedrock), -1 will be returned.
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
* @deprecated This function ignores the data value.
|
* @deprecated This function ignores the data value.
|
||||||
@ -739,7 +739,7 @@ public enum BlockType {
|
|||||||
}
|
}
|
||||||
return dropped;
|
return dropped;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Random random = new Random();
|
private static final Random random = new Random();
|
||||||
public static BaseItemStack getBlockDrop(int id, short data) {
|
public static BaseItemStack getBlockDrop(int id, short data) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
|
@ -84,7 +84,7 @@ public class ChestBlock extends BaseBlock implements TileEntityBlock, ContainerB
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the tile entity ID.
|
* Get the tile entity ID.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String getTileEntityID() {
|
public String getTileEntityID() {
|
||||||
|
@ -89,8 +89,8 @@ public class MobSpawnerBlock extends BaseBlock implements TileEntityBlock {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the mob type.
|
* Set the mob type.
|
||||||
*
|
*
|
||||||
* @param mobType
|
* @param mobType
|
||||||
*/
|
*/
|
||||||
public void setMobType(String mobType) {
|
public void setMobType(String mobType) {
|
||||||
this.mobType = mobType;
|
this.mobType = mobType;
|
||||||
|
@ -36,9 +36,9 @@ public class SignBlock extends BaseBlock implements TileEntityBlock {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the sign without text.
|
* Construct the sign without text.
|
||||||
*
|
*
|
||||||
* @param type
|
* @param type
|
||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
public SignBlock(int type, int data) {
|
public SignBlock(int type, int data) {
|
||||||
super(type, data);
|
super(type, data);
|
||||||
@ -47,10 +47,10 @@ public class SignBlock extends BaseBlock implements TileEntityBlock {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the sign with text.
|
* Construct the sign with text.
|
||||||
*
|
*
|
||||||
* @param type
|
* @param type
|
||||||
* @param data
|
* @param data
|
||||||
* @param text
|
* @param text
|
||||||
*/
|
*/
|
||||||
public SignBlock(int type, int data, String[] text) {
|
public SignBlock(int type, int data, String[] text) {
|
||||||
super(type, data);
|
super(type, data);
|
||||||
@ -79,7 +79,7 @@ public class SignBlock extends BaseBlock implements TileEntityBlock {
|
|||||||
public String getTileEntityID() {
|
public String getTileEntityID() {
|
||||||
return "Sign";
|
return "Sign";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Store additional tile entity data. Returns true if the data is used.
|
* Store additional tile entity data. Returns true if the data is used.
|
||||||
*
|
*
|
||||||
@ -107,7 +107,7 @@ public class SignBlock extends BaseBlock implements TileEntityBlock {
|
|||||||
if (values == null) {
|
if (values == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Tag t;
|
Tag t;
|
||||||
|
|
||||||
text = new String[]{ "", "", "", "" };
|
text = new String[]{ "", "", "", "" };
|
||||||
|
@ -31,7 +31,7 @@ import java.util.Map;
|
|||||||
public interface TileEntityBlock {
|
public interface TileEntityBlock {
|
||||||
/**
|
/**
|
||||||
* Return the name of the title entity ID.
|
* Return the name of the title entity ID.
|
||||||
*
|
*
|
||||||
* @return title entity ID
|
* @return title entity ID
|
||||||
*/
|
*/
|
||||||
public String getTileEntityID();
|
public String getTileEntityID();
|
||||||
@ -45,7 +45,7 @@ public interface TileEntityBlock {
|
|||||||
throws DataException;
|
throws DataException;
|
||||||
/**
|
/**
|
||||||
* Get additional information from the title entity data.
|
* Get additional information from the title entity data.
|
||||||
*
|
*
|
||||||
* @param values
|
* @param values
|
||||||
* @throws DataException
|
* @throws DataException
|
||||||
*/
|
*/
|
||||||
|
@ -42,9 +42,9 @@ public class Chunk {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the chunk with a compound tag.
|
* Construct the chunk with a compound tag.
|
||||||
*
|
*
|
||||||
* @param tag
|
* @param tag
|
||||||
* @throws DataException
|
* @throws DataException
|
||||||
*/
|
*/
|
||||||
public Chunk(CompoundTag tag) throws DataException {
|
public Chunk(CompoundTag tag) throws DataException {
|
||||||
rootTag = tag;
|
rootTag = tag;
|
||||||
@ -117,7 +117,7 @@ public class Chunk {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to load the tile entities.
|
* Used to load the tile entities.
|
||||||
*
|
*
|
||||||
* @throws DataException
|
* @throws DataException
|
||||||
*/
|
*/
|
||||||
private void populateTileEntities() throws DataException {
|
private void populateTileEntities() throws DataException {
|
||||||
@ -131,7 +131,7 @@ public class Chunk {
|
|||||||
if (!(tag instanceof CompoundTag)) {
|
if (!(tag instanceof CompoundTag)) {
|
||||||
throw new InvalidFormatException("CompoundTag expected in TileEntities");
|
throw new InvalidFormatException("CompoundTag expected in TileEntities");
|
||||||
}
|
}
|
||||||
|
|
||||||
CompoundTag t = (CompoundTag)tag;
|
CompoundTag t = (CompoundTag)tag;
|
||||||
|
|
||||||
int x = 0;
|
int x = 0;
|
||||||
@ -167,7 +167,7 @@ public class Chunk {
|
|||||||
* Get the map of tags keyed to strings for a block's tile entity data. May
|
* Get the map of tags keyed to strings for a block's tile entity data. May
|
||||||
* return null if there is no tile entity data. Not public yet because
|
* return null if there is no tile entity data. Not public yet because
|
||||||
* what this function returns isn't ideal for usage.
|
* what this function returns isn't ideal for usage.
|
||||||
*
|
*
|
||||||
* @param pos
|
* @param pos
|
||||||
* @return
|
* @return
|
||||||
* @throws DataException
|
* @throws DataException
|
||||||
@ -206,7 +206,7 @@ public class Chunk {
|
|||||||
} else {
|
} else {
|
||||||
block = new BaseBlock(id, data);
|
block = new BaseBlock(id, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block instanceof TileEntityBlock) {
|
if (block instanceof TileEntityBlock) {
|
||||||
Map<String,Tag> tileEntity = getBlockTileEntity(pos);
|
Map<String,Tag> tileEntity = getBlockTileEntity(pos);
|
||||||
((TileEntityBlock)block).fromTileEntityNBT(tileEntity);
|
((TileEntityBlock)block).fromTileEntityNBT(tileEntity);
|
||||||
|
@ -31,7 +31,7 @@ import com.sk89q.worldedit.*;
|
|||||||
public abstract class ChunkStore {
|
public abstract class ChunkStore {
|
||||||
/**
|
/**
|
||||||
* Convert a position to a chunk.
|
* Convert a position to a chunk.
|
||||||
*
|
*
|
||||||
* @param pos
|
* @param pos
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -75,10 +75,10 @@ public abstract class ChunkStore {
|
|||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the chunk store is of this type.
|
* Returns whether the chunk store is of this type.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public abstract boolean isValid();
|
public abstract boolean isValid();
|
||||||
|
@ -30,7 +30,7 @@ public class DataException extends Exception {
|
|||||||
public DataException(String msg) {
|
public DataException(String msg) {
|
||||||
super(msg);
|
super(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataException() {
|
public DataException() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ public class FileLegacyChunkStore extends LegacyChunkStore {
|
|||||||
/**
|
/**
|
||||||
* Create an instance. The passed path is the folder to read the
|
* Create an instance. The passed path is the folder to read the
|
||||||
* chunk files from.
|
* chunk files from.
|
||||||
*
|
*
|
||||||
* @param path
|
* @param path
|
||||||
*/
|
*/
|
||||||
public FileLegacyChunkStore(File path) {
|
public FileLegacyChunkStore(File path) {
|
||||||
|
@ -37,7 +37,7 @@ import java.util.zip.GZIPInputStream;
|
|||||||
public abstract class LegacyChunkStore extends ChunkStore {
|
public abstract class LegacyChunkStore extends ChunkStore {
|
||||||
/**
|
/**
|
||||||
* Get the filename of a chunk.
|
* Get the filename of a chunk.
|
||||||
*
|
*
|
||||||
* @param pos
|
* @param pos
|
||||||
* @param separator
|
* @param separator
|
||||||
* @return
|
* @return
|
||||||
@ -45,7 +45,7 @@ public abstract class LegacyChunkStore extends ChunkStore {
|
|||||||
public static String getFilename(Vector2D pos, String separator) {
|
public static String getFilename(Vector2D pos, String separator) {
|
||||||
int x = pos.getBlockX();
|
int x = pos.getBlockX();
|
||||||
int z = pos.getBlockZ();
|
int z = pos.getBlockZ();
|
||||||
|
|
||||||
String folder1 = Integer.toString(divisorMod(x, 64), 36);
|
String folder1 = Integer.toString(divisorMod(x, 64), 36);
|
||||||
String folder2 = Integer.toString(divisorMod(z, 64), 36);
|
String folder2 = Integer.toString(divisorMod(z, 64), 36);
|
||||||
String filename = "c." + Integer.toString(x, 36)
|
String filename = "c." + Integer.toString(x, 36)
|
||||||
@ -57,7 +57,7 @@ public abstract class LegacyChunkStore extends ChunkStore {
|
|||||||
/**
|
/**
|
||||||
* Get the filename of a chunk, using the system's default path
|
* Get the filename of a chunk, using the system's default path
|
||||||
* separator.
|
* separator.
|
||||||
*
|
*
|
||||||
* @param pos
|
* @param pos
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -78,7 +78,7 @@ public abstract class LegacyChunkStore extends ChunkStore {
|
|||||||
throws DataException, IOException {
|
throws DataException, IOException {
|
||||||
int x = pos.getBlockX();
|
int x = pos.getBlockX();
|
||||||
int z = pos.getBlockZ();
|
int z = pos.getBlockZ();
|
||||||
|
|
||||||
String folder1 = Integer.toString(divisorMod(x, 64), 36);
|
String folder1 = Integer.toString(divisorMod(x, 64), 36);
|
||||||
String folder2 = Integer.toString(divisorMod(z, 64), 36);
|
String folder2 = Integer.toString(divisorMod(z, 64), 36);
|
||||||
String filename = "c." + Integer.toString(x, 36)
|
String filename = "c." + Integer.toString(x, 36)
|
||||||
@ -135,7 +135,7 @@ public abstract class LegacyChunkStore extends ChunkStore {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the input stream for a chunk file.
|
* Get the input stream for a chunk file.
|
||||||
*
|
*
|
||||||
* @param f1
|
* @param f1
|
||||||
* @param f2
|
* @param f2
|
||||||
* @param name
|
* @param name
|
||||||
|
@ -27,7 +27,7 @@ import com.sk89q.worldedit.Vector2D;
|
|||||||
*/
|
*/
|
||||||
public class MissingChunkException extends ChunkStoreException {
|
public class MissingChunkException extends ChunkStoreException {
|
||||||
private static final long serialVersionUID = 8013715483709973489L;
|
private static final long serialVersionUID = 8013715483709973489L;
|
||||||
|
|
||||||
private Vector2D pos;
|
private Vector2D pos;
|
||||||
|
|
||||||
public MissingChunkException() {
|
public MissingChunkException() {
|
||||||
@ -41,7 +41,7 @@ public class MissingChunkException extends ChunkStoreException {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get chunk position in question. May be null if unknown.
|
* Get chunk position in question. May be null if unknown.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Vector2D getChunkPosition() {
|
public Vector2D getChunkPosition() {
|
||||||
|
@ -26,7 +26,7 @@ package com.sk89q.worldedit.data;
|
|||||||
public class MissingWorldException extends ChunkStoreException {
|
public class MissingWorldException extends ChunkStoreException {
|
||||||
|
|
||||||
private static final long serialVersionUID = 6487395784195658467L;
|
private static final long serialVersionUID = 6487395784195658467L;
|
||||||
|
|
||||||
private String worldname;
|
private String worldname;
|
||||||
|
|
||||||
public MissingWorldException() {
|
public MissingWorldException() {
|
||||||
@ -36,7 +36,7 @@ public class MissingWorldException extends ChunkStoreException {
|
|||||||
public MissingWorldException(String worldname) {
|
public MissingWorldException(String worldname) {
|
||||||
super();
|
super();
|
||||||
this.worldname = worldname;
|
this.worldname = worldname;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MissingWorldException(String msg, String worldname) {
|
public MissingWorldException(String msg, String worldname) {
|
||||||
super(msg);
|
super(msg);
|
||||||
@ -45,7 +45,7 @@ public class MissingWorldException extends ChunkStoreException {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get name of the world in question. May be null if unknown.
|
* Get name of the world in question. May be null if unknown.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String getWorldname() {
|
public String getWorldname() {
|
||||||
|
@ -54,13 +54,13 @@ public class TrueZipLegacyChunkStore extends LegacyChunkStore {
|
|||||||
* @param zipFile
|
* @param zipFile
|
||||||
* @param folder
|
* @param folder
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws ZipException
|
* @throws ZipException
|
||||||
*/
|
*/
|
||||||
public TrueZipLegacyChunkStore(File zipFile, String folder)
|
public TrueZipLegacyChunkStore(File zipFile, String folder)
|
||||||
throws IOException, ZipException {
|
throws IOException, ZipException {
|
||||||
this.zipFile = zipFile;
|
this.zipFile = zipFile;
|
||||||
this.folder = folder;
|
this.folder = folder;
|
||||||
|
|
||||||
zip = new ZipFile(zipFile);
|
zip = new ZipFile(zipFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,14 +107,14 @@ public class TrueZipLegacyChunkStore extends LegacyChunkStore {
|
|||||||
if (testEntry == null) {
|
if (testEntry == null) {
|
||||||
// Let's try a world/ sub-directory
|
// Let's try a world/ sub-directory
|
||||||
testEntry = getEntry("world/level.dat");
|
testEntry = getEntry("world/level.dat");
|
||||||
|
|
||||||
Pattern pattern = Pattern.compile(".*[\\\\/]level\\.dat$");
|
Pattern pattern = Pattern.compile(".*[\\\\/]level\\.dat$");
|
||||||
|
|
||||||
// So not there either...
|
// So not there either...
|
||||||
if (testEntry == null) {
|
if (testEntry == null) {
|
||||||
for (Enumeration<? extends ZipEntry> e = zip.entries();
|
for (Enumeration<? extends ZipEntry> e = zip.entries();
|
||||||
e.hasMoreElements(); ) {
|
e.hasMoreElements(); ) {
|
||||||
|
|
||||||
testEntry = (ZipEntry)e.nextElement();
|
testEntry = (ZipEntry)e.nextElement();
|
||||||
|
|
||||||
// Whoo, found level.dat!
|
// Whoo, found level.dat!
|
||||||
@ -141,10 +141,10 @@ public class TrueZipLegacyChunkStore extends LegacyChunkStore {
|
|||||||
throw new IOException("Failed to read " + file + " in ZIP");
|
throw new IOException("Failed to read " + file + " in ZIP");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an entry from the ZIP, trying both types of slashes.
|
* Get an entry from the ZIP, trying both types of slashes.
|
||||||
*
|
*
|
||||||
* @param file
|
* @param file
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -58,7 +58,7 @@ public class ZippedLegacyChunkStore extends LegacyChunkStore {
|
|||||||
throws IOException, ZipException {
|
throws IOException, ZipException {
|
||||||
this.zipFile = zipFile;
|
this.zipFile = zipFile;
|
||||||
this.folder = folder;
|
this.folder = folder;
|
||||||
|
|
||||||
zip = new ZipFile(zipFile);
|
zip = new ZipFile(zipFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,14 +104,14 @@ public class ZippedLegacyChunkStore extends LegacyChunkStore {
|
|||||||
if (testEntry == null) {
|
if (testEntry == null) {
|
||||||
// Let's try a world/ sub-directory
|
// Let's try a world/ sub-directory
|
||||||
testEntry = getEntry("world/level.dat");
|
testEntry = getEntry("world/level.dat");
|
||||||
|
|
||||||
Pattern pattern = Pattern.compile(".*[\\\\/]level\\.dat$");
|
Pattern pattern = Pattern.compile(".*[\\\\/]level\\.dat$");
|
||||||
|
|
||||||
// So not there either...
|
// So not there either...
|
||||||
if (testEntry == null) {
|
if (testEntry == null) {
|
||||||
for (Enumeration<? extends ZipEntry> e = zip.entries();
|
for (Enumeration<? extends ZipEntry> e = zip.entries();
|
||||||
e.hasMoreElements(); ) {
|
e.hasMoreElements(); ) {
|
||||||
|
|
||||||
testEntry = (ZipEntry)e.nextElement();
|
testEntry = (ZipEntry)e.nextElement();
|
||||||
|
|
||||||
// Whoo, found level.dat!
|
// Whoo, found level.dat!
|
||||||
@ -138,10 +138,10 @@ public class ZippedLegacyChunkStore extends LegacyChunkStore {
|
|||||||
throw new IOException("Failed to read " + file + " in ZIP");
|
throw new IOException("Failed to read " + file + " in ZIP");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an entry from the ZIP, trying both types of slashes.
|
* Get an entry from the ZIP, trying both types of slashes.
|
||||||
*
|
*
|
||||||
* @param file
|
* @param file
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -38,7 +38,7 @@ public class BlockChance {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the object.
|
* Construct the object.
|
||||||
*
|
*
|
||||||
* @param block
|
* @param block
|
||||||
* @param chance
|
* @param chance
|
||||||
*/
|
*/
|
||||||
|
@ -73,7 +73,7 @@ public class RandomFillPattern implements Pattern {
|
|||||||
*/
|
*/
|
||||||
public BaseBlock next(Vector pos) {
|
public BaseBlock next(Vector pos) {
|
||||||
double r = random.nextDouble();
|
double r = random.nextDouble();
|
||||||
|
|
||||||
for (BlockChance block : blocks) {
|
for (BlockChance block : blocks) {
|
||||||
if (r <= block.getChance()) {
|
if (r <= block.getChance()) {
|
||||||
return block.getBlock();
|
return block.getBlock();
|
||||||
|
@ -35,7 +35,7 @@ public class SingleBlockPattern implements Pattern {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the object.
|
* Construct the object.
|
||||||
*
|
*
|
||||||
* @param block
|
* @param block
|
||||||
*/
|
*/
|
||||||
public SingleBlockPattern(BaseBlock block) {
|
public SingleBlockPattern(BaseBlock block) {
|
||||||
@ -44,7 +44,7 @@ public class SingleBlockPattern implements Pattern {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get next block.
|
* Get next block.
|
||||||
*
|
*
|
||||||
* @param pos
|
* @param pos
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -54,7 +54,7 @@ public class SingleBlockPattern implements Pattern {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the block.
|
* Get the block.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public BaseBlock getBlock() {
|
public BaseBlock getBlock() {
|
||||||
|
@ -43,7 +43,7 @@ public class CuboidRegion implements Region {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new instance of this cuboid region.
|
* Construct a new instance of this cuboid region.
|
||||||
*
|
*
|
||||||
* @param pos1
|
* @param pos1
|
||||||
* @param pos2
|
* @param pos2
|
||||||
*/
|
*/
|
||||||
@ -76,7 +76,7 @@ public class CuboidRegion implements Region {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of blocks in the region.
|
* Get the number of blocks in the region.
|
||||||
*
|
*
|
||||||
* @return number of blocks
|
* @return number of blocks
|
||||||
*/
|
*/
|
||||||
public int getArea() {
|
public int getArea() {
|
||||||
@ -230,7 +230,7 @@ public class CuboidRegion implements Region {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get position 1.
|
* Get position 1.
|
||||||
*
|
*
|
||||||
* @return position 1
|
* @return position 1
|
||||||
*/
|
*/
|
||||||
public Vector getPos1() {
|
public Vector getPos1() {
|
||||||
@ -239,7 +239,7 @@ public class CuboidRegion implements Region {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set position 1.
|
* Set position 1.
|
||||||
*
|
*
|
||||||
* @param pos1
|
* @param pos1
|
||||||
*/
|
*/
|
||||||
public void setPos1(Vector pos1) {
|
public void setPos1(Vector pos1) {
|
||||||
@ -248,7 +248,7 @@ public class CuboidRegion implements Region {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get position 2.
|
* Get position 2.
|
||||||
*
|
*
|
||||||
* @return position 2
|
* @return position 2
|
||||||
*/
|
*/
|
||||||
public Vector getPos2() {
|
public Vector getPos2() {
|
||||||
@ -266,7 +266,7 @@ public class CuboidRegion implements Region {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of chunks that this region is within.
|
* Get a list of chunks that this region is within.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Set<Vector2D> getChunks() {
|
public Set<Vector2D> getChunks() {
|
||||||
@ -299,7 +299,7 @@ public class CuboidRegion implements Region {
|
|||||||
|
|
||||||
Vector min = getMinimumPoint();
|
Vector min = getMinimumPoint();
|
||||||
Vector max = getMaximumPoint();
|
Vector max = getMaximumPoint();
|
||||||
|
|
||||||
return x >= min.getBlockX() && x <= max.getBlockX()
|
return x >= min.getBlockX() && x <= max.getBlockX()
|
||||||
&& y >= min.getBlockY() && y <= max.getBlockY()
|
&& y >= min.getBlockY() && y <= max.getBlockY()
|
||||||
&& z >= min.getBlockZ() && z <= max.getBlockZ();
|
&& z >= min.getBlockZ() && z <= max.getBlockZ();
|
||||||
@ -307,7 +307,7 @@ public class CuboidRegion implements Region {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the iterator.
|
* Get the iterator.
|
||||||
*
|
*
|
||||||
* @return iterator of points inside the region
|
* @return iterator of points inside the region
|
||||||
*/
|
*/
|
||||||
public Iterator<BlockVector> iterator() {
|
public Iterator<BlockVector> iterator() {
|
||||||
@ -317,11 +317,11 @@ public class CuboidRegion implements Region {
|
|||||||
private int nextX = min.getBlockX();
|
private int nextX = min.getBlockX();
|
||||||
private int nextY = min.getBlockY();
|
private int nextY = min.getBlockY();
|
||||||
private int nextZ = min.getBlockZ();
|
private int nextZ = min.getBlockZ();
|
||||||
|
|
||||||
public boolean hasNext() {
|
public boolean hasNext() {
|
||||||
return (nextX != Integer.MIN_VALUE);
|
return (nextX != Integer.MIN_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockVector next() {
|
public BlockVector next() {
|
||||||
if (!hasNext()) throw new java.util.NoSuchElementException();
|
if (!hasNext()) throw new java.util.NoSuchElementException();
|
||||||
BlockVector answer = new BlockVector(nextX, nextY, nextZ);
|
BlockVector answer = new BlockVector(nextX, nextY, nextZ);
|
||||||
@ -336,13 +336,13 @@ public class CuboidRegion implements Region {
|
|||||||
}
|
}
|
||||||
return answer;
|
return answer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove() {
|
public void remove() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns string representation in the format
|
* Returns string representation in the format
|
||||||
* "(minX, minY, minZ) - (maxX, maxY, maxZ)".
|
* "(minX, minY, minZ) - (maxX, maxY, maxZ)".
|
||||||
|
@ -31,19 +31,19 @@ import java.util.Set;
|
|||||||
public interface Region extends Iterable<BlockVector> {
|
public interface Region extends Iterable<BlockVector> {
|
||||||
/**
|
/**
|
||||||
* Get the lower point of a region.
|
* Get the lower point of a region.
|
||||||
*
|
*
|
||||||
* @return min. point
|
* @return min. point
|
||||||
*/
|
*/
|
||||||
public Vector getMinimumPoint();
|
public Vector getMinimumPoint();
|
||||||
/**
|
/**
|
||||||
* Get the upper point of a region.
|
* Get the upper point of a region.
|
||||||
*
|
*
|
||||||
* @return max. point
|
* @return max. point
|
||||||
*/
|
*/
|
||||||
public Vector getMaximumPoint();
|
public Vector getMaximumPoint();
|
||||||
/**
|
/**
|
||||||
* Get the number of blocks in the region.
|
* Get the number of blocks in the region.
|
||||||
*
|
*
|
||||||
* @return number of blocks
|
* @return number of blocks
|
||||||
*/
|
*/
|
||||||
public int getArea();
|
public int getArea();
|
||||||
@ -69,26 +69,26 @@ public interface Region extends Iterable<BlockVector> {
|
|||||||
* Expand the region.
|
* Expand the region.
|
||||||
*
|
*
|
||||||
* @param change
|
* @param change
|
||||||
* @throws RegionOperationException
|
* @throws RegionOperationException
|
||||||
*/
|
*/
|
||||||
public void expand(Vector change) throws RegionOperationException;
|
public void expand(Vector change) throws RegionOperationException;
|
||||||
/**
|
/**
|
||||||
* Contract the region.
|
* Contract the region.
|
||||||
*
|
*
|
||||||
* @param change
|
* @param change
|
||||||
* @throws RegionOperationException
|
* @throws RegionOperationException
|
||||||
*/
|
*/
|
||||||
public void contract(Vector change) throws RegionOperationException;
|
public void contract(Vector change) throws RegionOperationException;
|
||||||
/**
|
/**
|
||||||
* Returns true based on whether the region contains the point,
|
* Returns true based on whether the region contains the point,
|
||||||
*
|
*
|
||||||
* @param pt
|
* @param pt
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean contains(Vector pt);
|
public boolean contains(Vector pt);
|
||||||
/**
|
/**
|
||||||
* Get a list of chunks.
|
* Get a list of chunks.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Set<Vector2D> getChunks();
|
public Set<Vector2D> getChunks();
|
||||||
|
@ -46,7 +46,7 @@ public class Snapshot implements Comparable<Snapshot> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a snapshot restoration operation.
|
* Construct a snapshot restoration operation.
|
||||||
*
|
*
|
||||||
* @param repo
|
* @param repo
|
||||||
* @param snapshot
|
* @param snapshot
|
||||||
*/
|
*/
|
||||||
@ -57,10 +57,10 @@ public class Snapshot implements Comparable<Snapshot> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a chunk store.
|
* Get a chunk store.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws DataException
|
* @throws DataException
|
||||||
*/
|
*/
|
||||||
public ChunkStore getChunkStore() throws IOException, DataException {
|
public ChunkStore getChunkStore() throws IOException, DataException {
|
||||||
ChunkStore chunkStore = _getChunkStore();
|
ChunkStore chunkStore = _getChunkStore();
|
||||||
@ -73,10 +73,10 @@ public class Snapshot implements Comparable<Snapshot> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a chunk store.
|
* Get a chunk store.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws DataException
|
* @throws DataException
|
||||||
*/
|
*/
|
||||||
public ChunkStore _getChunkStore() throws IOException, DataException {
|
public ChunkStore _getChunkStore() throws IOException, DataException {
|
||||||
if (file.getName().toLowerCase().endsWith(".zip")) {
|
if (file.getName().toLowerCase().endsWith(".zip")) {
|
||||||
@ -124,7 +124,7 @@ public class Snapshot implements Comparable<Snapshot> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check the zip/tar file it contains the given world.
|
* Check the zip/tar file it contains the given world.
|
||||||
*
|
*
|
||||||
* @return true if the zip/tar file contains the given world
|
* @return true if the zip/tar file contains the given world
|
||||||
*/
|
*/
|
||||||
public boolean containsWorld(String worldname) {
|
public boolean containsWorld(String worldname) {
|
||||||
@ -158,7 +158,7 @@ public class Snapshot implements Comparable<Snapshot> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the snapshot's name.
|
* Get the snapshot's name.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
@ -167,7 +167,7 @@ public class Snapshot implements Comparable<Snapshot> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the file for the snapshot.
|
* Get the file for the snapshot.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public File getFile() {
|
public File getFile() {
|
||||||
@ -176,7 +176,7 @@ public class Snapshot implements Comparable<Snapshot> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the date associated with this snapshot.
|
* Get the date associated with this snapshot.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Calendar getDate() {
|
public Calendar getDate() {
|
||||||
@ -185,7 +185,7 @@ public class Snapshot implements Comparable<Snapshot> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the date of the snapshot.
|
* Set the date of the snapshot.
|
||||||
*
|
*
|
||||||
* @param date
|
* @param date
|
||||||
*/
|
*/
|
||||||
public void setDate(Calendar date) {
|
public void setDate(Calendar date) {
|
||||||
|
@ -67,7 +67,7 @@ public class SnapshotRepository {
|
|||||||
* Get a list of snapshots in a directory. The newest snapshot is
|
* Get a list of snapshots in a directory. The newest snapshot is
|
||||||
* near the top of the array.
|
* near the top of the array.
|
||||||
*
|
*
|
||||||
* @param newestFirst
|
* @param newestFirst
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<Snapshot> getSnapshots(boolean newestFirst, String worldname) throws MissingWorldException {
|
public List<Snapshot> getSnapshots(boolean newestFirst, String worldname) throws MissingWorldException {
|
||||||
@ -108,7 +108,7 @@ public class SnapshotRepository {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the first snapshot after a date.
|
* Get the first snapshot after a date.
|
||||||
*
|
*
|
||||||
* @param date
|
* @param date
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -130,7 +130,7 @@ public class SnapshotRepository {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the first snapshot before a date.
|
* Get the first snapshot before a date.
|
||||||
*
|
*
|
||||||
* @param date
|
* @param date
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -151,7 +151,7 @@ public class SnapshotRepository {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempt to detect a snapshot's date and assign it.
|
* Attempt to detect a snapshot's date and assign it.
|
||||||
*
|
*
|
||||||
* @param snapshot
|
* @param snapshot
|
||||||
*/
|
*/
|
||||||
protected void detectDate(Snapshot snapshot) {
|
protected void detectDate(Snapshot snapshot) {
|
||||||
@ -211,7 +211,7 @@ public class SnapshotRepository {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a snapshot.
|
* Get a snapshot.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* @return
|
* @return
|
||||||
* @throws InvalidSnapshotException
|
* @throws InvalidSnapshotException
|
||||||
|
@ -57,13 +57,13 @@ public class SnapshotRestore {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the snapshot restore operation.
|
* Construct the snapshot restore operation.
|
||||||
*
|
*
|
||||||
* @param chunkStore
|
* @param chunkStore
|
||||||
* @param region
|
* @param region
|
||||||
*/
|
*/
|
||||||
public SnapshotRestore(ChunkStore chunkStore, Region region) {
|
public SnapshotRestore(ChunkStore chunkStore, Region region) {
|
||||||
this.chunkStore = chunkStore;
|
this.chunkStore = chunkStore;
|
||||||
|
|
||||||
if (region instanceof CuboidRegion) {
|
if (region instanceof CuboidRegion) {
|
||||||
findNeededCuboidChunks(region);
|
findNeededCuboidChunks(region);
|
||||||
} else {
|
} else {
|
||||||
@ -121,7 +121,7 @@ public class SnapshotRestore {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of chunks that are needed.
|
* Get the number of chunks that are needed.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public int getChunksAffected() {
|
public int getChunksAffected() {
|
||||||
@ -132,7 +132,7 @@ public class SnapshotRestore {
|
|||||||
* Restores to world.
|
* Restores to world.
|
||||||
*
|
*
|
||||||
* @param editSession
|
* @param editSession
|
||||||
* @throws MaxChangedBlocksException
|
* @throws MaxChangedBlocksException
|
||||||
*/
|
*/
|
||||||
public void restore(EditSession editSession)
|
public void restore(EditSession editSession)
|
||||||
throws MaxChangedBlocksException {
|
throws MaxChangedBlocksException {
|
||||||
@ -193,7 +193,7 @@ public class SnapshotRestore {
|
|||||||
/**
|
/**
|
||||||
* Checks to see where the backup succeeded in any capacity. False will
|
* Checks to see where the backup succeeded in any capacity. False will
|
||||||
* be returned if no chunk could be successfully loaded.
|
* be returned if no chunk could be successfully loaded.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean hadTotalFailure() {
|
public boolean hadTotalFailure() {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren