Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-05 11:00:05 +01:00
Cleanup
Dieser Commit ist enthalten in:
Ursprung
1a57f6e95d
Commit
7e13b60a51
@ -21,7 +21,10 @@ package com.sk89q.bukkit.migration;
|
||||
|
||||
public interface PermissionsProvider {
|
||||
public boolean hasPermission(String name, String permission);
|
||||
|
||||
public boolean hasPermission(String worldName, String name, String permission);
|
||||
|
||||
public boolean inGroup(String player, String group);
|
||||
|
||||
public String[] getGroups(String player);
|
||||
}
|
||||
|
@ -67,5 +67,4 @@ public @interface Command {
|
||||
* meaning that if it is given it must have a value
|
||||
*/
|
||||
String flags() default "";
|
||||
|
||||
}
|
||||
|
@ -56,7 +56,6 @@ import com.sk89q.util.StringUtil;
|
||||
* @param <T> command sender class
|
||||
*/
|
||||
public abstract class CommandsManager<T> {
|
||||
|
||||
/**
|
||||
* Logger for general errors.
|
||||
*/
|
||||
@ -70,8 +69,7 @@ public abstract class CommandsManager<T> {
|
||||
* the key of the command name (one for each alias) with the
|
||||
* method.
|
||||
*/
|
||||
protected Map<Method, Map<String, Method>> commands
|
||||
= new HashMap<Method, Map<String, Method>>();
|
||||
protected Map<Method, Map<String, Method>> commands = new HashMap<Method, Map<String, Method>>();
|
||||
|
||||
/**
|
||||
* Used to store the instances associated with a method.
|
||||
@ -256,7 +254,8 @@ public abstract class CommandsManager<T> {
|
||||
char[] flags = cmd.flags().toCharArray();
|
||||
for (int i = 0; i < flags.length; ++i) {
|
||||
if (flags.length > i + 1 && flags[i + 1] == ':') {
|
||||
i++; continue;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
flagChars.add(flags[i]);
|
||||
}
|
||||
@ -294,7 +293,6 @@ public abstract class CommandsManager<T> {
|
||||
command.append(args[i] + " ");
|
||||
}
|
||||
|
||||
|
||||
Map<String, Method> map = commands.get(method);
|
||||
boolean found = false;
|
||||
|
||||
@ -430,16 +428,19 @@ public abstract class CommandsManager<T> {
|
||||
|
||||
CommandContext context = new CommandContext(newArgs, valueFlags);
|
||||
|
||||
if (context.argsLength() < cmd.min())
|
||||
if (context.argsLength() < cmd.min()) {
|
||||
throw new CommandUsageException("Too few arguments.", getUsage(args, level, cmd));
|
||||
}
|
||||
|
||||
if (cmd.max() != -1 && context.argsLength() > cmd.max())
|
||||
if (cmd.max() != -1 && context.argsLength() > cmd.max()) {
|
||||
throw new CommandUsageException("Too many arguments.", getUsage(args, level, cmd));
|
||||
}
|
||||
|
||||
for (char flag : context.getFlags()) {
|
||||
if (!newFlags.contains(flag))
|
||||
if (!newFlags.contains(flag)) {
|
||||
throw new CommandUsageException("Unknown flag: " + flag, getUsage(args, level, cmd));
|
||||
}
|
||||
}
|
||||
|
||||
methodArgs[0] = context;
|
||||
|
||||
|
@ -5,6 +5,7 @@ import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
public class SimpleInjector<T> implements Injector {
|
||||
private final T injectionObject;
|
||||
|
||||
public SimpleInjector(T injectionObject) {
|
||||
this.injectionObject = injectionObject;
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ import java.util.Map;
|
||||
public class YAMLNode {
|
||||
protected Map<String, Object> root;
|
||||
private boolean writeDefaults;
|
||||
|
||||
public YAMLNode(Map<String, Object> root, boolean writeDefaults) {
|
||||
this.root = root;
|
||||
this.writeDefaults = writeDefaults;
|
||||
|
@ -171,7 +171,8 @@ public class YAMLProcessor extends YAMLNode {
|
||||
}
|
||||
yaml.dump(root, writer);
|
||||
return true;
|
||||
} catch (IOException e) {} finally {
|
||||
} catch (IOException e) {
|
||||
} finally {
|
||||
try {
|
||||
if (stream != null) {
|
||||
stream.close();
|
||||
|
@ -287,16 +287,15 @@ public class CuboidClipboard {
|
||||
* @param noAir
|
||||
* @throws MaxChangedBlocksException
|
||||
*/
|
||||
public void place(EditSession editSession, Vector pos, boolean noAir)
|
||||
throws MaxChangedBlocksException {
|
||||
public void place(EditSession editSession, Vector pos, boolean noAir) throws MaxChangedBlocksException {
|
||||
for (int x = 0; x < size.getBlockX(); ++x) {
|
||||
for (int y = 0; y < size.getBlockY(); ++y) {
|
||||
for (int z = 0; z < size.getBlockZ(); ++z) {
|
||||
if (noAir && data[x][y][z].isAir())
|
||||
if (noAir && data[x][y][z].isAir()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
editSession.setBlock(new Vector(x, y, z).add(pos),
|
||||
data[x][y][z]);
|
||||
editSession.setBlock(new Vector(x, y, z).add(pos), data[x][y][z]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -327,20 +327,17 @@ public class EditSession {
|
||||
if (BlockType.shouldPlaceLast(block.getType())) {
|
||||
// Place torches, etc. last
|
||||
queueLast.put(pt.toBlockVector(), block);
|
||||
return !(getBlockType(pt) == block.getType()
|
||||
&& getBlockData(pt) == block.getData());
|
||||
return !(getBlockType(pt) == block.getType() && getBlockData(pt) == block.getData());
|
||||
} else if (BlockType.shouldPlaceFinal(block.getType())) {
|
||||
// Place signs, reed, etc even later
|
||||
queueFinal.put(pt.toBlockVector(), block);
|
||||
return !(getBlockType(pt) == block.getType()
|
||||
&& getBlockData(pt) == block.getData());
|
||||
return !(getBlockType(pt) == block.getType() && getBlockData(pt) == block.getData());
|
||||
} else if (BlockType.shouldPlaceLast(getBlockType(pt))) {
|
||||
// Destroy torches, etc. first
|
||||
rawSetBlock(pt, new BaseBlock(BlockID.AIR));
|
||||
} else {
|
||||
queueAfter.put(pt.toBlockVector(), block);
|
||||
return !(getBlockType(pt) == block.getType()
|
||||
&& getBlockData(pt) == block.getData());
|
||||
return !(getBlockType(pt) == block.getType() && getBlockData(pt) == block.getData());
|
||||
}
|
||||
}
|
||||
|
||||
@ -403,6 +400,7 @@ public class EditSession {
|
||||
|
||||
return world.getBlockData(pt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the block type at a position x, y, z.
|
||||
*
|
||||
@ -2033,13 +2031,11 @@ public class EditSession {
|
||||
final int ceilRadiusZ = (int) Math.ceil(radiusZ);
|
||||
|
||||
double nextXn = 0;
|
||||
forX:
|
||||
for (int x = 0; x <= ceilRadiusX; ++x) {
|
||||
forX: for (int x = 0; x <= ceilRadiusX; ++x) {
|
||||
final double xn = nextXn;
|
||||
nextXn = (x + 1) * invRadiusX;
|
||||
double nextZn = 0;
|
||||
forZ:
|
||||
for (int z = 0; z <= ceilRadiusZ; ++z) {
|
||||
forZ: for (int z = 0; z <= ceilRadiusZ; ++z) {
|
||||
final double zn = nextZn;
|
||||
nextZn = (z + 1) * invRadiusZ;
|
||||
|
||||
@ -2119,18 +2115,15 @@ public class EditSession {
|
||||
final int ceilRadiusZ = (int) Math.ceil(radiusZ);
|
||||
|
||||
double nextXn = 0;
|
||||
forX:
|
||||
for (int x = 0; x <= ceilRadiusX; ++x) {
|
||||
forX: for (int x = 0; x <= ceilRadiusX; ++x) {
|
||||
final double xn = nextXn;
|
||||
nextXn = (x + 1) * invRadiusX;
|
||||
double nextYn = 0;
|
||||
forY:
|
||||
for (int y = 0; y <= ceilRadiusY; ++y) {
|
||||
forY: for (int y = 0; y <= ceilRadiusY; ++y) {
|
||||
final double yn = nextYn;
|
||||
nextYn = (y + 1) * invRadiusY;
|
||||
double nextZn = 0;
|
||||
forZ:
|
||||
for (int z = 0; z <= ceilRadiusZ; ++z) {
|
||||
forZ: for (int z = 0; z <= ceilRadiusZ; ++z) {
|
||||
final double zn = nextZn;
|
||||
nextZn = (z + 1) * invRadiusZ;
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
package com.sk89q.worldedit;
|
||||
// $Id$
|
||||
/*
|
||||
* WorldEditLibrary
|
||||
@ -18,6 +17,8 @@ package com.sk89q.worldedit;
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit;
|
||||
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
import com.sk89q.worldedit.filtering.HeightMapFilter;
|
||||
|
@ -26,7 +26,6 @@ import java.io.File;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
/**
|
||||
* Represents WorldEdit's configuration.
|
||||
*
|
||||
|
@ -322,6 +322,7 @@ public abstract class LocalPlayer {
|
||||
TargetBlock tb = new TargetBlock(this, range, 0.2);
|
||||
return (useLastBlock ? tb.getAnyTargetBlockFace() : tb.getTargetBlockFace());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the point of the block being looked at. May return null.
|
||||
*
|
||||
|
@ -75,7 +75,6 @@ public class LocalSession {
|
||||
private boolean fastMode = false;
|
||||
private Mask mask;
|
||||
private TimeZone timezone = TimeZone.getDefault();
|
||||
//private Boolean jumptoBlock = true;
|
||||
|
||||
/**
|
||||
* Construct the object.
|
||||
|
@ -248,10 +248,16 @@ public abstract class LocalWorld {
|
||||
*/
|
||||
public void simulateBlockMine(Vector pt) {
|
||||
BaseItemStack stack = BlockType.getBlockDrop(getBlockType(pt), (short) getBlockData(pt));
|
||||
if (stack != null) dropItem(pt,
|
||||
stack.getAmount() > 1 ? new BaseItemStack(stack.getType(),
|
||||
1, stack.getDamage()) : stack, stack.getAmount());
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final int amount = stack.getAmount();
|
||||
if (amount > 1) {
|
||||
dropItem(pt, new BaseItemStack(stack.getType(), 1, stack.getDamage()), amount);
|
||||
} else {
|
||||
dropItem(pt, stack, amount);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -298,7 +304,8 @@ public abstract class LocalWorld {
|
||||
*
|
||||
* @param pt Position to check
|
||||
*/
|
||||
public void checkLoadedChunk(Vector pt) {}
|
||||
public void checkLoadedChunk(Vector pt) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare if the other world is equal.
|
||||
@ -331,7 +338,9 @@ public abstract class LocalWorld {
|
||||
*
|
||||
* @param chunks the chunks to fix
|
||||
*/
|
||||
public void fixAfterFastMode(Iterable<BlockVector2D> chunks) {}
|
||||
|
||||
public void fixLighting(Iterable<BlockVector2D> chunks) {}
|
||||
public void fixAfterFastMode(Iterable<BlockVector2D> chunks) {
|
||||
}
|
||||
|
||||
public void fixLighting(Iterable<BlockVector2D> chunks) {
|
||||
}
|
||||
}
|
||||
|
@ -374,12 +374,11 @@ public class WorldEdit {
|
||||
}
|
||||
|
||||
// Check if the item is allowed
|
||||
if (allAllowed || player.hasPermission("worldedit.anyblock")
|
||||
|| !config.disallowedBlocks.contains(blockId)) {
|
||||
|
||||
if (allAllowed || player.hasPermission("worldedit.anyblock") || !config.disallowedBlocks.contains(blockId)) {
|
||||
switch (blockType) {
|
||||
case SIGN_POST:
|
||||
case WALL_SIGN:
|
||||
// Allow special sign text syntax
|
||||
if (blockType == BlockType.SIGN_POST
|
||||
|| blockType == BlockType.WALL_SIGN) {
|
||||
String[] text = new String[4];
|
||||
text[0] = blockAndExtraData.length > 1 ? blockAndExtraData[1] : "";
|
||||
text[1] = blockAndExtraData.length > 2 ? blockAndExtraData[2] : "";
|
||||
@ -387,8 +386,8 @@ public class WorldEdit {
|
||||
text[3] = blockAndExtraData.length > 4 ? blockAndExtraData[4] : "";
|
||||
return new SignBlock(blockType.getID(), data, text);
|
||||
|
||||
case MOB_SPAWNER:
|
||||
// Allow setting mob spawn type
|
||||
} else if (blockType == BlockType.MOB_SPAWNER) {
|
||||
if (blockAndExtraData.length > 1) {
|
||||
String mobName = blockAndExtraData[1];
|
||||
for (MobType mobType : MobType.values()) {
|
||||
@ -405,8 +404,8 @@ public class WorldEdit {
|
||||
return new MobSpawnerBlock(data, MobType.PIG.getName());
|
||||
}
|
||||
|
||||
case NOTE_BLOCK:
|
||||
// Allow setting note
|
||||
} else if (blockType == BlockType.NOTE_BLOCK) {
|
||||
if (blockAndExtraData.length > 1) {
|
||||
byte note = Byte.parseByte(blockAndExtraData[1]);
|
||||
if (note < 0 || note > 24) {
|
||||
@ -417,10 +416,11 @@ public class WorldEdit {
|
||||
} else {
|
||||
return new NoteBlock(data, (byte) 0);
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
return new BaseBlock(blockId, data);
|
||||
}
|
||||
}
|
||||
|
||||
throw new DisallowedItemException(arg);
|
||||
}
|
||||
@ -1376,7 +1376,7 @@ public class WorldEdit {
|
||||
try {
|
||||
engine.evaluate(script, filename, vars);
|
||||
} catch (ScriptException e) {
|
||||
player.printError("Failed to execute:");;
|
||||
player.printError("Failed to execute:");
|
||||
player.printRaw(e.getMessage());
|
||||
e.printStackTrace();
|
||||
} catch (NumberFormatException e) {
|
||||
|
@ -189,6 +189,7 @@ public abstract class BlockBag {
|
||||
* @param pos
|
||||
*/
|
||||
public abstract void addSourcePosition(Vector pos);
|
||||
|
||||
/**
|
||||
* Adds a position to be used a source.
|
||||
*
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.bags;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author sk89q
|
||||
|
@ -130,6 +130,7 @@ public class BaseBlock {
|
||||
data = (byte) BlockData.flip(type, data);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flip this block.
|
||||
* @param direction
|
||||
|
@ -129,7 +129,6 @@ public class ChestBlock extends BaseBlock implements TileEntityBlock, ContainerB
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Tag t = values.get("id");
|
||||
if (!(t instanceof StringTag) || !((StringTag) t).getValue().equals("Chest")) {
|
||||
throw new DataException("'Chest' tile entity expected");
|
||||
|
@ -129,7 +129,6 @@ public class DispenserBlock extends BaseBlock implements TileEntityBlock, Contai
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Tag t = values.get("id");
|
||||
if (!(t instanceof StringTag) || !((StringTag) t).getValue().equals("Trap")) {
|
||||
throw new DataException("'Trap' tile entity expected");
|
||||
|
@ -35,6 +35,7 @@ public interface TileEntityBlock {
|
||||
* @return title entity ID
|
||||
*/
|
||||
public String getTileEntityID();
|
||||
|
||||
/**
|
||||
* Store additional tile entity data.
|
||||
*
|
||||
@ -43,6 +44,7 @@ public interface TileEntityBlock {
|
||||
*/
|
||||
public Map<String, Tag> toTileEntityNBT()
|
||||
throws DataException;
|
||||
|
||||
/**
|
||||
* Get additional information from the title entity data.
|
||||
*
|
||||
|
@ -122,5 +122,4 @@ public class BukkitConfiguration extends LocalConfiguration {
|
||||
logFileHandler.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -109,5 +109,6 @@ public class BukkitUtil {
|
||||
if (Math.abs(a.getZ() - b.getZ()) > EQUALS_PRECISION) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static final double EQUALS_PRECISION = 0.0001;
|
||||
}
|
||||
|
@ -273,13 +273,14 @@ public class BukkitWorld extends LocalWorld {
|
||||
*/
|
||||
@Override
|
||||
public boolean copyToWorld(Vector pt, BaseBlock block) {
|
||||
// Signs
|
||||
if (block instanceof SignBlock) {
|
||||
// Signs
|
||||
setSignText(pt, ((SignBlock) block).getText());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (block instanceof FurnaceBlock) {
|
||||
// Furnaces
|
||||
} else if (block instanceof FurnaceBlock) {
|
||||
Block bukkitBlock = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
|
||||
if (bukkitBlock == null) return false;
|
||||
BlockState state = bukkitBlock.getState();
|
||||
@ -289,13 +290,15 @@ public class BukkitWorld extends LocalWorld {
|
||||
bukkit.setBurnTime(we.getBurnTime());
|
||||
bukkit.setCookTime(we.getCookTime());
|
||||
return setContainerBlockContents(pt, ((ContainerBlock) block).getItems());
|
||||
}
|
||||
|
||||
if (block instanceof ContainerBlock) {
|
||||
// Chests/dispenser
|
||||
} else if (block instanceof ContainerBlock) {
|
||||
return setContainerBlockContents(pt, ((ContainerBlock) block).getItems());
|
||||
}
|
||||
|
||||
if (block instanceof MobSpawnerBlock) {
|
||||
// Mob spawners
|
||||
} else if (block instanceof MobSpawnerBlock) {
|
||||
Block bukkitBlock = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
|
||||
if (bukkitBlock == null) return false;
|
||||
BlockState state = bukkitBlock.getState();
|
||||
@ -305,9 +308,10 @@ public class BukkitWorld extends LocalWorld {
|
||||
bukkit.setCreatureTypeId(we.getMobType());
|
||||
bukkit.setDelay(we.getDelay());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (block instanceof NoteBlock) {
|
||||
// Note block
|
||||
} else if (block instanceof NoteBlock) {
|
||||
Block bukkitBlock = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
|
||||
if (bukkitBlock == null) return false;
|
||||
BlockState state = bukkitBlock.getState();
|
||||
@ -330,13 +334,14 @@ public class BukkitWorld extends LocalWorld {
|
||||
*/
|
||||
@Override
|
||||
public boolean copyFromWorld(Vector pt, BaseBlock block) {
|
||||
// Signs
|
||||
if (block instanceof SignBlock) {
|
||||
// Signs
|
||||
((SignBlock) block).setText(getSignText(pt));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (block instanceof FurnaceBlock) {
|
||||
// Furnaces
|
||||
} else if (block instanceof FurnaceBlock) {
|
||||
Block bukkitBlock = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
|
||||
if (bukkitBlock == null) return false;
|
||||
BlockState state = bukkitBlock.getState();
|
||||
@ -347,14 +352,16 @@ public class BukkitWorld extends LocalWorld {
|
||||
we.setCookTime(bukkit.getCookTime());
|
||||
((ContainerBlock) block).setItems(getContainerBlockContents(pt));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (block instanceof ContainerBlock) {
|
||||
// Chests/dispenser
|
||||
} else if (block instanceof ContainerBlock) {
|
||||
((ContainerBlock) block).setItems(getContainerBlockContents(pt));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (block instanceof MobSpawnerBlock) {
|
||||
// Mob spawners
|
||||
} else if (block instanceof MobSpawnerBlock) {
|
||||
Block bukkitBlock = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
|
||||
if (bukkitBlock == null) return false;
|
||||
BlockState state = bukkitBlock.getState();
|
||||
@ -364,9 +371,10 @@ public class BukkitWorld extends LocalWorld {
|
||||
we.setMobType(bukkit.getCreatureTypeId());
|
||||
we.setDelay((short) bukkit.getDelay());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (block instanceof NoteBlock) {
|
||||
// Note block
|
||||
} else if (block instanceof NoteBlock) {
|
||||
Block bukkitBlock = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
|
||||
if (bukkitBlock == null) return false;
|
||||
BlockState state = bukkitBlock.getState();
|
||||
@ -534,41 +542,55 @@ public class BukkitWorld extends LocalWorld {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (type == EntityType.ARROWS) {
|
||||
switch (type) {
|
||||
case ARROWS:
|
||||
if (ent instanceof Arrow) {
|
||||
ent.remove();
|
||||
++num;
|
||||
}
|
||||
} else if (type == EntityType.BOATS) {
|
||||
break;
|
||||
|
||||
case BOATS:
|
||||
if (ent instanceof Boat) {
|
||||
ent.remove();
|
||||
++num;
|
||||
}
|
||||
} else if (type == EntityType.ITEMS) {
|
||||
break;
|
||||
|
||||
case ITEMS:
|
||||
if (ent instanceof Item) {
|
||||
ent.remove();
|
||||
++num;
|
||||
}
|
||||
} else if (type == EntityType.MINECARTS) {
|
||||
break;
|
||||
|
||||
case MINECARTS:
|
||||
if (ent instanceof Minecart) {
|
||||
ent.remove();
|
||||
++num;
|
||||
}
|
||||
} else if (type == EntityType.PAINTINGS) {
|
||||
break;
|
||||
|
||||
case PAINTINGS:
|
||||
if (ent instanceof Painting) {
|
||||
ent.remove();
|
||||
++num;
|
||||
}
|
||||
} else if (type == EntityType.TNT) {
|
||||
break;
|
||||
|
||||
case TNT:
|
||||
if (ent instanceof TNTPrimed) {
|
||||
ent.remove();
|
||||
++num;
|
||||
}
|
||||
} else if (type == EntityType.XP_ORBS) {
|
||||
break;
|
||||
|
||||
case XP_ORBS:
|
||||
if (ent instanceof ExperienceOrb) {
|
||||
ent.remove();
|
||||
++num;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,9 +115,11 @@ public class WorldEditPlayerListener extends PlayerListener {
|
||||
}
|
||||
|
||||
if (!ignoreLeftClickAir) {
|
||||
final int taskId = Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { public void run() {
|
||||
final int taskId = Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
public void run() {
|
||||
ignoreLeftClickAir = false;
|
||||
}}, 2);
|
||||
}
|
||||
}, 2);
|
||||
|
||||
if (taskId != -1) {
|
||||
ignoreLeftClickAir = true;
|
||||
|
@ -207,13 +207,15 @@ public class WorldEditPlugin extends JavaPlugin {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (input != null)
|
||||
if (input != null) {
|
||||
input.close();
|
||||
}
|
||||
} catch (IOException e) {}
|
||||
|
||||
try {
|
||||
if (output != null)
|
||||
if (output != null) {
|
||||
output.close();
|
||||
}
|
||||
} catch (IOException e) {}
|
||||
}
|
||||
}
|
||||
@ -267,8 +269,7 @@ public class WorldEditPlugin extends JavaPlugin {
|
||||
BlockBag blockBag = session.getBlockBag(wePlayer);
|
||||
|
||||
EditSession editSession =
|
||||
new EditSession(wePlayer.getWorld(),
|
||||
session.getBlockChangeLimit(), blockBag);
|
||||
new EditSession(wePlayer.getWorld(), session.getBlockChangeLimit(), blockBag);
|
||||
editSession.enableQueue();
|
||||
|
||||
return editSession;
|
||||
|
@ -129,7 +129,9 @@ public class ChunkCommands {
|
||||
player.printError("Error occurred: " + e.getMessage());
|
||||
} finally {
|
||||
if (out != null) {
|
||||
try { out.close(); } catch (IOException ie) {}
|
||||
try {
|
||||
out.close();
|
||||
} catch (IOException ie) { }
|
||||
}
|
||||
}
|
||||
} else if (config.shellSaveType.equalsIgnoreCase("bash")) {
|
||||
|
@ -74,7 +74,6 @@ public class NavigationCommands {
|
||||
} else {
|
||||
player.print((ascentLevels != 1) ? "Ascended " + Integer.toString(ascentLevels) + " levels." : "Ascended a level.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -103,7 +102,6 @@ public class NavigationCommands {
|
||||
} else {
|
||||
player.print((descentLevels != 1) ? "Descended " + Integer.toString(descentLevels) + " levels." : "Descended a level.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Command(
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.commands;
|
||||
|
||||
|
||||
import java.util.Set;
|
||||
import com.sk89q.minecraft.util.commands.Command;
|
||||
import com.sk89q.minecraft.util.commands.CommandContext;
|
||||
@ -268,7 +267,6 @@ public class RegionCommands {
|
||||
player.print(affected + " blocks moved.");
|
||||
}
|
||||
|
||||
|
||||
@Command(
|
||||
aliases = { "/stack" },
|
||||
usage = "[count] [direction]",
|
||||
|
@ -106,7 +106,6 @@ public class SelectionCommands {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
session.getRegionSelector(player.getWorld())
|
||||
.explainSecondarySelection(player, session, pos);
|
||||
}
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.commands;
|
||||
|
||||
|
||||
import java.util.Set;
|
||||
import com.sk89q.minecraft.util.commands.Command;
|
||||
import com.sk89q.minecraft.util.commands.CommandContext;
|
||||
|
@ -21,5 +21,6 @@ package com.sk89q.worldedit.cui;
|
||||
|
||||
public interface CUIEvent {
|
||||
public String getTypeId();
|
||||
|
||||
public String[] getParameters();
|
||||
}
|
||||
|
@ -17,7 +17,6 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
package com.sk89q.worldedit.data;
|
||||
|
||||
import java.util.List;
|
||||
@ -173,8 +172,9 @@ public class Chunk {
|
||||
* @throws DataException
|
||||
*/
|
||||
private Map<String, Tag> getBlockTileEntity(Vector pos) throws DataException {
|
||||
if (tileEntities == null)
|
||||
if (tileEntities == null) {
|
||||
populateTileEntities();
|
||||
}
|
||||
|
||||
return tileEntities.get(new BlockVector(pos));
|
||||
}
|
||||
@ -232,8 +232,7 @@ public class Chunk {
|
||||
}
|
||||
Tag tag = items.get(key);
|
||||
if (!expected.isInstance(tag)) {
|
||||
throw new InvalidFormatException(
|
||||
key + " tag is not of tag type " + expected.getName());
|
||||
throw new InvalidFormatException(key + " tag is not of tag type " + expected.getName());
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
|
@ -116,7 +116,6 @@ public abstract class McRegionChunkStore extends ChunkStore {
|
||||
protected abstract InputStream getInputStream(String name, String worldname)
|
||||
throws IOException, DataException;
|
||||
|
||||
|
||||
/**
|
||||
* Close resources.
|
||||
*
|
||||
|
@ -112,8 +112,7 @@ public class TrueZipLegacyChunkStore extends LegacyChunkStore {
|
||||
|
||||
// So not there either...
|
||||
if (testEntry == null) {
|
||||
for (Enumeration<? extends ZipEntry> e = zip.entries();
|
||||
e.hasMoreElements(); ) {
|
||||
for (Enumeration<? extends ZipEntry> e = zip.entries(); e.hasMoreElements();) {
|
||||
|
||||
testEntry = (ZipEntry) e.nextElement();
|
||||
|
||||
|
@ -100,8 +100,7 @@ public class TrueZipMcRegionChunkStore extends McRegionChunkStore {
|
||||
Pattern pattern = Pattern.compile(".*\\.mcr$");
|
||||
// World pattern
|
||||
Pattern worldPattern = Pattern.compile(worldname + "\\$");
|
||||
for (Enumeration<? extends ZipEntry> e = zip.entries();
|
||||
e.hasMoreElements();) {
|
||||
for (Enumeration<? extends ZipEntry> e = zip.entries(); e.hasMoreElements(); ) {
|
||||
ZipEntry testEntry = (ZipEntry) e.nextElement();
|
||||
// Check for world
|
||||
if (worldPattern.matcher(worldname).matches()) {
|
||||
@ -158,8 +157,7 @@ public class TrueZipMcRegionChunkStore extends McRegionChunkStore {
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public boolean isValid() {
|
||||
for (Enumeration<? extends ZipEntry> e = zip.entries();
|
||||
e.hasMoreElements();) {
|
||||
for (Enumeration<? extends ZipEntry> e = zip.entries(); e.hasMoreElements(); ) {
|
||||
|
||||
ZipEntry testEntry = e.nextElement();
|
||||
|
||||
|
@ -109,8 +109,7 @@ public class ZippedLegacyChunkStore extends LegacyChunkStore {
|
||||
|
||||
// So not there either...
|
||||
if (testEntry == null) {
|
||||
for (Enumeration<? extends ZipEntry> e = zip.entries();
|
||||
e.hasMoreElements(); ) {
|
||||
for (Enumeration<? extends ZipEntry> e = zip.entries(); e.hasMoreElements(); ) {
|
||||
|
||||
testEntry = (ZipEntry) e.nextElement();
|
||||
|
||||
|
@ -95,8 +95,7 @@ public class ZippedMcRegionChunkStore extends McRegionChunkStore {
|
||||
}
|
||||
} else {
|
||||
Pattern pattern = Pattern.compile(".*\\.mcr$");
|
||||
for (Enumeration<? extends ZipEntry> e = zip.entries();
|
||||
e.hasMoreElements();) {
|
||||
for (Enumeration<? extends ZipEntry> e = zip.entries(); e.hasMoreElements(); ) {
|
||||
ZipEntry testEntry = (ZipEntry) e.nextElement();
|
||||
// Check for world
|
||||
if (testEntry.getName().startsWith(worldname + "/")) {
|
||||
@ -152,8 +151,7 @@ public class ZippedMcRegionChunkStore extends McRegionChunkStore {
|
||||
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
for (Enumeration<? extends ZipEntry> e = zip.entries();
|
||||
e.hasMoreElements();) {
|
||||
for (Enumeration<? extends ZipEntry> e = zip.entries(); e.hasMoreElements(); ) {
|
||||
|
||||
ZipEntry testEntry = e.nextElement();
|
||||
|
||||
|
@ -100,8 +100,7 @@ public class Expression {
|
||||
|
||||
try {
|
||||
return root.getValue();
|
||||
}
|
||||
catch (ReturnException e) {
|
||||
} catch (ReturnException e) {
|
||||
return e.getValue();
|
||||
}
|
||||
}
|
||||
|
@ -182,8 +182,7 @@ public class Parser {
|
||||
if (peek().id() == ';') {
|
||||
++position;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
break loop;
|
||||
}
|
||||
|
||||
@ -205,8 +204,7 @@ public class Parser {
|
||||
break loop;
|
||||
}
|
||||
break;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
break loop;
|
||||
}
|
||||
}
|
||||
|
@ -231,11 +231,9 @@ public final class ParserProcessors {
|
||||
final Identifiable last = input.removeLast();
|
||||
if (last instanceof OperatorToken) {
|
||||
postfixes.addLast(new UnaryOperator(last.getPosition(), "x" + ((OperatorToken) last).operator));
|
||||
}
|
||||
else if (last instanceof UnaryOperator) {
|
||||
} else if (last instanceof UnaryOperator) {
|
||||
postfixes.addLast(new UnaryOperator(last.getPosition(), "x" + ((UnaryOperator) last).operator));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
center = last;
|
||||
break;
|
||||
}
|
||||
|
@ -17,8 +17,7 @@ public class Conditional extends Node {
|
||||
public double getValue() throws EvaluationException {
|
||||
if (condition.getValue() > 0.0) {
|
||||
return truePart.getValue();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return falsePart == null ? 0 : falsePart.getValue();
|
||||
}
|
||||
}
|
||||
|
@ -28,8 +28,7 @@ public class For extends Node {
|
||||
|
||||
try {
|
||||
ret = body.getValue();
|
||||
}
|
||||
catch (BreakException e) {
|
||||
} catch (BreakException e) {
|
||||
if (e.doContinue) {
|
||||
continue;
|
||||
} else {
|
||||
|
@ -90,14 +90,12 @@ public final class Functions {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static final Function getFunction(int position, String name, RValue... args) throws NoSuchMethodException {
|
||||
final Method getter = getMethod(name, false, args);
|
||||
try {
|
||||
Method setter = getMethod(name, true, args);
|
||||
return new LValueFunction(position, getter, setter, args);
|
||||
}
|
||||
catch (NoSuchMethodException e) {
|
||||
} catch (NoSuchMethodException e) {
|
||||
return new Function(position, getter, args);
|
||||
}
|
||||
}
|
||||
|
@ -28,5 +28,6 @@ import com.sk89q.worldedit.expression.Identifiable;
|
||||
*/
|
||||
public interface RValue extends Identifiable {
|
||||
public double getValue() throws EvaluationException;
|
||||
|
||||
public Node optimize() throws EvaluationException;
|
||||
}
|
||||
|
@ -27,8 +27,7 @@ public class While extends Node {
|
||||
|
||||
try {
|
||||
ret = body.getValue();
|
||||
}
|
||||
catch (BreakException e) {
|
||||
} catch (BreakException e) {
|
||||
if (e.doContinue) {
|
||||
continue;
|
||||
} else {
|
||||
@ -45,8 +44,7 @@ public class While extends Node {
|
||||
|
||||
try {
|
||||
ret = body.getValue();
|
||||
}
|
||||
catch (BreakException e) {
|
||||
} catch (BreakException e) {
|
||||
if (e.doContinue) {
|
||||
continue;
|
||||
} else {
|
||||
|
@ -92,8 +92,9 @@ public class HeightMapFilter {
|
||||
for (int ky = 0; ky < kh; ++ky) {
|
||||
int offsetY = y + ky - koy;
|
||||
// Clamp coordinates inside data
|
||||
if (offsetY < 0 || offsetY >= height)
|
||||
if (offsetY < 0 || offsetY >= height) {
|
||||
offsetY = y;
|
||||
}
|
||||
|
||||
offsetY *= width;
|
||||
|
||||
@ -104,8 +105,9 @@ public class HeightMapFilter {
|
||||
|
||||
int offsetX = x + kx - kox;
|
||||
// Clamp coordinates inside data
|
||||
if (offsetX < 0 || offsetX >= width)
|
||||
if (offsetX < 0 || offsetX >= width) {
|
||||
offsetX = x;
|
||||
}
|
||||
|
||||
z += f * inData[offsetY + offsetX];
|
||||
}
|
||||
|
@ -50,4 +50,3 @@ public class UnderOverlayMask implements Mask {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -35,36 +35,42 @@ public interface Region extends Iterable<BlockVector> {
|
||||
* @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();
|
||||
|
||||
/**
|
||||
* Get X-size.
|
||||
*
|
||||
* @return width
|
||||
*/
|
||||
public int getWidth();
|
||||
|
||||
/**
|
||||
* Get Y-size.
|
||||
*
|
||||
* @return height
|
||||
*/
|
||||
public int getHeight();
|
||||
|
||||
/**
|
||||
* Get Z-size.
|
||||
*
|
||||
* @return length
|
||||
*/
|
||||
public int getLength();
|
||||
|
||||
/**
|
||||
* Expand the region.
|
||||
*
|
||||
@ -72,6 +78,7 @@ public interface Region extends Iterable<BlockVector> {
|
||||
* @throws RegionOperationException
|
||||
*/
|
||||
public void expand(Vector change) throws RegionOperationException;
|
||||
|
||||
/**
|
||||
* Contract the region.
|
||||
*
|
||||
@ -79,6 +86,7 @@ public interface Region extends Iterable<BlockVector> {
|
||||
* @throws RegionOperationException
|
||||
*/
|
||||
public void contract(Vector change) throws RegionOperationException;
|
||||
|
||||
/**
|
||||
* Returns true based on whether the region contains the point,
|
||||
*
|
||||
@ -86,6 +94,7 @@ public interface Region extends Iterable<BlockVector> {
|
||||
* @return
|
||||
*/
|
||||
public boolean contains(Vector pt);
|
||||
|
||||
/**
|
||||
* Get a list of chunks.
|
||||
*
|
||||
|
@ -24,7 +24,9 @@ import javax.script.ScriptException;
|
||||
|
||||
public interface CraftScriptEngine {
|
||||
public void setTimeLimit(int milliseconds);
|
||||
|
||||
public int getTimeLimit();
|
||||
|
||||
public Object evaluate(String script, String filename, Map<String, Object> args)
|
||||
throws ScriptException, Throwable;
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
package com.sk89q.worldedit.snapshots;
|
||||
// $Id$
|
||||
/*
|
||||
* WorldEdit
|
||||
@ -18,6 +17,8 @@ package com.sk89q.worldedit.snapshots;
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.snapshots;
|
||||
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.regions.*;
|
||||
import com.sk89q.worldedit.blocks.*;
|
||||
@ -141,8 +142,7 @@ public class SnapshotRestore {
|
||||
errorChunks = new ArrayList<Vector2D>();
|
||||
|
||||
// Now let's start restoring!
|
||||
for (Map.Entry<BlockVector2D,ArrayList<Vector>> entry :
|
||||
neededChunks.entrySet()) {
|
||||
for (Map.Entry<BlockVector2D, ArrayList<Vector>> entry : neededChunks.entrySet()) {
|
||||
BlockVector2D chunkPos = entry.getKey();
|
||||
Chunk chunk;
|
||||
|
||||
|
@ -134,8 +134,7 @@ public class TargetBlock {
|
||||
* @return Block
|
||||
*/
|
||||
public BlockWorldVector getTargetBlock() {
|
||||
while ((getNextBlock() != null)
|
||||
&& (world.getBlockType(getCurrentBlock()) == 0));
|
||||
while (getNextBlock() != null && world.getBlockType(getCurrentBlock()) == 0) ;
|
||||
return getCurrentBlock();
|
||||
}
|
||||
|
||||
@ -146,8 +145,7 @@ public class TargetBlock {
|
||||
* @return Block
|
||||
*/
|
||||
public BlockWorldVector getSolidTargetBlock() {
|
||||
while ((getNextBlock() != null)
|
||||
&& BlockType.canPassThrough(world.getBlockType(getCurrentBlock())));
|
||||
while (getNextBlock() != null && BlockType.canPassThrough(world.getBlockType(getCurrentBlock()))) ;
|
||||
return getCurrentBlock();
|
||||
}
|
||||
|
||||
|
@ -75,8 +75,7 @@ public class BlockDataTest {
|
||||
public void testCycle() {
|
||||
// Test monotony
|
||||
for (int type = 0; type < 256; ++type) {
|
||||
if (type == BlockID.CLOTH)
|
||||
continue;
|
||||
if (type == BlockID.CLOTH) continue;
|
||||
|
||||
for (int data = 0; data < 16; ++data) {
|
||||
final String message = type + "/" + data;
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren