mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-17 14:03:55 +00:00
Cleanup
This commit is contained in:
@ -31,15 +31,15 @@ import com.sk89q.worldedit.blocks.BlockID;
|
||||
public class AreaPickaxe implements BlockTool {
|
||||
private static final BaseBlock air = new BaseBlock(0);
|
||||
private int range;
|
||||
|
||||
|
||||
public AreaPickaxe(int range) {
|
||||
this.range = range;
|
||||
}
|
||||
|
||||
|
||||
public boolean canUse(LocalPlayer player) {
|
||||
return player.hasPermission("worldedit.superpickaxe.area");
|
||||
}
|
||||
|
||||
|
||||
public boolean actPrimary(ServerInterface server, LocalConfiguration config,
|
||||
LocalPlayer player, LocalSession session, WorldVector clicked) {
|
||||
LocalWorld world = clicked.getWorld();
|
||||
@ -47,17 +47,17 @@ public class AreaPickaxe implements BlockTool {
|
||||
int oy = clicked.getBlockY();
|
||||
int oz = clicked.getBlockZ();
|
||||
int initialType = world.getBlockType(clicked);
|
||||
|
||||
|
||||
if (initialType == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (initialType == BlockID.BEDROCK && !player.canDestroyBedrock()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
|
||||
|
||||
try {
|
||||
for (int x = ox - range; x <= ox + range; ++x) {
|
||||
for (int y = oy - range; y <= oy + range; ++y) {
|
||||
@ -67,7 +67,7 @@ public class AreaPickaxe implements BlockTool {
|
||||
if (config.superPickaxeManyDrop) {
|
||||
world.simulateBlockMine(pos);
|
||||
}
|
||||
|
||||
|
||||
editSession.setBlock(pos, air);
|
||||
}
|
||||
}
|
||||
@ -78,7 +78,7 @@ public class AreaPickaxe implements BlockTool {
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -31,23 +31,23 @@ import com.sk89q.worldedit.blocks.BlockType;
|
||||
*/
|
||||
public class BlockReplacer implements DoubleActionBlockTool {
|
||||
private BaseBlock targetBlock;
|
||||
|
||||
|
||||
public BlockReplacer(BaseBlock targetBlock) {
|
||||
this.targetBlock = targetBlock;
|
||||
}
|
||||
|
||||
|
||||
public boolean canUse(LocalPlayer player) {
|
||||
return player.hasPermission("worldedit.tool.replacer");
|
||||
}
|
||||
|
||||
|
||||
public boolean actPrimary(ServerInterface server, LocalConfiguration config,
|
||||
LocalPlayer player, LocalSession session, WorldVector clicked) {
|
||||
|
||||
BlockBag bag = session.getBlockBag(player);
|
||||
|
||||
|
||||
LocalWorld world = clicked.getWorld();
|
||||
EditSession editSession = new EditSession(world, -1, bag);
|
||||
|
||||
|
||||
try {
|
||||
editSession.setBlock(clicked, targetBlock);
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
@ -57,7 +57,7 @@ public class BlockReplacer implements DoubleActionBlockTool {
|
||||
}
|
||||
session.remember(editSession);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -68,11 +68,11 @@ public class BlockReplacer implements DoubleActionBlockTool {
|
||||
LocalWorld world = clicked.getWorld();
|
||||
targetBlock = (new EditSession(world, -1)).getBlock(clicked);
|
||||
BlockType type = BlockType.fromID(targetBlock.getType());
|
||||
|
||||
|
||||
if (type != null) {
|
||||
player.print("Replacer tool switched to: " + type.getName());
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ public class BrushTool implements TraceTool {
|
||||
private Pattern material = new SingleBlockPattern(new BaseBlock(BlockID.COBBLESTONE));
|
||||
private double size = 1;
|
||||
private String permission;
|
||||
|
||||
|
||||
/**
|
||||
* Construct the tool.
|
||||
*
|
||||
@ -52,7 +52,7 @@ public class BrushTool implements TraceTool {
|
||||
public BrushTool(String permission) {
|
||||
this.permission = permission;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks to see if the player can still be using this tool (considering
|
||||
* permissions and such).
|
||||
@ -63,7 +63,7 @@ public class BrushTool implements TraceTool {
|
||||
public boolean canUse(LocalPlayer player) {
|
||||
return player.hasPermission(permission);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the filter.
|
||||
*
|
||||
@ -92,7 +92,7 @@ public class BrushTool implements TraceTool {
|
||||
this.brush = brush;
|
||||
this.permission = perm;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the current brush.
|
||||
*
|
||||
@ -101,7 +101,7 @@ public class BrushTool implements TraceTool {
|
||||
public Brush getBrush() {
|
||||
return brush;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the material.
|
||||
*
|
||||
@ -110,7 +110,7 @@ public class BrushTool implements TraceTool {
|
||||
public void setFill(Pattern material) {
|
||||
this.material = material;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the material.
|
||||
*
|
||||
@ -137,7 +137,7 @@ public class BrushTool implements TraceTool {
|
||||
public void setSize(double radius) {
|
||||
this.size = radius;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the set brush range.
|
||||
*
|
||||
@ -168,14 +168,14 @@ public class BrushTool implements TraceTool {
|
||||
LocalPlayer player, LocalSession session) {
|
||||
WorldVector target = null;
|
||||
target = player.getBlockTrace(getRange(), true);
|
||||
|
||||
|
||||
if (target == null) {
|
||||
player.printError("No block in sight!");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
BlockBag bag = session.getBlockBag(player);
|
||||
|
||||
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
Mask existingMask = editSession.getMask();
|
||||
if (existingMask == null) {
|
||||
@ -187,7 +187,7 @@ public class BrushTool implements TraceTool {
|
||||
newMask.add(mask);
|
||||
editSession.setMask(newMask);
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
brush.build(editSession, target, material, size);
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
@ -198,7 +198,7 @@ public class BrushTool implements TraceTool {
|
||||
}
|
||||
session.remember(editSession);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -35,19 +35,19 @@ import com.sk89q.worldedit.blocks.BlockID;
|
||||
public class FloatingTreeRemover implements BlockTool {
|
||||
private static final BaseBlock air = new BaseBlock(BlockID.AIR);
|
||||
private int range;
|
||||
|
||||
|
||||
public FloatingTreeRemover() {
|
||||
this.range = 100;
|
||||
}
|
||||
|
||||
|
||||
public boolean canUse(LocalPlayer player) {
|
||||
return player.hasPermission("worldedit.tool.deltree");
|
||||
}
|
||||
|
||||
|
||||
public boolean actPrimary(ServerInterface server, LocalConfiguration config,
|
||||
LocalPlayer player, LocalSession session, WorldVector clicked) {
|
||||
LocalWorld world = clicked.getWorld();
|
||||
|
||||
|
||||
int initialType = world.getBlockType(clicked);
|
||||
int block;
|
||||
|
||||
@ -60,7 +60,7 @@ public class FloatingTreeRemover implements BlockTool {
|
||||
player.printError("That's not a floating tree.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
HashSet<BlockVector> blockSet = new HashSet<BlockVector>();
|
||||
try {
|
||||
if (!recurse(server, editSession, world, clicked.toBlockVector(),
|
||||
@ -105,7 +105,7 @@ public class FloatingTreeRemover implements BlockTool {
|
||||
Vector origin, int size,
|
||||
Set<BlockVector> visited, int lastBlock)
|
||||
throws MaxChangedBlocksException {
|
||||
|
||||
|
||||
if (origin.distance(pos) > size || visited.contains(pos)) {
|
||||
return true;
|
||||
}
|
||||
@ -113,7 +113,7 @@ public class FloatingTreeRemover implements BlockTool {
|
||||
visited.add(pos);
|
||||
|
||||
int block = editSession.getBlock(pos).getType();
|
||||
if (block == BlockID.AIR || block == BlockID.SNOW){
|
||||
if (block == BlockID.AIR || block == BlockID.SNOW) {
|
||||
return true;
|
||||
}
|
||||
if (block != BlockID.LOG
|
||||
@ -125,7 +125,7 @@ public class FloatingTreeRemover implements BlockTool {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
for (int i = -1; i <= 1; ++i) {
|
||||
|
@ -33,22 +33,22 @@ import com.sk89q.worldedit.patterns.Pattern;
|
||||
public class FloodFillTool implements BlockTool {
|
||||
private int range;
|
||||
private Pattern pattern;
|
||||
|
||||
|
||||
public FloodFillTool(int range, Pattern pattern) {
|
||||
this.range = range;
|
||||
this.pattern = pattern;
|
||||
}
|
||||
|
||||
|
||||
public boolean canUse(LocalPlayer player) {
|
||||
return player.hasPermission("worldedit.tool.flood-fill");
|
||||
}
|
||||
|
||||
|
||||
public boolean actPrimary(ServerInterface server, LocalConfiguration config,
|
||||
LocalPlayer player, LocalSession session, WorldVector clicked) {
|
||||
LocalWorld world = clicked.getWorld();
|
||||
|
||||
|
||||
int initialType = world.getBlockType(clicked);
|
||||
|
||||
|
||||
if (initialType == BlockID.AIR) {
|
||||
return true;
|
||||
}
|
||||
@ -88,7 +88,7 @@ public class FloodFillTool implements BlockTool {
|
||||
Vector origin, int size, int initialType,
|
||||
Set<BlockVector> visited)
|
||||
throws MaxChangedBlocksException {
|
||||
|
||||
|
||||
if (origin.distance(pos) > size || visited.contains(pos)) {
|
||||
return;
|
||||
}
|
||||
|
@ -28,14 +28,14 @@ import com.sk89q.worldedit.blocks.*;
|
||||
* @author sk89q
|
||||
*/
|
||||
public class QueryTool implements BlockTool {
|
||||
|
||||
|
||||
public boolean canUse(LocalPlayer player) {
|
||||
return player.hasPermission("worldedit.tool.info");
|
||||
}
|
||||
|
||||
public boolean actPrimary(ServerInterface server, LocalConfiguration config,
|
||||
LocalPlayer player, LocalSession session, WorldVector clicked) {
|
||||
|
||||
|
||||
LocalWorld world = clicked.getWorld();
|
||||
BaseBlock block = (new EditSession(world, 0)).rawGetBlock(clicked);
|
||||
BlockType type = BlockType.fromID(block.getType());
|
||||
@ -48,16 +48,16 @@ public class QueryTool implements BlockTool {
|
||||
|
||||
if (block instanceof MobSpawnerBlock) {
|
||||
player.printRaw("\u00A7e" + "Mob Type: "
|
||||
+ ((MobSpawnerBlock)block).getMobType());
|
||||
+ ((MobSpawnerBlock) block).getMobType());
|
||||
} else if (block instanceof NoteBlock) {
|
||||
player.printRaw("\u00A7e" + "Note block: "
|
||||
+ ((NoteBlock)block).getNote());
|
||||
+ ((NoteBlock) block).getNote());
|
||||
} else if (block.getType() == BlockID.CLOTH) {
|
||||
// Should never be null
|
||||
player.printRaw("\u00A7e" + "Color: "
|
||||
+ ClothColor.fromID(block.getData()).getName());
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -34,21 +34,21 @@ import com.sk89q.worldedit.blocks.BlockID;
|
||||
public class RecursivePickaxe implements BlockTool {
|
||||
private static final BaseBlock air = new BaseBlock(0);
|
||||
private double range;
|
||||
|
||||
|
||||
public RecursivePickaxe(double range) {
|
||||
this.range = range;
|
||||
}
|
||||
|
||||
|
||||
public boolean canUse(LocalPlayer player) {
|
||||
return player.hasPermission("worldedit.superpickaxe.recursive");
|
||||
}
|
||||
|
||||
|
||||
public boolean actPrimary(ServerInterface server, LocalConfiguration config,
|
||||
LocalPlayer player, LocalSession session, WorldVector clicked) {
|
||||
LocalWorld world = clicked.getWorld();
|
||||
|
||||
|
||||
int initialType = world.getBlockType(clicked);
|
||||
|
||||
|
||||
if (initialType == BlockID.AIR) {
|
||||
return true;
|
||||
}
|
||||
@ -89,7 +89,7 @@ public class RecursivePickaxe implements BlockTool {
|
||||
Vector origin, double size, int initialType,
|
||||
Set<BlockVector> visited, boolean drop)
|
||||
throws MaxChangedBlocksException {
|
||||
|
||||
|
||||
if (origin.distance(pos) > size || visited.contains(pos)) {
|
||||
return;
|
||||
}
|
||||
|
@ -28,15 +28,15 @@ import com.sk89q.worldedit.blocks.BlockID;
|
||||
* @author sk89q
|
||||
*/
|
||||
public class SinglePickaxe implements BlockTool {
|
||||
|
||||
|
||||
public boolean canUse(LocalPlayer player) {
|
||||
return player.hasPermission("worldedit.superpickaxe");
|
||||
}
|
||||
|
||||
|
||||
public boolean actPrimary(ServerInterface server, LocalConfiguration config,
|
||||
LocalPlayer player, LocalSession session, WorldVector clicked) {
|
||||
LocalWorld world = clicked.getWorld();
|
||||
|
||||
|
||||
if (world.getBlockType(clicked) == BlockID.BEDROCK
|
||||
&& !player.canDestroyBedrock()) {
|
||||
return true;
|
||||
@ -45,9 +45,9 @@ public class SinglePickaxe implements BlockTool {
|
||||
if (config.superPickaxeDrop) {
|
||||
world.simulateBlockMine(clicked);
|
||||
}
|
||||
|
||||
|
||||
world.setBlockType(clicked, BlockID.AIR);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ import com.sk89q.worldedit.LocalPlayer;
|
||||
* @author sk89q
|
||||
*/
|
||||
public abstract interface Tool {
|
||||
|
||||
|
||||
/**
|
||||
* Checks to see if the player can still be using this tool (considering
|
||||
* permissions and such).
|
||||
@ -37,5 +37,5 @@ public abstract interface Tool {
|
||||
* @return
|
||||
*/
|
||||
public boolean canUse(LocalPlayer player);
|
||||
|
||||
|
||||
}
|
||||
|
@ -29,20 +29,20 @@ import com.sk89q.worldedit.util.TreeGenerator;
|
||||
*/
|
||||
public class TreePlanter implements BlockTool {
|
||||
private TreeGenerator gen;
|
||||
|
||||
|
||||
public TreePlanter(TreeGenerator gen) {
|
||||
this.gen = gen;
|
||||
}
|
||||
|
||||
|
||||
public boolean canUse(LocalPlayer player) {
|
||||
return player.hasPermission("worldedit.tool.tree");
|
||||
}
|
||||
|
||||
|
||||
public boolean actPrimary(ServerInterface server, LocalConfiguration config,
|
||||
LocalPlayer player, LocalSession session, WorldVector clicked) {
|
||||
|
||||
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
|
||||
|
||||
try {
|
||||
if (!gen.generate(editSession, clicked.add(0, 1, 0))) {
|
||||
player.printError("A tree can't go there.");
|
||||
@ -52,7 +52,7 @@ public class TreePlanter implements BlockTool {
|
||||
} finally {
|
||||
session.remember(editSession);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -28,12 +28,12 @@ import com.sk89q.worldedit.patterns.Pattern;
|
||||
public class ClipboardBrush implements Brush {
|
||||
private CuboidClipboard clipboard;
|
||||
private boolean noAir;
|
||||
|
||||
|
||||
public ClipboardBrush(CuboidClipboard clipboard, boolean noAir) {
|
||||
this.clipboard = clipboard;
|
||||
this.noAir = noAir;
|
||||
}
|
||||
|
||||
|
||||
public void build(EditSession editSession, Vector pos, Pattern mat, double size)
|
||||
throws MaxChangedBlocksException {
|
||||
clipboard.place(editSession, pos.subtract(clipboard.getSize().divide(2)), noAir);
|
||||
|
@ -26,11 +26,11 @@ import com.sk89q.worldedit.patterns.Pattern;
|
||||
|
||||
public class CylinderBrush implements Brush {
|
||||
private int height;
|
||||
|
||||
|
||||
public CylinderBrush(int height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
|
||||
public void build(EditSession editSession, Vector pos, Pattern mat, double size)
|
||||
throws MaxChangedBlocksException {
|
||||
editSession.makeCylinder(pos, mat, size, size, height, true);
|
||||
|
@ -26,11 +26,11 @@ import com.sk89q.worldedit.patterns.Pattern;
|
||||
|
||||
public class HollowCylinderBrush implements Brush {
|
||||
private int height;
|
||||
|
||||
|
||||
public HollowCylinderBrush(int height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
|
||||
public void build(EditSession editSession, Vector pos, Pattern mat, double size)
|
||||
throws MaxChangedBlocksException {
|
||||
editSession.makeCylinder(pos, mat, size, size, height, false);
|
||||
|
@ -27,7 +27,7 @@ import com.sk89q.worldedit.patterns.Pattern;
|
||||
public class HollowSphereBrush implements Brush {
|
||||
public HollowSphereBrush() {
|
||||
}
|
||||
|
||||
|
||||
public void build(EditSession editSession, Vector pos, Pattern mat, double size)
|
||||
throws MaxChangedBlocksException {
|
||||
editSession.makeSphere(pos, mat, size, size, size, false);
|
||||
|
@ -32,7 +32,7 @@ import com.sk89q.worldedit.regions.Region;
|
||||
public class SmoothBrush implements Brush {
|
||||
private int iterations;
|
||||
private boolean naturalOnly;
|
||||
|
||||
|
||||
public SmoothBrush(int iterations) {
|
||||
this(iterations, false);
|
||||
}
|
||||
@ -41,7 +41,7 @@ public class SmoothBrush implements Brush {
|
||||
this.iterations = iterations;
|
||||
this.naturalOnly = naturalOnly;
|
||||
}
|
||||
|
||||
|
||||
public void build(EditSession editSession, Vector pos, Pattern mat, double size)
|
||||
throws MaxChangedBlocksException {
|
||||
double rad = size;
|
||||
|
@ -27,7 +27,7 @@ import com.sk89q.worldedit.patterns.Pattern;
|
||||
public class SphereBrush implements Brush {
|
||||
public SphereBrush() {
|
||||
}
|
||||
|
||||
|
||||
public void build(EditSession editSession, Vector pos, Pattern mat, double size)
|
||||
throws MaxChangedBlocksException {
|
||||
editSession.makeSphere(pos, mat, size, size, size, true);
|
||||
|
Reference in New Issue
Block a user