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