From 74a03b2b19e02efcbf01f709729fab8f2cb52e58 Mon Sep 17 00:00:00 2001
From: Jesse Boyd
Date: Thu, 31 Mar 2016 20:23:10 +1100
Subject: [PATCH] cleanup
---
src/main/java/com/boydti/fawe/Fawe.java | 84 +-
src/main/java/com/boydti/fawe/FaweAPI.java | 84 +-
src/main/java/com/boydti/fawe/FaweCache.java | 14 +-
src/main/java/com/boydti/fawe/IFawe.java | 18 +-
.../com/boydti/fawe/bukkit/BukkitCommand.java | 10 +-
.../com/boydti/fawe/bukkit/BukkitPlayer.java | 40 +-
.../com/boydti/fawe/bukkit/BukkitTaskMan.java | 32 +-
.../com/boydti/fawe/bukkit/FaweBukkit.java | 96 +-
.../com/boydti/fawe/bukkit/VaultUtil.java | 6 +-
.../com/boydti/fawe/bukkit/WEListener.java | 92 +-
.../bukkit/regions/BukkitMaskManager.java | 2 +-
.../fawe/bukkit/regions/FactionsFeature.java | 10 +-
.../bukkit/regions/FactionsUUIDFeature.java | 46 +-
.../boydti/fawe/bukkit/regions/FaweMask.java | 58 +-
.../regions/GriefPreventionFeature.java | 10 +-
.../fawe/bukkit/regions/PlotMeFeature.java | 16 +-
.../bukkit/regions/PlotSquaredFeature.java | 12 +-
.../bukkit/regions/PreciousStonesFeature.java | 10 +-
.../fawe/bukkit/regions/ResidenceFeature.java | 10 +-
.../fawe/bukkit/regions/TownyFeature.java | 12 +-
.../fawe/bukkit/regions/Worldguard.java | 32 +-
.../bukkit/v0/BukkitEditSessionWrapper_0.java | 18 +-
.../boydti/fawe/bukkit/v0/BukkitQueue_0.java | 130 +--
.../fawe/bukkit/v1_8/BukkitChunk_1_8.java | 99 +-
.../v1_8/BukkitEditSessionWrapper_1_8.java | 36 +-
.../fawe/bukkit/v1_8/BukkitQueue_1_8.java | 220 ++--
.../fawe/bukkit/v1_8/FaweGenerator_1_8.java | 142 +--
.../fawe/bukkit/v1_9/BukkitChunk_1_9.java | 103 +-
.../fawe/bukkit/v1_9/BukkitQueue_1_9.java | 195 ++--
.../com/boydti/fawe/command/FixLighting.java | 32 +-
.../java/com/boydti/fawe/command/Stream.java | 6 +-
.../java/com/boydti/fawe/command/Wea.java | 10 +-
.../boydti/fawe/command/WorldEditRegion.java | 16 +-
src/main/java/com/boydti/fawe/config/BBC.java | 44 +-
.../java/com/boydti/fawe/config/Settings.java | 9 +-
.../boydti/fawe/logging/BlocksHubHook.java | 8 +-
.../boydti/fawe/logging/LoggingExtent.java | 86 +-
.../java/com/boydti/fawe/object/ChunkLoc.java | 34 +-
.../fawe/object/EditSessionWrapper.java | 14 +-
.../fawe/object/FastWorldEditExtent.java | 76 +-
.../com/boydti/fawe/object/FaweChangeSet.java | 20 +-
.../com/boydti/fawe/object/FaweChunk.java | 36 +-
.../com/boydti/fawe/object/FaweCommand.java | 8 +-
.../com/boydti/fawe/object/FaweLocation.java | 23 +-
.../com/boydti/fawe/object/FawePlayer.java | 54 +-
.../com/boydti/fawe/object/HistoryExtent.java | 58 +-
.../com/boydti/fawe/object/IntegerPair.java | 36 +-
.../com/boydti/fawe/object/NullExtent.java | 24 +-
.../boydti/fawe/object/ProcessedWEExtent.java | 116 +-
.../com/boydti/fawe/object/PseudoRandom.java | 20 +-
.../com/boydti/fawe/object/RegionWrapper.java | 20 +-
.../com/boydti/fawe/object/SendChunk.java | 4 +-
.../boydti/fawe/regions/FaweMaskManager.java | 10 +-
.../com/boydti/fawe/util/ExtentWrapper.java | 2 +-
.../java/com/boydti/fawe/util/FaweQueue.java | 22 +-
src/main/java/com/boydti/fawe/util/Lag.java | 12 +-
.../java/com/boydti/fawe/util/MainUtil.java | 2 +-
.../java/com/boydti/fawe/util/MemUtil.java | 12 +-
src/main/java/com/boydti/fawe/util/Perm.java | 14 +-
.../com/boydti/fawe/util/ReflectionUtils.java | 178 +--
.../boydti/fawe/util/SafeExtentWrapper.java | 12 +-
.../java/com/boydti/fawe/util/SetQueue.java | 84 +-
.../java/com/boydti/fawe/util/StringMan.java | 50 +-
.../com/boydti/fawe/util/TaskManager.java | 16 +-
.../java/com/boydti/fawe/util/WEManager.java | 24 +-
.../com/boydti/fawe/util/WESubscriber.java | 5 +-
.../java/com/sk89q/worldedit/EditSession.java | 1009 ++++++++---------
.../worldedit/command/DispatcherWrapper.java | 84 +-
.../command/FlattenedClipboardTransform.java | 39 +-
.../worldedit/command/SchematicCommands.java | 84 +-
.../worldedit/command/ScriptingCommands.java | 38 +-
.../function/operation/Operations.java | 12 +-
.../function/visitor/BreadthFirstSearch.java | 82 +-
.../function/visitor/DownwardVisitor.java | 16 +-
.../function/visitor/EntityVisitor.java | 26 +-
.../function/visitor/FlatRegionVisitor.java | 26 +-
.../function/visitor/LayerVisitor.java | 38 +-
.../function/visitor/NonRisingVisitor.java | 8 +-
.../function/visitor/RecursiveVisitor.java | 10 +-
.../function/visitor/RegionVisitor.java | 30 +-
80 files changed, 2161 insertions(+), 2175 deletions(-)
diff --git a/src/main/java/com/boydti/fawe/Fawe.java b/src/main/java/com/boydti/fawe/Fawe.java
index 9d66523c..55ca7bd1 100644
--- a/src/main/java/com/boydti/fawe/Fawe.java
+++ b/src/main/java/com/boydti/fawe/Fawe.java
@@ -43,7 +43,7 @@ public class Fawe {
* The FAWE instance;
*/
private static Fawe INSTANCE;
-
+
/**
* Get the implementation specific class
* @return
@@ -52,7 +52,7 @@ public class Fawe {
public static T imp() {
return INSTANCE != null ? (T) INSTANCE.IMP : null;
}
-
+
/**
* Get the implementation independent class
* @return
@@ -60,7 +60,7 @@ public class Fawe {
public static Fawe get() {
return INSTANCE;
}
-
+
/**
* Setup Fawe
* @param implementation
@@ -75,7 +75,7 @@ public class Fawe {
}
INSTANCE = new Fawe(implementation);
}
-
+
/**
* Write something to the console
* @param s
@@ -87,79 +87,79 @@ public class Fawe {
System.out.print(s);
}
}
-
+
/**
* The platform specific implementation
*/
private final IFawe IMP;
private Thread thread = Thread.currentThread();
-
+
private Fawe(final IFawe implementation) {
- IMP = implementation;
-
+ this.IMP = implementation;
+
this.thread = Thread.currentThread();
/*
* Implementation dependent stuff
*/
- setupConfigs();
- setupCommands();
-
+ this.setupConfigs();
+ this.setupCommands();
+
// TODO command event - queue?
- TaskManager.IMP = IMP.getTaskManager();
- SetQueue.IMP.queue = IMP.getQueue();
-
+ TaskManager.IMP = this.IMP.getTaskManager();
+ SetQueue.IMP.queue = this.IMP.getQueue();
+
// Delayed setup
TaskManager.IMP.later(new Runnable() {
@Override
public void run() {
// worldedit
- WEManager.IMP.managers.addAll(IMP.getMaskManagers());
- worldedit = WorldEdit.getInstance();
+ WEManager.IMP.managers.addAll(Fawe.this.IMP.getMaskManagers());
+ Fawe.this.worldedit = WorldEdit.getInstance();
// Events
- setupEvents();
- IMP.setupVault();
+ Fawe.this.setupEvents();
+ Fawe.this.IMP.setupVault();
}
}, 0);
-
+
/*
* Instance independent stuff
*/
- setupInjector();
- setupMemoryListener();
-
+ this.setupInjector();
+ this.setupMemoryListener();
+
// Lag
final Lag lag = new Lag();
TaskManager.IMP.repeat(lag, 100);
}
-
+
private void setupEvents() {
WorldEdit.getInstance().getEventBus().register(new WESubscriber());
if (Settings.COMMAND_PROCESSOR) {
- IMP.setupWEListener();
+ this.IMP.setupWEListener();
}
}
-
+
private void setupCommands() {
- IMP.setupCommand("wea", new Wea());
- IMP.setupCommand("fixlighting", new FixLighting());
- IMP.setupCommand("stream", new Stream());
- IMP.setupCommand("wrg", new WorldEditRegion());
+ this.IMP.setupCommand("wea", new Wea());
+ this.IMP.setupCommand("fixlighting", new FixLighting());
+ this.IMP.setupCommand("stream", new Stream());
+ this.IMP.setupCommand("wrg", new WorldEditRegion());
}
-
+
private void setupConfigs() {
// Setting up config.yml
- Settings.setup(new File(IMP.getDirectory(), "config.yml"));
+ Settings.setup(new File(this.IMP.getDirectory(), "config.yml"));
// Setting up message.yml
- BBC.load(new File(IMP.getDirectory(), "message.yml"));
+ BBC.load(new File(this.IMP.getDirectory(), "message.yml"));
}
-
+
private WorldEdit worldedit;
-
+
public WorldEdit getWorldEdit() {
- return worldedit;
+ return this.worldedit;
}
-
+
private void setupInjector() {
EditSession.inject();
Operations.inject();
@@ -174,7 +174,7 @@ public class Fawe {
RecursiveVisitor.inject();
RegionVisitor.inject();
}
-
+
private void setupMemoryListener() {
final MemoryMXBean memBean = ManagementFactory.getMemoryMXBean();
final NotificationEmitter ne = (NotificationEmitter) memBean;
@@ -196,20 +196,20 @@ public class Fawe {
}
final long alert = (max * Settings.MEM_FREE) / 100;
mp.setUsageThreshold(alert);
-
+
}
}
}
-
+
public Thread getMainThread() {
- return thread;
+ return this.thread;
}
-
+
/*
* TODO FIXME
* - Async packet sending
* - Redo WEManager delay / command queue
* - Support older versions of bukkit
- * - Optimize lighting updates / chunk sending
+ * - Optimize lighting updates / chunk sending
*/
}
diff --git a/src/main/java/com/boydti/fawe/FaweAPI.java b/src/main/java/com/boydti/fawe/FaweAPI.java
index 8af8412e..55ac4cae 100644
--- a/src/main/java/com/boydti/fawe/FaweAPI.java
+++ b/src/main/java/com/boydti/fawe/FaweAPI.java
@@ -33,7 +33,7 @@ import com.sk89q.worldedit.world.biome.BaseBiome;
* FaweAPI.[some method]
*/
public class FaweAPI {
-
+
/**
* Compare two versions
* @param version
@@ -45,7 +45,7 @@ public class FaweAPI {
public static boolean checkVersion(final int[] version, final int major, final int minor, final int minor2) {
return (version[0] > major) || ((version[0] == major) && (version[1] > minor)) || ((version[0] == major) && (version[1] == minor) && (version[2] >= minor2));
}
-
+
/**
* Set a block at a location asynchronously
* @param loc
@@ -54,7 +54,7 @@ public class FaweAPI {
public static void setBlockAsync(final Location loc, final Material m) {
SetQueue.IMP.setBlock(loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), (short) m.getId());
}
-
+
/**
* Set a block at a location asynchronously
* @param world
@@ -67,7 +67,7 @@ public class FaweAPI {
public static void setBlockAsync(final String world, final int x, final int y, final int z, final short id, final byte data) {
SetQueue.IMP.setBlock(world, x, y, z, id, data);
}
-
+
/**
* Set a biome at a location asynchronously
* @param world
@@ -76,7 +76,7 @@ public class FaweAPI {
* @param id
* @param data
*/
- public static void setBiomeAsync(final String world, final int x, final int z, BaseBiome biome) {
+ public static void setBiomeAsync(final String world, final int x, final int z, final BaseBiome biome) {
SetQueue.IMP.setBiome(world, x, z, biome);
}
@@ -85,10 +85,10 @@ public class FaweAPI {
* @param loc
* @param biome
*/
- public static void setBiomeAsync(Location loc, BaseBiome biome) {
+ public static void setBiomeAsync(final Location loc, final BaseBiome biome) {
SetQueue.IMP.setBiome(loc.getWorld().getName(), loc.getBlockX(), loc.getBlockZ(), biome);
}
-
+
/**
* This will return a FaweChunk object that can be modified.
* - The FaweChunk object can be reused if you want identical changes across chunks
@@ -100,47 +100,47 @@ public class FaweAPI {
public static FaweChunk> createChunk() {
return SetQueue.IMP.queue.getChunk(new ChunkLoc(null, 0, 0));
}
-
+
/**
* @see #createChunk()
* @param data
* @param location
*/
- public static void setChunkAsync(FaweChunk> data, ChunkLoc location) {
+ public static void setChunkAsync(final FaweChunk> data, final ChunkLoc location) {
data.setChunkLoc(location);
data.addToQueue();
}
-
+
/**
* @see #createChunk()
* @param data
* @param chunk
*/
- public static void setChunkAsync(FaweChunk> data, Chunk chunk) {
- ChunkLoc loc = new ChunkLoc(chunk.getWorld().getName(), chunk.getX(), chunk.getZ());
+ public static void setChunkAsync(final FaweChunk> data, final Chunk chunk) {
+ final ChunkLoc loc = new ChunkLoc(chunk.getWorld().getName(), chunk.getX(), chunk.getZ());
data.setChunkLoc(loc);
data.addToQueue();
}
-
+
/**
* Fix the lighting at a chunk location.
* - The fixAll parameter determines if extensive relighting should occur (slow)
* @param loc
*/
- public static void fixLighting(ChunkLoc loc, boolean fixAll) {
+ public static void fixLighting(final ChunkLoc loc, final boolean fixAll) {
SetQueue.IMP.queue.fixLighting(SetQueue.IMP.queue.getChunk(loc), fixAll);
}
-
+
/**
* Fix the lighting at a chunk.
* - The fixAll parameter determines if extensive relighting should occur (slow)
* @param chunk
*/
- public static void fixLighting(Chunk chunk, boolean fixAll) {
- ChunkLoc loc = new ChunkLoc(chunk.getWorld().getName(), chunk.getX(), chunk.getZ());
+ public static void fixLighting(final Chunk chunk, final boolean fixAll) {
+ final ChunkLoc loc = new ChunkLoc(chunk.getWorld().getName(), chunk.getX(), chunk.getZ());
SetQueue.IMP.queue.fixLighting(SetQueue.IMP.queue.getChunk(loc), fixAll);
}
-
+
/**
* If a schematic is too large to be pasted normally
* - Skips any block history
@@ -150,10 +150,10 @@ public class FaweAPI {
* @return
*/
public static void streamSchematicAsync(final File file, final Location loc) {
- FaweLocation fl = new FaweLocation(loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
+ final FaweLocation fl = new FaweLocation(loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
streamSchematicAsync(file, fl);
}
-
+
/**
* If a schematic is too large to be pasted normally
* - Skips any block history
@@ -167,15 +167,15 @@ public class FaweAPI {
@Override
public void run() {
try {
- FileInputStream is = new FileInputStream(file);
+ final FileInputStream is = new FileInputStream(file);
streamSchematic(is, loc);
- } catch (IOException e) {
+ } catch (final IOException e) {
e.printStackTrace();
}
}
});
}
-
+
/**
* If a schematic is too large to be pasted normally
* - Skips any block history
@@ -188,16 +188,16 @@ public class FaweAPI {
@Override
public void run() {
try {
- ReadableByteChannel rbc = Channels.newChannel(url.openStream());
+ final ReadableByteChannel rbc = Channels.newChannel(url.openStream());
final InputStream is = Channels.newInputStream(rbc);
streamSchematic(is, loc);
- } catch (IOException e) {
+ } catch (final IOException e) {
e.printStackTrace();
}
}
});
}
-
+
/**
* If a schematic is too large to be pasted normally
* - Skips any block history
@@ -206,25 +206,25 @@ public class FaweAPI {
* @param loc
* @throws IOException
*/
- public static void streamSchematic(InputStream is, FaweLocation loc) throws IOException {
- NBTInputStream stream = new NBTInputStream(new GZIPInputStream(is));
+ public static void streamSchematic(final InputStream is, final FaweLocation loc) throws IOException {
+ final NBTInputStream stream = new NBTInputStream(new GZIPInputStream(is));
Tag tag = stream.readNamedTag().getTag();
stream.close();
Map tagMap = (Map) tag.getValue();
- short width = ShortTag.class.cast(tagMap.get("Width")).getValue();
- short length = ShortTag.class.cast(tagMap.get("Length")).getValue();
- short height = ShortTag.class.cast(tagMap.get("Height")).getValue();
+ final short width = ShortTag.class.cast(tagMap.get("Width")).getValue();
+ final short length = ShortTag.class.cast(tagMap.get("Length")).getValue();
+ final short height = ShortTag.class.cast(tagMap.get("Height")).getValue();
byte[] ids = ByteArrayTag.class.cast(tagMap.get("Blocks")).getValue();
byte[] datas = ByteArrayTag.class.cast(tagMap.get("Data")).getValue();
-
- String world = loc.world;
-
- int x_offset = loc.x + IntTag.class.cast(tagMap.get("WEOffsetX")).getValue();
- int y_offset = loc.y + IntTag.class.cast(tagMap.get("WEOffsetY")).getValue();
- int z_offset = loc.z + IntTag.class.cast(tagMap.get("WEOffsetZ")).getValue();
-
+
+ final String world = loc.world;
+
+ final int x_offset = loc.x + IntTag.class.cast(tagMap.get("WEOffsetX")).getValue();
+ final int y_offset = loc.y + IntTag.class.cast(tagMap.get("WEOffsetY")).getValue();
+ final int z_offset = loc.z + IntTag.class.cast(tagMap.get("WEOffsetZ")).getValue();
+
tagMap = null;
tag = null;
@@ -236,11 +236,11 @@ public class FaweAPI {
final int i1 = y * width * length;
for (int z = 0; z < length; z++) {
final int i2 = (z * width) + i1;
- int zz = z_offset + z;
+ final int zz = z_offset + z;
for (int x = 0; x < width; x++) {
final int i = i2 + x;
- int xx = x_offset + x;
- short id = (short) (ids[i] & 0xFF);
+ final int xx = x_offset + x;
+ final short id = (short) (ids[i] & 0xFF);
switch (id) {
case 0:
case 2:
@@ -318,7 +318,7 @@ public class FaweAPI {
}
}
}
-
+
ids = null;
datas = null;
System.gc();
diff --git a/src/main/java/com/boydti/fawe/FaweCache.java b/src/main/java/com/boydti/fawe/FaweCache.java
index 98eb3ea7..ec4e97e9 100644
--- a/src/main/java/com/boydti/fawe/FaweCache.java
+++ b/src/main/java/com/boydti/fawe/FaweCache.java
@@ -5,16 +5,16 @@ import com.boydti.fawe.object.PseudoRandom;
public class FaweCache {
public final static short[][][] CACHE_I = new short[256][16][16];
public final static short[][][] CACHE_J = new short[256][16][16];
-
+
public final static byte[][] CACHE_X = new byte[16][4096];
public final static short[][] CACHE_Y = new short[16][4096];
public final static byte[][] CACHE_Z = new byte[16][4096];
-
+
public final static short[] CACHE_ID = new short[65535];
public final static byte[] CACHE_DATA = new byte[65535];
-
+
public final static PseudoRandom RANDOM = new PseudoRandom();
-
+
static {
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
@@ -31,9 +31,9 @@ public class FaweCache {
}
for (int i = 0; i < 65535; i++) {
final int j = i >> 4;
- final int k = i & 0xF;
- CACHE_ID[i] = (short) j;
- CACHE_DATA[i] = (byte) k;
+ final int k = i & 0xF;
+ CACHE_ID[i] = (short) j;
+ CACHE_DATA[i] = (byte) k;
}
}
}
diff --git a/src/main/java/com/boydti/fawe/IFawe.java b/src/main/java/com/boydti/fawe/IFawe.java
index 7a6f2d90..aecf07cb 100644
--- a/src/main/java/com/boydti/fawe/IFawe.java
+++ b/src/main/java/com/boydti/fawe/IFawe.java
@@ -13,24 +13,24 @@ import com.sk89q.worldedit.EditSession;
public interface IFawe {
public void debug(final String s);
-
+
public File getDirectory();
-
+
public void setupCommand(final String label, final FaweCommand cmd);
-
+
public FawePlayer wrap(final Object obj);
-
+
public void setupWEListener();
-
+
public void setupVault();
public TaskManager getTaskManager();
-
+
public int[] getVersion();
-
+
public FaweQueue getQueue();
-
+
public EditSessionWrapper getEditSessionWrapper(final EditSession session);
-
+
public Collection getMaskManagers();
}
diff --git a/src/main/java/com/boydti/fawe/bukkit/BukkitCommand.java b/src/main/java/com/boydti/fawe/bukkit/BukkitCommand.java
index 4f795876..27ebfd96 100644
--- a/src/main/java/com/boydti/fawe/bukkit/BukkitCommand.java
+++ b/src/main/java/com/boydti/fawe/bukkit/BukkitCommand.java
@@ -10,16 +10,16 @@ import com.boydti.fawe.object.FaweCommand;
import com.boydti.fawe.object.FawePlayer;
public class BukkitCommand implements CommandExecutor {
-
+
private final FaweCommand cmd;
-
+
public BukkitCommand(final FaweCommand cmd) {
this.cmd = cmd;
}
-
+
@Override
public boolean onCommand(final CommandSender sender, final Command cmd, final String label, final String[] args) {
- FawePlayer plr = Fawe.imp().wrap(sender);
+ final FawePlayer plr = Fawe.imp().wrap(sender);
if (!sender.hasPermission(this.cmd.getPerm())) {
BBC.NO_PERM.send(plr, this.cmd.getPerm());
return true;
@@ -27,5 +27,5 @@ public class BukkitCommand implements CommandExecutor {
this.cmd.execute(plr, args);
return true;
}
-
+
}
diff --git a/src/main/java/com/boydti/fawe/bukkit/BukkitPlayer.java b/src/main/java/com/boydti/fawe/bukkit/BukkitPlayer.java
index 6e634dab..9943a712 100644
--- a/src/main/java/com/boydti/fawe/bukkit/BukkitPlayer.java
+++ b/src/main/java/com/boydti/fawe/bukkit/BukkitPlayer.java
@@ -12,56 +12,56 @@ import com.boydti.fawe.object.FaweLocation;
import com.boydti.fawe.object.FawePlayer;
public class BukkitPlayer extends FawePlayer {
-
+
public BukkitPlayer(final Player parent) {
super(parent);
}
-
+
@Override
public String getName() {
- return parent.getName();
+ return this.parent.getName();
}
-
+
@Override
public UUID getUUID() {
- return parent.getUniqueId();
+ return this.parent.getUniqueId();
}
-
+
@Override
public boolean hasPermission(final String perm) {
- return parent.hasPermission(perm);
+ return this.parent.hasPermission(perm);
}
-
+
@Override
public void setPermission(final String perm, final boolean flag) {
if (Fawe. imp().getVault() == null) {
- parent.addAttachment(Fawe. imp()).setPermission("fawe.bypass", flag);
+ this.parent.addAttachment(Fawe. imp()).setPermission("fawe.bypass", flag);
} else if (flag) {
- Fawe. imp().getVault().permission.playerAdd(parent, perm);
+ Fawe. imp().getVault().permission.playerAdd(this.parent, perm);
} else {
- Fawe. imp().getVault().permission.playerRemove(parent, perm);
+ Fawe. imp().getVault().permission.playerRemove(this.parent, perm);
}
}
-
+
@Override
public void sendMessage(final String message) {
- parent.sendMessage(ChatColor.translateAlternateColorCodes('&', message));
+ this.parent.sendMessage(ChatColor.translateAlternateColorCodes('&', message));
}
-
+
@Override
public void executeCommand(final String cmd) {
- Bukkit.getServer().dispatchCommand(parent, cmd);
+ Bukkit.getServer().dispatchCommand(this.parent, cmd);
}
-
+
@Override
public FaweLocation getLocation() {
- Location loc = parent.getLocation();
+ final Location loc = this.parent.getLocation();
return new FaweLocation(loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
}
-
+
@Override
public com.sk89q.worldedit.entity.Player getPlayer() {
- return Fawe. imp().getWorldEditPlugin().wrapPlayer(parent);
+ return Fawe. imp().getWorldEditPlugin().wrapPlayer(this.parent);
}
-
+
}
diff --git a/src/main/java/com/boydti/fawe/bukkit/BukkitTaskMan.java b/src/main/java/com/boydti/fawe/bukkit/BukkitTaskMan.java
index ca2e064b..56c634bb 100644
--- a/src/main/java/com/boydti/fawe/bukkit/BukkitTaskMan.java
+++ b/src/main/java/com/boydti/fawe/bukkit/BukkitTaskMan.java
@@ -9,55 +9,55 @@ import org.bukkit.plugin.Plugin;
import com.boydti.fawe.util.TaskManager;
public class BukkitTaskMan extends TaskManager {
-
+
private final Plugin plugin;
-
- public BukkitTaskMan(Plugin plugin) {
+
+ public BukkitTaskMan(final Plugin plugin) {
this.plugin = plugin;
}
@Override
public int repeat(final Runnable r, final int interval) {
- return plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, r, interval, interval);
+ return this.plugin.getServer().getScheduler().scheduleSyncRepeatingTask(this.plugin, r, interval, interval);
}
-
+
@Override
public int repeatAsync(final Runnable r, final int interval) {
- return plugin.getServer().getScheduler().scheduleAsyncRepeatingTask(plugin, r, interval, interval);
+ return this.plugin.getServer().getScheduler().scheduleAsyncRepeatingTask(this.plugin, r, interval, interval);
}
-
+
public MutableInt index = new MutableInt(0);
public HashMap tasks = new HashMap<>();
-
+
@Override
public void async(final Runnable r) {
if (r == null) {
return;
}
- plugin.getServer().getScheduler().runTaskAsynchronously(plugin, r).getTaskId();
+ this.plugin.getServer().getScheduler().runTaskAsynchronously(this.plugin, r).getTaskId();
}
-
+
@Override
public void task(final Runnable r) {
if (r == null) {
return;
}
- plugin.getServer().getScheduler().runTask(plugin, r).getTaskId();
+ this.plugin.getServer().getScheduler().runTask(this.plugin, r).getTaskId();
}
-
+
@Override
public void later(final Runnable r, final int delay) {
if (r == null) {
return;
}
- plugin.getServer().getScheduler().runTaskLater(plugin, r, delay).getTaskId();
+ this.plugin.getServer().getScheduler().runTaskLater(this.plugin, r, delay).getTaskId();
}
-
+
@Override
public void laterAsync(final Runnable r, final int delay) {
- plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, r, delay);
+ this.plugin.getServer().getScheduler().runTaskLaterAsynchronously(this.plugin, r, delay);
}
-
+
@Override
public void cancel(final int task) {
if (task != -1) {
diff --git a/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java b/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java
index 50cb817b..90044fea 100644
--- a/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java
+++ b/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java
@@ -37,53 +37,53 @@ import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
public class FaweBukkit extends JavaPlugin implements IFawe {
-
+
private VaultUtil vault;
private WorldEditPlugin worldedit;
-
+
public VaultUtil getVault() {
- return vault;
+ return this.vault;
}
-
+
public WorldEditPlugin getWorldEditPlugin() {
- if (worldedit == null) {
- worldedit = (WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit");
+ if (this.worldedit == null) {
+ this.worldedit = (WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit");
}
- return worldedit;
+ return this.worldedit;
}
-
+
@Override
public void onEnable() {
try {
Fawe.set(this);
try {
- Class> clazz = Class.forName("org.spigotmc.AsyncCatcher");
- Field field = clazz.getDeclaredField("enabled");
+ final Class> clazz = Class.forName("org.spigotmc.AsyncCatcher");
+ final Field field = clazz.getDeclaredField("enabled");
field.set(null, false);
- } catch (Throwable e) {
+ } catch (final Throwable e) {
e.printStackTrace();
}
- } catch (Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
- getServer().shutdown();
+ this.getServer().shutdown();
}
}
-
+
@Override
public void debug(final String s) {
- getLogger().info(ChatColor.translateAlternateColorCodes('&', s));
+ this.getLogger().info(ChatColor.translateAlternateColorCodes('&', s));
}
-
+
@Override
public File getDirectory() {
- return getDataFolder();
+ return this.getDataFolder();
}
-
+
@Override
public void setupCommand(final String label, final FaweCommand cmd) {
- getCommand(label).setExecutor(new BukkitCommand(cmd));
+ this.getCommand(label).setExecutor(new BukkitCommand(cmd));
}
-
+
@Override
public FawePlayer wrap(final Object obj) {
if (obj.getClass() == String.class) {
@@ -94,26 +94,26 @@ public class FaweBukkit extends JavaPlugin implements IFawe {
return null;
}
}
-
+
@Override
public void setupWEListener() {
- getServer().getPluginManager().registerEvents(new WEListener(), this);
+ this.getServer().getPluginManager().registerEvents(new WEListener(), this);
}
-
+
@Override
public void setupVault() {
try {
- vault = new VaultUtil();
+ this.vault = new VaultUtil();
} catch (final Throwable e) {
- debug("&cPlease install vault!");
+ this.debug("&cPlease install vault!");
}
}
-
+
@Override
public TaskManager getTaskManager() {
return new BukkitTaskMan(this);
}
-
+
@Override
public int[] getVersion() {
try {
@@ -127,51 +127,51 @@ public class FaweBukkit extends JavaPlugin implements IFawe {
return version;
} catch (final Exception e) {
e.printStackTrace();
- debug(StringMan.getString(Bukkit.getBukkitVersion()));
- debug(StringMan.getString(Bukkit.getBukkitVersion().split("-")[0].split("\\.")));
+ this.debug(StringMan.getString(Bukkit.getBukkitVersion()));
+ this.debug(StringMan.getString(Bukkit.getBukkitVersion().split("-")[0].split("\\.")));
return new int[] { Integer.MAX_VALUE, 0, 0 };
}
}
-
+
@Override
public FaweQueue getQueue() {
- if (FaweAPI.checkVersion(getServerVersion(), 1, 9, 0)) {
+ if (FaweAPI.checkVersion(this.getServerVersion(), 1, 9, 0)) {
try {
return new BukkitQueue_1_9();
- } catch (Throwable e) {
+ } catch (final Throwable e) {
e.printStackTrace();
}
}
return new BukkitQueue_1_8();
}
-
+
private int[] version;
public int[] getServerVersion() {
- if (version == null) {
+ if (this.version == null) {
try {
- version = new int[3];
+ this.version = new int[3];
final String[] split = Bukkit.getBukkitVersion().split("-")[0].split("\\.");
- version[0] = Integer.parseInt(split[0]);
- version[1] = Integer.parseInt(split[1]);
+ this.version[0] = Integer.parseInt(split[0]);
+ this.version[1] = Integer.parseInt(split[1]);
if (split.length == 3) {
- version[2] = Integer.parseInt(split[2]);
+ this.version[2] = Integer.parseInt(split[2]);
}
- } catch (NumberFormatException e) {
+ } catch (final NumberFormatException e) {
e.printStackTrace();
Fawe.debug(StringMan.getString(Bukkit.getBukkitVersion()));
Fawe.debug(StringMan.getString(Bukkit.getBukkitVersion().split("-")[0].split("\\.")));
return new int[] { Integer.MAX_VALUE, 0, 0 };
}
}
- return version;
+ return this.version;
}
@Override
public EditSessionWrapper getEditSessionWrapper(final EditSession session) {
return new BukkitEditSessionWrapper_1_8(session);
}
-
+
@Override
public Collection getMaskManagers() {
final Plugin worldguardPlugin = Bukkit.getServer().getPluginManager().getPlugin("WorldGuard");
@@ -180,7 +180,7 @@ public class FaweBukkit extends JavaPlugin implements IFawe {
try {
managers.add(new Worldguard(worldguardPlugin, this));
Fawe.debug("Plugin 'WorldGuard' found. Using it now.");
- } catch (Throwable e) {
+ } catch (final Throwable e) {
e.printStackTrace();
}
} else {
@@ -191,7 +191,7 @@ public class FaweBukkit extends JavaPlugin implements IFawe {
try {
managers.add(new PlotMeFeature(plotmePlugin, this));
Fawe.debug("Plugin 'PlotMe' found. Using it now.");
- } catch (Throwable e) {
+ } catch (final Throwable e) {
e.printStackTrace();
}
} else {
@@ -202,7 +202,7 @@ public class FaweBukkit extends JavaPlugin implements IFawe {
try {
managers.add(new TownyFeature(townyPlugin, this));
Fawe.debug("Plugin 'Towny' found. Using it now.");
- } catch (Throwable e) {
+ } catch (final Throwable e) {
e.printStackTrace();
}
} else {
@@ -225,7 +225,7 @@ public class FaweBukkit extends JavaPlugin implements IFawe {
try {
managers.add(new ResidenceFeature(residencePlugin, this));
Fawe.debug("Plugin 'Residence' found. Using it now.");
- } catch (Throwable e) {
+ } catch (final Throwable e) {
e.printStackTrace();
}
} else {
@@ -236,7 +236,7 @@ public class FaweBukkit extends JavaPlugin implements IFawe {
try {
managers.add(new GriefPreventionFeature(griefpreventionPlugin, this));
Fawe.debug("Plugin 'GriefPrevention' found. Using it now.");
- } catch (Throwable e) {
+ } catch (final Throwable e) {
e.printStackTrace();
}
} else {
@@ -247,7 +247,7 @@ public class FaweBukkit extends JavaPlugin implements IFawe {
try {
managers.add(new PlotSquaredFeature(plotsquaredPlugin, this));
Fawe.debug("Plugin 'PlotSquared' found. Using it now.");
- } catch (Throwable e) {
+ } catch (final Throwable e) {
e.printStackTrace();
}
} else {
@@ -258,7 +258,7 @@ public class FaweBukkit extends JavaPlugin implements IFawe {
try {
managers.add(new PreciousStonesFeature(preciousstonesPlugin, this));
Fawe.debug("Plugin 'PreciousStones' found. Using it now.");
- } catch (Throwable e) {
+ } catch (final Throwable e) {
e.printStackTrace();
}
} else {
diff --git a/src/main/java/com/boydti/fawe/bukkit/VaultUtil.java b/src/main/java/com/boydti/fawe/bukkit/VaultUtil.java
index 0f6e62b3..5deda5f8 100644
--- a/src/main/java/com/boydti/fawe/bukkit/VaultUtil.java
+++ b/src/main/java/com/boydti/fawe/bukkit/VaultUtil.java
@@ -7,13 +7,13 @@ import org.bukkit.plugin.RegisteredServiceProvider;
public class VaultUtil {
public final Permission permission;
-
+
public VaultUtil() {
final RegisteredServiceProvider permissionProvider = Bukkit.getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class);
if (permissionProvider != null) {
- permission = permissionProvider.getProvider();
+ this.permission = permissionProvider.getProvider();
} else {
- permission = null;
+ this.permission = null;
}
}
}
diff --git a/src/main/java/com/boydti/fawe/bukkit/WEListener.java b/src/main/java/com/boydti/fawe/bukkit/WEListener.java
index c849ad16..f87d4972 100644
--- a/src/main/java/com/boydti/fawe/bukkit/WEListener.java
+++ b/src/main/java/com/boydti/fawe/bukkit/WEListener.java
@@ -29,7 +29,7 @@ import com.sk89q.worldedit.regions.Region;
@Deprecated
public class WEListener implements Listener {
-
+
public final HashSet rad1 = new HashSet<>(Arrays.asList("forestgen", "pumpkins", "drain", "fixwater", "fixlava", "replacenear", "snow", "thaw", "ex", "butcher", "size"));
public final HashSet rad2 = new HashSet<>(Arrays.asList("fill", "fillr", "removenear", "remove"));
public final HashSet rad2_1 = new HashSet<>(Arrays.asList("hcyl", "cyl"));
@@ -37,7 +37,7 @@ public class WEListener implements Listener {
public final HashSet rad2_3 = new HashSet<>(Arrays.asList("brush smooth"));
public final HashSet rad3_1 = new HashSet<>(Arrays.asList("brush gravity"));
public final HashSet rad3_2 = new HashSet<>(Arrays.asList("brush sphere", "brush cylinder"));
-
+
public final HashSet region = new HashSet<>(Arrays.asList("move", "set", "replace", "overlay", "walls", "outline", "deform", "hollow", "smooth", "naturalize", "paste", "count", "distr",
"copy", "cut", "green", "setbiome"));
public final HashSet regionExtend = new HashSet<>(Arrays.asList("stack"));
@@ -45,7 +45,7 @@ public class WEListener implements Listener {
public final HashSet unsafe1 = new HashSet<>(Arrays.asList("cs", ".s", "restore", "snapshot", "delchunks", "listchunks"));
public final HashSet restricted = new HashSet<>(Arrays.asList("up"));
public final HashSet other = new HashSet<>(Arrays.asList("undo", "redo", "schematic", "schem", "count"));
-
+
public boolean checkCommand(final List list, final String cmd) {
for (final String identifier : list) {
if (("/" + identifier).equals(cmd) || ("//" + identifier).equals(cmd) || ("/worldedit:/" + identifier).equals(cmd) || ("/worldedit:" + identifier).equals(cmd)) {
@@ -54,7 +54,7 @@ public class WEListener implements Listener {
}
return false;
}
-
+
public String reduceCmd(final String cmd, final boolean single) {
if (cmd.startsWith("/worldedit:/")) {
return cmd.substring(12);
@@ -70,7 +70,7 @@ public class WEListener implements Listener {
}
return cmd;
}
-
+
public int getInt(final String s) {
try {
int max = 0;
@@ -86,7 +86,7 @@ public class WEListener implements Listener {
return 0;
}
}
-
+
public boolean checkVolume(final FawePlayer player, final long volume, final long max, final Cancellable e) {
if (volume > max) {
MainUtil.sendMessage(FawePlayer.wrap(player.getName()), BBC.WORLDEDIT_VOLUME.s().replaceAll("%current%", volume + "").replaceAll("%max%", max + ""));
@@ -97,14 +97,14 @@ public class WEListener implements Listener {
}
return true;
}
-
+
public boolean checkSelection(final FawePlayer player, final int modifier, final long max, final Cancellable e) {
- LocalSession session = Fawe.get().getWorldEdit().getSession(player.getName());
- LocalWorld w = BukkitUtil.getLocalWorld(player.parent.getWorld());
+ final LocalSession session = Fawe.get().getWorldEdit().getSession(player.getName());
+ final LocalWorld w = BukkitUtil.getLocalWorld(player.parent.getWorld());
Region selection = null;
try {
selection = session.getSelection(w);
- } catch (IncompleteRegionException e2) {}
+ } catch (final IncompleteRegionException e2) {}
if (selection == null) {
return true;
}
@@ -139,9 +139,9 @@ public class WEListener implements Listener {
}
}
final long volume = Math.abs((pos1.getBlockX() - pos2.getBlockX()) * (pos1.getBlockY() - pos2.getBlockY()) * (pos1.getBlockZ() - pos2.getBlockZ())) * modifier;
- return checkVolume(player, volume, max, e);
+ return this.checkVolume(player, volume, max, e);
}
-
+
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public boolean onPlayerCommand(final PlayerCommandPreprocessEvent e) {
final FawePlayer player = FawePlayer.wrap(e.getPlayer());
@@ -149,65 +149,65 @@ public class WEListener implements Listener {
final String cmd = message.toLowerCase();
final boolean single = true;
final String[] split = cmd.split(" ");
-
+
final long maxVolume = Settings.WE_MAX_VOLUME;
final long maxIterations = Settings.WE_MAX_ITERATIONS;
// if (player.hasPermission("fawe.bypass")) {
// return true;
// }
if (split.length >= 2) {
- final String reduced = reduceCmd(split[0], single);
- final String reduced2 = reduceCmd(split[0] + " " + split[1], single);
- if (rad1.contains(reduced)) {
+ final String reduced = this.reduceCmd(split[0], single);
+ final String reduced2 = this.reduceCmd(split[0] + " " + split[1], single);
+ if (this.rad1.contains(reduced)) {
if (WEManager.IMP.delay(player, message)) {
e.setCancelled(true);
return true;
}
- final long volume = getInt(split[1]) * 256;
- return checkVolume(player, volume, maxVolume, e);
+ final long volume = this.getInt(split[1]) * 256;
+ return this.checkVolume(player, volume, maxVolume, e);
}
- if (rad2.contains(reduced)) {
+ if (this.rad2.contains(reduced)) {
if (WEManager.IMP.delay(player, message)) {
e.setCancelled(true);
return true;
}
if (split.length >= 3) {
- final long volume = getInt(split[2]) * 256;
- return checkVolume(player, volume, maxVolume, e);
+ final long volume = this.getInt(split[2]) * 256;
+ return this.checkVolume(player, volume, maxVolume, e);
}
return true;
}
- if (rad2_1.contains(reduced)) {
+ if (this.rad2_1.contains(reduced)) {
if (WEManager.IMP.delay(player, message)) {
e.setCancelled(true);
return true;
}
if (split.length >= 4) {
- final long volume = getInt(split[2]) * getInt(split[3]);
- return checkVolume(player, volume, maxVolume, e);
+ final long volume = this.getInt(split[2]) * this.getInt(split[3]);
+ return this.checkVolume(player, volume, maxVolume, e);
}
return true;
}
- if (rad2_2.contains(reduced)) {
+ if (this.rad2_2.contains(reduced)) {
if (WEManager.IMP.delay(player, message)) {
e.setCancelled(true);
return true;
}
if (split.length >= 3) {
- final long radius = getInt(split[2]);
+ final long radius = this.getInt(split[2]);
final long volume = radius * radius;
- return checkVolume(player, volume, maxVolume, e);
+ return this.checkVolume(player, volume, maxVolume, e);
}
return true;
}
- if (rad2_3.contains(reduced2)) {
+ if (this.rad2_3.contains(reduced2)) {
if (WEManager.IMP.delay(player, message)) {
e.setCancelled(true);
return true;
}
if (split.length >= 3) {
if (split.length == 4) {
- final int iterations = getInt(split[3]);
+ final int iterations = this.getInt(split[3]);
if (iterations > maxIterations) {
MainUtil.sendMessage(player, BBC.WORLDEDIT_ITERATIONS.s().replaceAll("%current%", iterations + "").replaceAll("%max%", maxIterations + ""));
e.setCancelled(true);
@@ -217,13 +217,13 @@ public class WEListener implements Listener {
return true;
}
}
- final long radius = getInt(split[2]);
+ final long radius = this.getInt(split[2]);
final long volume = radius * radius;
- return checkVolume(player, volume, maxVolume, e);
+ return this.checkVolume(player, volume, maxVolume, e);
}
return true;
}
- if (rad3_1.contains(reduced2)) {
+ if (this.rad3_1.contains(reduced2)) {
if (WEManager.IMP.delay(player, message)) {
e.setCancelled(true);
return true;
@@ -233,13 +233,13 @@ public class WEListener implements Listener {
if (split[i].equalsIgnoreCase("-h")) {
i = 3;
}
- final long radius = getInt(split[i]);
+ final long radius = this.getInt(split[i]);
final long volume = radius * radius;
- return checkVolume(player, volume, maxVolume, e);
+ return this.checkVolume(player, volume, maxVolume, e);
}
return true;
}
- if (rad3_2.contains(reduced2)) {
+ if (this.rad3_2.contains(reduced2)) {
if (WEManager.IMP.delay(player, message)) {
e.setCancelled(true);
return true;
@@ -249,21 +249,21 @@ public class WEListener implements Listener {
if (split[i].equalsIgnoreCase("-h")) {
i = 4;
}
- final long radius = getInt(split[i]);
+ final long radius = this.getInt(split[i]);
final long volume = radius * radius;
- return checkVolume(player, volume, maxVolume, e);
+ return this.checkVolume(player, volume, maxVolume, e);
}
return true;
}
- if (regionExtend.contains(reduced)) {
+ if (this.regionExtend.contains(reduced)) {
if (WEManager.IMP.delay(player, message)) {
e.setCancelled(true);
return true;
}
- return checkSelection(player, getInt(split[1]), maxVolume, e);
+ return this.checkSelection(player, this.getInt(split[1]), maxVolume, e);
}
}
- final String reduced = reduceCmd(split[0], single);
+ final String reduced = this.reduceCmd(split[0], single);
if (Settings.WE_BLACKLIST.contains(reduced)) {
BBC.WORLDEDIT_UNSAFE.send(player);
e.setCancelled(true);
@@ -271,9 +271,9 @@ public class WEListener implements Listener {
BBC.WORLDEDIT_BYPASS.send(player);
}
}
- if (restricted.contains(reduced)) {
+ if (this.restricted.contains(reduced)) {
final HashSet mask = WEManager.IMP.getMask(player);
- Location loc = player.parent.getLocation();
+ final Location loc = player.parent.getLocation();
for (final RegionWrapper region : mask) {
if (region.isIn(loc.getBlockX(), loc.getBlockZ())) {
if (WEManager.IMP.delay(player, message)) {
@@ -287,20 +287,20 @@ public class WEListener implements Listener {
BBC.REQUIRE_SELECTION_IN_MASK.send(player);
return true;
}
- if (region.contains(reduced)) {
+ if (this.region.contains(reduced)) {
if (WEManager.IMP.delay(player, message)) {
e.setCancelled(true);
return true;
}
- return checkSelection(player, 1, maxVolume, e);
+ return this.checkSelection(player, 1, maxVolume, e);
}
- if (unregioned.contains(reduced)) {
+ if (this.unregioned.contains(reduced)) {
if (WEManager.IMP.delay(player, message)) {
e.setCancelled(true);
return true;
}
}
- if (other.contains(reduced)) {
+ if (this.other.contains(reduced)) {
if (WEManager.IMP.delay(player, message)) {
e.setCancelled(true);
return true;
diff --git a/src/main/java/com/boydti/fawe/bukkit/regions/BukkitMaskManager.java b/src/main/java/com/boydti/fawe/bukkit/regions/BukkitMaskManager.java
index 308c985b..4a78360d 100644
--- a/src/main/java/com/boydti/fawe/bukkit/regions/BukkitMaskManager.java
+++ b/src/main/java/com/boydti/fawe/bukkit/regions/BukkitMaskManager.java
@@ -5,7 +5,7 @@ import org.bukkit.entity.Player;
import com.boydti.fawe.regions.FaweMaskManager;
public abstract class BukkitMaskManager extends FaweMaskManager {
-
+
public BukkitMaskManager(final String plugin) {
super(plugin);
}
diff --git a/src/main/java/com/boydti/fawe/bukkit/regions/FactionsFeature.java b/src/main/java/com/boydti/fawe/bukkit/regions/FactionsFeature.java
index fb64239f..6ff9cf1c 100644
--- a/src/main/java/com/boydti/fawe/bukkit/regions/FactionsFeature.java
+++ b/src/main/java/com/boydti/fawe/bukkit/regions/FactionsFeature.java
@@ -15,19 +15,19 @@ import com.massivecraft.massivecore.ps.PS;
public class FactionsFeature extends BukkitMaskManager implements Listener {
FaweBukkit plugin;
Plugin factions;
-
+
public FactionsFeature(final Plugin factionsPlugin, final FaweBukkit p3) {
super(factionsPlugin.getName());
- factions = factionsPlugin;
- plugin = p3;
+ this.factions = factionsPlugin;
+ this.plugin = p3;
BoardColl.get();
}
-
+
@Override
public FaweMask getMask(final FawePlayer fp) {
final Player player = fp.parent;
final Location loc = player.getLocation();
- PS ps = PS.valueOf(loc);
+ final PS ps = PS.valueOf(loc);
final Faction fac = BoardColl.get().getFactionAt(ps);
if (fac != null) {
if (fac.getOnlinePlayers().contains(player)) {
diff --git a/src/main/java/com/boydti/fawe/bukkit/regions/FactionsUUIDFeature.java b/src/main/java/com/boydti/fawe/bukkit/regions/FactionsUUIDFeature.java
index 3d411bdc..7ab6eb2e 100644
--- a/src/main/java/com/boydti/fawe/bukkit/regions/FactionsUUIDFeature.java
+++ b/src/main/java/com/boydti/fawe/bukkit/regions/FactionsUUIDFeature.java
@@ -17,12 +17,12 @@ import com.massivecraft.factions.Faction;
public class FactionsUUIDFeature extends BukkitMaskManager implements Listener {
private final Board instance;
-
+
public FactionsUUIDFeature(final Plugin factionsPlugin, final FaweBukkit p3) {
super(factionsPlugin.getName());
- instance = Board.getInstance();
+ this.instance = Board.getInstance();
}
-
+
@Override
public FaweMask getMask(final FawePlayer fp) {
final Player player = fp.parent;
@@ -30,47 +30,47 @@ public class FactionsUUIDFeature extends BukkitMaskManager implements Listener {
final boolean perm = Perm.hasPermission(FawePlayer.wrap(player), "fawe.factions.wilderness");
final RegionWrapper locs = new RegionWrapper(chunk.getX(), chunk.getX(), chunk.getZ(), chunk.getZ());
final World world = player.getWorld();
-
+
int count = 32;
-
- if (isAdded(locs, world, player, perm)) {
+
+ if (this.isAdded(locs, world, player, perm)) {
boolean hasPerm = true;
-
+
RegionWrapper chunkSelection;
while (hasPerm && (count > 0)) {
count--;
-
+
hasPerm = false;
-
+
chunkSelection = new RegionWrapper(locs.maxX + 1, locs.maxX + 1, locs.minZ, locs.maxZ);
-
- if (isAdded(chunkSelection, world, player, perm)) {
+
+ if (this.isAdded(chunkSelection, world, player, perm)) {
locs.maxX += 1;
hasPerm = true;
}
-
+
chunkSelection = new RegionWrapper(locs.minX - 1, locs.minX - 1, locs.minZ, locs.maxZ);
-
- if (isAdded(chunkSelection, world, player, perm)) {
+
+ if (this.isAdded(chunkSelection, world, player, perm)) {
locs.minX -= 1;
hasPerm = true;
}
-
+
chunkSelection = new RegionWrapper(locs.minX, locs.maxX, locs.maxZ + 1, locs.maxZ + 1);
-
- if (isAdded(chunkSelection, world, player, perm)) {
+
+ if (this.isAdded(chunkSelection, world, player, perm)) {
locs.maxZ += 1;
hasPerm = true;
}
-
+
chunkSelection = new RegionWrapper(locs.minX, locs.maxX, locs.minZ - 1, locs.minZ - 1);
-
- if (isAdded(chunkSelection, world, player, perm)) {
+
+ if (this.isAdded(chunkSelection, world, player, perm)) {
locs.minZ -= 1;
hasPerm = true;
}
}
-
+
final Location pos1 = new Location(world, locs.minX << 4, 1, locs.minZ << 4);
final Location pos2 = new Location(world, 15 + (locs.maxX << 4), 256, 15 + (locs.maxZ << 4));
return new FaweMask(pos1, pos2) {
@@ -82,11 +82,11 @@ public class FactionsUUIDFeature extends BukkitMaskManager implements Listener {
}
return null;
}
-
+
public boolean isAdded(final RegionWrapper locs, final World world, final Player player, final boolean perm) {
for (int x = locs.minX; x <= locs.maxX; x++) {
for (int z = locs.minZ; z <= locs.maxZ; z++) {
- final Faction fac = instance.getFactionAt(new FLocation(world.getName(), x, z));
+ final Faction fac = this.instance.getFactionAt(new FLocation(world.getName(), x, z));
if (fac == null) {
return false;
}
diff --git a/src/main/java/com/boydti/fawe/bukkit/regions/FaweMask.java b/src/main/java/com/boydti/fawe/bukkit/regions/FaweMask.java
index 3bfeb2fd..02014725 100644
--- a/src/main/java/com/boydti/fawe/bukkit/regions/FaweMask.java
+++ b/src/main/java/com/boydti/fawe/bukkit/regions/FaweMask.java
@@ -11,7 +11,7 @@ public class FaweMask {
private String description = null;
private Location position1;
private Location position2;
-
+
public FaweMask(final Location pos1, final Location pos2, final String id) {
if ((pos1 == null) || (pos2 == null)) {
throw new IllegalArgumentException("Locations cannot be null!");
@@ -19,11 +19,11 @@ public class FaweMask {
if (pos1.getWorld().equals(pos2.getWorld()) == false) {
throw new IllegalArgumentException("Locations must be in the same world!");
}
- description = id;
- position1 = new Location(pos1.getWorld(), Math.min(pos1.getBlockX(), pos2.getBlockX()), 0, Math.min(pos1.getBlockZ(), pos2.getBlockZ()));
- position2 = new Location(pos1.getWorld(), Math.max(pos1.getBlockX(), pos2.getBlockX()), 256, Math.max(pos1.getBlockZ(), pos2.getBlockZ()));
+ this.description = id;
+ this.position1 = new Location(pos1.getWorld(), Math.min(pos1.getBlockX(), pos2.getBlockX()), 0, Math.min(pos1.getBlockZ(), pos2.getBlockZ()));
+ this.position2 = new Location(pos1.getWorld(), Math.max(pos1.getBlockX(), pos2.getBlockX()), 256, Math.max(pos1.getBlockZ(), pos2.getBlockZ()));
}
-
+
public FaweMask(final Location pos1, final Location pos2) {
if ((pos1 == null) || (pos2 == null)) {
throw new IllegalArgumentException("Locations cannot be null!");
@@ -31,28 +31,28 @@ public class FaweMask {
if (pos1.getWorld().equals(pos2.getWorld()) == false) {
throw new IllegalArgumentException("Locations must be in the same world!");
}
- position1 = new Location(pos1.getWorld(), Math.min(pos1.getBlockX(), pos2.getBlockX()), 0, Math.min(pos1.getBlockZ(), pos2.getBlockZ()));
- position2 = new Location(pos1.getWorld(), Math.max(pos1.getBlockX(), pos2.getBlockX()), 256, Math.max(pos1.getBlockZ(), pos2.getBlockZ()));
+ this.position1 = new Location(pos1.getWorld(), Math.min(pos1.getBlockX(), pos2.getBlockX()), 0, Math.min(pos1.getBlockZ(), pos2.getBlockZ()));
+ this.position2 = new Location(pos1.getWorld(), Math.max(pos1.getBlockX(), pos2.getBlockX()), 256, Math.max(pos1.getBlockZ(), pos2.getBlockZ()));
}
-
+
public HashSet getRegions() {
- final Location lower = getLowerBound();
- final Location upper = getUpperBound();
+ final Location lower = this.getLowerBound();
+ final Location upper = this.getUpperBound();
return new HashSet<>(Arrays.asList(new RegionWrapper(lower.getBlockX(), upper.getBlockX(), lower.getBlockZ(), upper.getBlockZ())));
}
-
+
public String getName() {
- return description;
+ return this.description;
}
-
+
public Location getLowerBound() {
- return position1;
+ return this.position1;
}
-
+
public Location getUpperBound() {
- return position2;
+ return this.position2;
}
-
+
public void setBounds(final Location pos1, final Location pos2) {
if ((pos1 == null) || (pos2 == null)) {
throw new IllegalArgumentException("Locations cannot be null!");
@@ -60,33 +60,33 @@ public class FaweMask {
if (pos1.getWorld().equals(pos2.getWorld()) == false) {
throw new IllegalArgumentException("Locations must be in the same world!");
}
- position1 = new Location(pos1.getWorld(), Math.min(pos1.getBlockX(), pos2.getBlockX()), 0, Math.min(pos1.getBlockZ(), pos2.getBlockZ()));
- position2 = new Location(pos1.getWorld(), Math.max(pos1.getBlockX(), pos2.getBlockX()), 256, Math.max(pos1.getBlockZ(), pos2.getBlockZ()));
+ this.position1 = new Location(pos1.getWorld(), Math.min(pos1.getBlockX(), pos2.getBlockX()), 0, Math.min(pos1.getBlockZ(), pos2.getBlockZ()));
+ this.position2 = new Location(pos1.getWorld(), Math.max(pos1.getBlockX(), pos2.getBlockX()), 256, Math.max(pos1.getBlockZ(), pos2.getBlockZ()));
}
-
+
public Location[] getBounds() {
- final Location[] locations = { position1, position2 };
+ final Location[] locations = { this.position1, this.position2 };
return locations;
}
-
+
public boolean contains(final Location loc) {
- if (position1.getWorld().equals(loc.getWorld())) {
- if (loc.getBlockX() < position1.getBlockX()) {
+ if (this.position1.getWorld().equals(loc.getWorld())) {
+ if (loc.getBlockX() < this.position1.getBlockX()) {
return false;
}
- if (loc.getBlockX() > position2.getBlockX()) {
+ if (loc.getBlockX() > this.position2.getBlockX()) {
return false;
}
- if (loc.getBlockZ() < position1.getBlockZ()) {
+ if (loc.getBlockZ() < this.position1.getBlockZ()) {
return false;
}
- if (loc.getBlockZ() > position2.getBlockZ()) {
+ if (loc.getBlockZ() > this.position2.getBlockZ()) {
return false;
}
- if (loc.getBlockY() < position1.getBlockY()) {
+ if (loc.getBlockY() < this.position1.getBlockY()) {
return false;
}
- if (loc.getBlockY() > position2.getBlockY()) {
+ if (loc.getBlockY() > this.position2.getBlockY()) {
return false;
}
} else {
diff --git a/src/main/java/com/boydti/fawe/bukkit/regions/GriefPreventionFeature.java b/src/main/java/com/boydti/fawe/bukkit/regions/GriefPreventionFeature.java
index 6ce531d9..022e0de4 100644
--- a/src/main/java/com/boydti/fawe/bukkit/regions/GriefPreventionFeature.java
+++ b/src/main/java/com/boydti/fawe/bukkit/regions/GriefPreventionFeature.java
@@ -14,13 +14,13 @@ import com.boydti.fawe.object.FawePlayer;
public class GriefPreventionFeature extends BukkitMaskManager implements Listener {
FaweBukkit plugin;
Plugin griefprevention;
-
+
public GriefPreventionFeature(final Plugin griefpreventionPlugin, final FaweBukkit p3) {
super(griefpreventionPlugin.getName());
- griefprevention = griefpreventionPlugin;
- plugin = p3;
+ this.griefprevention = griefpreventionPlugin;
+ this.plugin = p3;
}
-
+
@Override
public FaweMask getMask(final FawePlayer fp) {
final Player player = fp.parent;
@@ -41,6 +41,6 @@ public class GriefPreventionFeature extends BukkitMaskManager implements Listene
}
}
return null;
-
+
}
}
diff --git a/src/main/java/com/boydti/fawe/bukkit/regions/PlotMeFeature.java b/src/main/java/com/boydti/fawe/bukkit/regions/PlotMeFeature.java
index 72cd81e3..9949e37f 100644
--- a/src/main/java/com/boydti/fawe/bukkit/regions/PlotMeFeature.java
+++ b/src/main/java/com/boydti/fawe/bukkit/regions/PlotMeFeature.java
@@ -16,27 +16,27 @@ import com.worldcretornica.plotme_core.bukkit.api.BukkitWorld;
public class PlotMeFeature extends BukkitMaskManager implements Listener {
FaweBukkit plugin;
PlotMe_Core plotme;
-
+
public PlotMeFeature(final Plugin plotmePlugin, final FaweBukkit p3) {
super(plotmePlugin.getName());
- plotme = ((PlotMe_CorePlugin) plotmePlugin).getAPI();
- plugin = p3;
-
+ this.plotme = ((PlotMe_CorePlugin) plotmePlugin).getAPI();
+ this.plugin = p3;
+
}
-
+
@Override
public FaweMask getMask(final FawePlayer fp) {
final Player player = fp.parent;
final Location location = player.getLocation();
- final Plot plot = plotme.getPlotMeCoreManager().getPlotById(new BukkitPlayer(player));
+ final Plot plot = this.plotme.getPlotMeCoreManager().getPlotById(new BukkitPlayer(player));
if (plot == null) {
return null;
}
final boolean isallowed = plot.isAllowed(player.getUniqueId());
if (isallowed) {
- final Location pos1 = new Location(location.getWorld(), plotme.getGenManager(player.getWorld().getName()).bottomX(plot.getId(), new BukkitWorld(player.getWorld())), 0, plotme
+ final Location pos1 = new Location(location.getWorld(), this.plotme.getGenManager(player.getWorld().getName()).bottomX(plot.getId(), new BukkitWorld(player.getWorld())), 0, this.plotme
.getGenManager(player.getWorld().getName()).bottomZ(plot.getId(), new BukkitWorld(player.getWorld())));
- final Location pos2 = new Location(location.getWorld(), plotme.getGenManager(player.getWorld().getName()).topX(plot.getId(), new BukkitWorld(player.getWorld())), 256, plotme
+ final Location pos2 = new Location(location.getWorld(), this.plotme.getGenManager(player.getWorld().getName()).topX(plot.getId(), new BukkitWorld(player.getWorld())), 256, this.plotme
.getGenManager(player.getWorld().getName()).topZ(plot.getId(), new BukkitWorld(player.getWorld())));
return new FaweMask(pos1, pos2) {
@Override
diff --git a/src/main/java/com/boydti/fawe/bukkit/regions/PlotSquaredFeature.java b/src/main/java/com/boydti/fawe/bukkit/regions/PlotSquaredFeature.java
index bb8f406b..6d070267 100644
--- a/src/main/java/com/boydti/fawe/bukkit/regions/PlotSquaredFeature.java
+++ b/src/main/java/com/boydti/fawe/bukkit/regions/PlotSquaredFeature.java
@@ -19,14 +19,14 @@ import com.plotsquared.bukkit.BukkitMain;
public class PlotSquaredFeature extends BukkitMaskManager implements Listener {
FaweBukkit plugin;
-
+
public PlotSquaredFeature(final Plugin plotPlugin, final FaweBukkit p3) {
super(plotPlugin.getName());
- plugin = p3;
+ this.plugin = p3;
BukkitMain.worldEdit = null;
PS.get().worldedit = null;
}
-
+
@Override
public FaweMask getMask(final FawePlayer fp) {
final PlotPlayer pp = PlotPlayer.wrap(fp.parent);
@@ -58,10 +58,10 @@ public class PlotSquaredFeature extends BukkitMaskManager implements Listener {
final World world = fp.parent.getWorld();
final com.intellectualcrafters.plot.object.RegionWrapper region = plot.getLargestRegion();
final HashSet regions = plot.getRegions();
-
+
final Location pos1 = new Location(world, region.minX, 0, region.minZ);
final Location pos2 = new Location(world, region.maxX, 256, region.maxZ);
-
+
final HashSet faweRegions = new HashSet();
for (final com.intellectualcrafters.plot.object.RegionWrapper current : regions) {
faweRegions.add(new RegionWrapper(current.minX, current.maxX, current.minZ, current.maxZ));
@@ -71,7 +71,7 @@ public class PlotSquaredFeature extends BukkitMaskManager implements Listener {
public String getName() {
return "PLOT^2:" + id;
}
-
+
@Override
public HashSet getRegions() {
return faweRegions;
diff --git a/src/main/java/com/boydti/fawe/bukkit/regions/PreciousStonesFeature.java b/src/main/java/com/boydti/fawe/bukkit/regions/PreciousStonesFeature.java
index 61714a01..f1dc0068 100644
--- a/src/main/java/com/boydti/fawe/bukkit/regions/PreciousStonesFeature.java
+++ b/src/main/java/com/boydti/fawe/bukkit/regions/PreciousStonesFeature.java
@@ -17,14 +17,14 @@ import com.boydti.fawe.object.FawePlayer;
public class PreciousStonesFeature extends BukkitMaskManager implements Listener {
FaweBukkit plugin;
Plugin preciousstones;
-
+
public PreciousStonesFeature(final Plugin preciousstonesPlugin, final FaweBukkit p3) {
super(preciousstonesPlugin.getName());
- preciousstones = preciousstonesPlugin;
- plugin = p3;
-
+ this.preciousstones = preciousstonesPlugin;
+ this.plugin = p3;
+
}
-
+
@Override
public FaweMask getMask(final FawePlayer fp) {
final Player player = fp.parent;
diff --git a/src/main/java/com/boydti/fawe/bukkit/regions/ResidenceFeature.java b/src/main/java/com/boydti/fawe/bukkit/regions/ResidenceFeature.java
index e455cb41..e1c78ef8 100644
--- a/src/main/java/com/boydti/fawe/bukkit/regions/ResidenceFeature.java
+++ b/src/main/java/com/boydti/fawe/bukkit/regions/ResidenceFeature.java
@@ -14,14 +14,14 @@ import com.boydti.fawe.object.FawePlayer;
public class ResidenceFeature extends BukkitMaskManager implements Listener {
FaweBukkit plugin;
Plugin residence;
-
+
public ResidenceFeature(final Plugin residencePlugin, final FaweBukkit p3) {
super(residencePlugin.getName());
- residence = residencePlugin;
- plugin = p3;
-
+ this.residence = residencePlugin;
+ this.plugin = p3;
+
}
-
+
@Override
public FaweMask getMask(final FawePlayer fp) {
final Player player = fp.parent;
diff --git a/src/main/java/com/boydti/fawe/bukkit/regions/TownyFeature.java b/src/main/java/com/boydti/fawe/bukkit/regions/TownyFeature.java
index bfc8206e..367db8ab 100644
--- a/src/main/java/com/boydti/fawe/bukkit/regions/TownyFeature.java
+++ b/src/main/java/com/boydti/fawe/bukkit/regions/TownyFeature.java
@@ -17,19 +17,19 @@ import com.palmergames.bukkit.towny.object.WorldCoord;
public class TownyFeature extends BukkitMaskManager implements Listener {
FaweBukkit plugin;
Plugin towny;
-
+
public TownyFeature(final Plugin townyPlugin, final FaweBukkit p3) {
super(townyPlugin.getName());
- towny = townyPlugin;
- plugin = p3;
+ this.towny = townyPlugin;
+ this.plugin = p3;
}
-
+
@Override
public FaweMask getMask(final FawePlayer fp) {
final Player player = fp.parent;
final Location location = player.getLocation();
try {
- final PlayerCache cache = ((Towny) towny).getCache(player);
+ final PlayerCache cache = ((Towny) this.towny).getCache(player);
final WorldCoord mycoord = cache.getLastTownBlock();
if (mycoord == null) {
return null;
@@ -44,7 +44,7 @@ public class TownyFeature extends BukkitMaskManager implements Listener {
isMember = true;
}
} catch (final Exception e) {
-
+
}
if (!isMember) {
if (player.hasPermission("fawe.towny.*")) {
diff --git a/src/main/java/com/boydti/fawe/bukkit/regions/Worldguard.java b/src/main/java/com/boydti/fawe/bukkit/regions/Worldguard.java
index e5ef2d3e..eacd04f3 100644
--- a/src/main/java/com/boydti/fawe/bukkit/regions/Worldguard.java
+++ b/src/main/java/com/boydti/fawe/bukkit/regions/Worldguard.java
@@ -17,28 +17,28 @@ import com.sk89q.worldguard.protection.regions.ProtectedRegion;
public class Worldguard extends BukkitMaskManager implements Listener {
WorldGuardPlugin worldguard;
FaweBukkit plugin;
-
+
private WorldGuardPlugin getWorldGuard() {
final Plugin plugin = Bukkit.getPluginManager().getPlugin("WorldGuard");
-
+
// WorldGuard may not be loaded
if ((plugin == null) || !(plugin instanceof WorldGuardPlugin)) {
return null; // Maybe you want throw an exception instead
}
-
+
return (WorldGuardPlugin) plugin;
}
-
+
public Worldguard(final Plugin p2, final FaweBukkit p3) {
super(p2.getName());
- worldguard = getWorldGuard();
- plugin = p3;
-
+ this.worldguard = this.getWorldGuard();
+ this.plugin = p3;
+
}
-
+
public ProtectedRegion isowner(final Player player, final Location location) {
- final com.sk89q.worldguard.LocalPlayer localplayer = worldguard.wrapPlayer(player);
- final RegionManager manager = worldguard.getRegionManager(player.getWorld());
+ final com.sk89q.worldguard.LocalPlayer localplayer = this.worldguard.wrapPlayer(player);
+ final RegionManager manager = this.worldguard.getRegionManager(player.getWorld());
final ApplicableRegionSet regions = manager.getApplicableRegions(player.getLocation());
for (final ProtectedRegion region : regions) {
if (region.isOwner(localplayer)) {
@@ -53,10 +53,10 @@ public class Worldguard extends BukkitMaskManager implements Listener {
}
return null;
}
-
+
public ProtectedRegion getregion(final Player player, final BlockVector location) {
- final com.sk89q.worldguard.LocalPlayer localplayer = worldguard.wrapPlayer(player);
- final ApplicableRegionSet regions = worldguard.getRegionManager(player.getWorld()).getApplicableRegions(location);
+ final com.sk89q.worldguard.LocalPlayer localplayer = this.worldguard.wrapPlayer(player);
+ final ApplicableRegionSet regions = this.worldguard.getRegionManager(player.getWorld()).getApplicableRegions(location);
for (final ProtectedRegion region : regions) {
if (region.isOwner(localplayer)) {
return region;
@@ -70,12 +70,12 @@ public class Worldguard extends BukkitMaskManager implements Listener {
}
return null;
}
-
+
@Override
public FaweMask getMask(final FawePlayer fp) {
final Player player = fp.parent;
final Location location = player.getLocation();
- final ProtectedRegion myregion = isowner(player, location);
+ final ProtectedRegion myregion = this.isowner(player, location);
if (myregion != null) {
final Location pos1 = new Location(location.getWorld(), myregion.getMinimumPoint().getBlockX(), myregion.getMinimumPoint().getBlockY(), myregion.getMinimumPoint().getBlockZ());
final Location pos2 = new Location(location.getWorld(), myregion.getMaximumPoint().getBlockX(), myregion.getMaximumPoint().getBlockY(), myregion.getMaximumPoint().getBlockZ());
@@ -88,6 +88,6 @@ public class Worldguard extends BukkitMaskManager implements Listener {
} else {
return null;
}
-
+
}
}
diff --git a/src/main/java/com/boydti/fawe/bukkit/v0/BukkitEditSessionWrapper_0.java b/src/main/java/com/boydti/fawe/bukkit/v0/BukkitEditSessionWrapper_0.java
index 61cfeae4..5ddba33a 100644
--- a/src/main/java/com/boydti/fawe/bukkit/v0/BukkitEditSessionWrapper_0.java
+++ b/src/main/java/com/boydti/fawe/bukkit/v0/BukkitEditSessionWrapper_0.java
@@ -8,24 +8,24 @@ import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.history.changeset.ChangeSet;
public class BukkitEditSessionWrapper_0 extends EditSessionWrapper {
-
+
private BlocksHubHook hook;
- public BukkitEditSessionWrapper_0(EditSession session) {
+ public BukkitEditSessionWrapper_0(final EditSession session) {
super(session);
try {
this.hook = new BlocksHubHook();
- } catch (Throwable e) {
-
+ } catch (final Throwable e) {
+
}
}
-
+
@Override
- public Extent getHistoryExtent(Extent parent, ChangeSet set, FawePlayer> player) {
- if (hook != null) {
- return hook.getLoggingExtent(parent, set, player);
+ public Extent getHistoryExtent(final Extent parent, final ChangeSet set, final FawePlayer> player) {
+ if (this.hook != null) {
+ return this.hook.getLoggingExtent(parent, set, player);
}
return super.getHistoryExtent(parent, set, player);
}
-
+
}
diff --git a/src/main/java/com/boydti/fawe/bukkit/v0/BukkitQueue_0.java b/src/main/java/com/boydti/fawe/bukkit/v0/BukkitQueue_0.java
index 9288f8e5..199f0a7f 100644
--- a/src/main/java/com/boydti/fawe/bukkit/v0/BukkitQueue_0.java
+++ b/src/main/java/com/boydti/fawe/bukkit/v0/BukkitQueue_0.java
@@ -31,7 +31,7 @@ import com.boydti.fawe.util.TaskManager;
import com.sk89q.worldedit.world.biome.BaseBiome;
public abstract class BukkitQueue_0 extends FaweQueue implements Listener {
-
+
private final HashMap> loaded = new HashMap<>();
public BukkitQueue_0() {
@@ -41,77 +41,77 @@ public abstract class BukkitQueue_0 extends FaweQueue implements Listener {
Bukkit.getPluginManager().registerEvents(BukkitQueue_0.this, (Plugin) Fawe.imp());
}
});
- for (World world : Bukkit.getWorlds()) {
- for (Chunk chunk : world.getLoadedChunks()) {
- addLoaded(chunk);
+ for (final World world : Bukkit.getWorlds()) {
+ for (final Chunk chunk : world.getLoadedChunks()) {
+ this.addLoaded(chunk);
}
}
}
-
+
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
- public void onWorldLoad(WorldLoadEvent event) {
- World world = event.getWorld();
- for (Chunk chunk : world.getLoadedChunks()) {
- addLoaded(chunk);
+ public void onWorldLoad(final WorldLoadEvent event) {
+ final World world = event.getWorld();
+ for (final Chunk chunk : world.getLoadedChunks()) {
+ this.addLoaded(chunk);
}
}
-
+
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
- public void onWorldUnload(WorldUnloadEvent event) {
- loaded.remove(event.getWorld().getName());
+ public void onWorldUnload(final WorldUnloadEvent event) {
+ this.loaded.remove(event.getWorld().getName());
}
- public void addLoaded(Chunk chunk) {
- String world = chunk.getWorld().getName();
- long x = chunk.getX();
- long z = chunk.getZ();
- long id = x << 32 | z & 0xFFFFFFFFL;
- HashSet map = loaded.get(world);
+ public void addLoaded(final Chunk chunk) {
+ final String world = chunk.getWorld().getName();
+ final long x = chunk.getX();
+ final long z = chunk.getZ();
+ final long id = (x << 32) | (z & 0xFFFFFFFFL);
+ HashSet map = this.loaded.get(world);
if (map != null) {
map.add(id);
} else {
map = new HashSet<>(Arrays.asList(id));
- loaded.put(world, map);
+ this.loaded.put(world, map);
}
}
-
- public void removeLoaded(Chunk chunk) {
- String world = chunk.getWorld().getName();
- long x = chunk.getX();
- long z = chunk.getZ();
- long id = x << 32 | z & 0xFFFFFFFFL;
- HashSet map = loaded.get(world);
+
+ public void removeLoaded(final Chunk chunk) {
+ final String world = chunk.getWorld().getName();
+ final long x = chunk.getX();
+ final long z = chunk.getZ();
+ final long id = (x << 32) | (z & 0xFFFFFFFFL);
+ final HashSet map = this.loaded.get(world);
if (map != null) {
map.remove(id);
}
}
-
+
@Override
- public boolean isChunkLoaded(String world, int x, int z) {
- long id = (long) x << 32 | z & 0xFFFFFFFFL;
- HashSet map = loaded.get(world);
+ public boolean isChunkLoaded(final String world, final int x, final int z) {
+ final long id = ((long) x << 32) | (z & 0xFFFFFFFFL);
+ final HashSet map = this.loaded.get(world);
if (map != null) {
return map.contains(id);
}
return false;
};
-
+
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
- public void onChunkLoad(ChunkLoadEvent event) {
- Chunk chunk = event.getChunk();
- addLoaded(chunk);
+ public void onChunkLoad(final ChunkLoadEvent event) {
+ final Chunk chunk = event.getChunk();
+ this.addLoaded(chunk);
if (Settings.FIX_ALL_LIGHTING) {
- fixLighting(getChunk(new ChunkLoc(chunk.getWorld().getName(), chunk.getX(), chunk.getZ())), false);
+ this.fixLighting(this.getChunk(new ChunkLoc(chunk.getWorld().getName(), chunk.getX(), chunk.getZ())), false);
}
}
-
+
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
- public void onChunkUnload(ChunkUnloadEvent event) {
- removeLoaded(event.getChunk());
+ public void onChunkUnload(final ChunkUnloadEvent event) {
+ this.removeLoaded(event.getChunk());
}
private final ConcurrentHashMap> blocks = new ConcurrentHashMap<>();
-
+
@Override
public boolean setBlock(final String world, int x, final int y, int z, final short id, final byte data) {
if ((y > 255) || (y < 0)) {
@@ -120,61 +120,61 @@ public abstract class BukkitQueue_0 extends FaweQueue implements Listener {
final ChunkLoc wrap = new ChunkLoc(world, x >> 4, z >> 4);
x = x & 15;
z = z & 15;
- FaweChunk result = blocks.get(wrap);
+ FaweChunk result = this.blocks.get(wrap);
if (result == null) {
- result = getChunk(wrap);
+ result = this.getChunk(wrap);
result.setBlock(x, y, z, id, data);
- final FaweChunk previous = blocks.put(wrap, result);
+ final FaweChunk previous = this.blocks.put(wrap, result);
if (previous == null) {
return true;
}
- blocks.put(wrap, previous);
+ this.blocks.put(wrap, previous);
result = previous;
}
result.setBlock(x, y, z, id, data);
return true;
}
-
+
@Override
- public boolean setBiome(String world, int x, int z, BaseBiome biome) {
+ public boolean setBiome(final String world, int x, int z, final BaseBiome biome) {
final ChunkLoc wrap = new ChunkLoc(world, x >> 4, z >> 4);
x = x & 15;
z = z & 15;
- FaweChunk result = blocks.get(wrap);
+ FaweChunk result = this.blocks.get(wrap);
if (result == null) {
- result = getChunk(wrap);
- final FaweChunk previous = blocks.put(wrap, result);
+ result = this.getChunk(wrap);
+ final FaweChunk previous = this.blocks.put(wrap, result);
if (previous != null) {
- blocks.put(wrap, previous);
+ this.blocks.put(wrap, previous);
result = previous;
}
}
result.setBiome(x, z, biome);
return true;
}
-
+
@Override
public FaweChunk next() {
try {
- if (blocks.size() == 0) {
+ if (this.blocks.size() == 0) {
return null;
}
- final Iterator>> iter = blocks.entrySet().iterator();
+ final Iterator>> iter = this.blocks.entrySet().iterator();
final FaweChunk toReturn = iter.next().getValue();
if (SetQueue.IMP.isWaiting()) {
return null;
}
iter.remove();
- execute(toReturn);
+ this.execute(toReturn);
return toReturn;
} catch (final Throwable e) {
e.printStackTrace();
return null;
}
}
-
+
private final ArrayDeque> toUpdate = new ArrayDeque<>();
-
+
public boolean execute(final FaweChunk fc) {
if (fc == null) {
return false;
@@ -183,29 +183,29 @@ public abstract class BukkitQueue_0 extends FaweQueue implements Listener {
final Chunk chunk = fc.getChunk();
chunk.load(true);
// Set blocks / entities / biome
- if (!setComponents(fc)) {
+ if (!this.setComponents(fc)) {
return false;
}
return true;
}
-
+
@Override
public void clear() {
- blocks.clear();
+ this.blocks.clear();
}
-
+
@Override
- public void setChunk(FaweChunk> chunk) {
- blocks.put(chunk.getChunkLoc(), (FaweChunk) chunk);
+ public void setChunk(final FaweChunk> chunk) {
+ this.blocks.put(chunk.getChunkLoc(), (FaweChunk) chunk);
}
public abstract Collection> sendChunk(final Collection> fcs);
-
+
public abstract boolean setComponents(final FaweChunk fc);
-
+
@Override
public abstract FaweChunk getChunk(final ChunkLoc wrap);
-
+
@Override
- public abstract boolean fixLighting(FaweChunk> fc, boolean fixAll);
+ public abstract boolean fixLighting(final FaweChunk> fc, final boolean fixAll);
}
diff --git a/src/main/java/com/boydti/fawe/bukkit/v1_8/BukkitChunk_1_8.java b/src/main/java/com/boydti/fawe/bukkit/v1_8/BukkitChunk_1_8.java
index 7d96ce35..686bff61 100644
--- a/src/main/java/com/boydti/fawe/bukkit/v1_8/BukkitChunk_1_8.java
+++ b/src/main/java/com/boydti/fawe/bukkit/v1_8/BukkitChunk_1_8.java
@@ -11,57 +11,57 @@ import com.boydti.fawe.object.FaweChunk;
import com.sk89q.worldedit.world.biome.BaseBiome;
public class BukkitChunk_1_8 extends FaweChunk {
-
+
private char[][] ids;
-
+
private final short[] count;
private final short[] air;
private final short[] relight;
private int[][] biomes;
-
+
public Chunk chunk;
-
+
/**
* A FaweSections object represents a chunk and the blocks that you wish to change in it.
*/
protected BukkitChunk_1_8(final ChunkLoc chunk) {
super(chunk);
- ids = new char[16][];
- count = new short[16];
- air = new short[16];
- relight = new short[16];
+ this.ids = new char[16][];
+ this.count = new short[16];
+ this.air = new short[16];
+ this.relight = new short[16];
}
-
+
@Override
public Chunk getChunk() {
- if (chunk == null) {
- final ChunkLoc cl = getChunkLoc();
- chunk = Bukkit.getWorld(cl.world).getChunkAt(cl.x, cl.z);
+ if (this.chunk == null) {
+ final ChunkLoc cl = this.getChunkLoc();
+ this.chunk = Bukkit.getWorld(cl.world).getChunkAt(cl.x, cl.z);
}
- return chunk;
+ return this.chunk;
}
-
+
@Override
public void setChunkLoc(final ChunkLoc loc) {
super.setChunkLoc(loc);
- chunk = null;
+ this.chunk = null;
}
-
+
/**
* Get the number of block changes in a specified section
* @param i
* @return
*/
public int getCount(final int i) {
- return count[i];
- }
-
- public int getAir(final int i) {
- return air[i];
+ return this.count[i];
}
- public void setCount(int i, short value) {
- count[i] = value;
+ public int getAir(final int i) {
+ return this.air[i];
+ }
+
+ public void setCount(final int i, final short value) {
+ this.count[i] = value;
}
/**
@@ -70,61 +70,62 @@ public class BukkitChunk_1_8 extends FaweChunk {
* @return
*/
public int getRelight(final int i) {
- return relight[i];
+ return this.relight[i];
}
public int getTotalCount() {
int total = 0;
for (int i = 0; i < 16; i++) {
- total += count[i];
+ total += this.count[i];
}
return total;
}
-
+
public int getTotalRelight() {
- if (getTotalCount() == 0 && biomes == null) {
- Arrays.fill(count, (short) 1);
- Arrays.fill(relight, Short.MAX_VALUE);
+ if ((this.getTotalCount() == 0) && (this.biomes == null)) {
+ Arrays.fill(this.count, (short) 1);
+ Arrays.fill(this.relight, Short.MAX_VALUE);
return Short.MAX_VALUE;
}
int total = 0;
for (int i = 0; i < 16; i++) {
- total += relight[i];
+ total += this.relight[i];
}
return total;
}
-
+
/**
* Get the raw data for a section
* @param i
* @return
*/
public char[] getIdArray(final int i) {
- return ids[i];
+ return this.ids[i];
}
-
+
public void clear() {
- ids = null;
- biomes = null;
+ this.ids = null;
+ this.biomes = null;
}
+
public int[][] getBiomeArray() {
- return biomes;
+ return this.biomes;
}
@Override
public void setBlock(final int x, final int y, final int z, final int id, byte data) {
final int i = FaweCache.CACHE_I[y][x][z];
final int j = FaweCache.CACHE_J[y][x][z];
- char[] vs = ids[i];
+ char[] vs = this.ids[i];
if (vs == null) {
- vs = ids[i] = new char[4096];
- count[i]++;
+ vs = this.ids[i] = new char[4096];
+ this.count[i]++;
} else if (vs[j] == 0) {
- count[i]++;
+ this.count[i]++;
}
switch (id) {
case 0:
- air[i]++;
+ this.air[i]++;
vs[j] = (char) 1;
return;
case 10:
@@ -138,7 +139,7 @@ public class BukkitChunk_1_8 extends FaweChunk {
case 124:
case 138:
case 169:
- relight[i]++;
+ this.relight[i]++;
case 2:
case 4:
case 13:
@@ -201,7 +202,7 @@ public class BukkitChunk_1_8 extends FaweChunk {
case 130:
case 76:
case 62:
- relight[i]++;
+ this.relight[i]++;
case 54:
case 146:
case 61:
@@ -216,15 +217,15 @@ public class BukkitChunk_1_8 extends FaweChunk {
return;
}
}
-
+
@Override
- public void setBiome(int x, int z, BaseBiome biome) {
- if (biomes == null) {
- biomes = new int[16][];
+ public void setBiome(final int x, final int z, final BaseBiome biome) {
+ if (this.biomes == null) {
+ this.biomes = new int[16][];
}
- int[] index = biomes[x];
+ int[] index = this.biomes[x];
if (index == null) {
- index = biomes[x] = new int[16];
+ index = this.biomes[x] = new int[16];
}
index[z] = biome.getId();
}
diff --git a/src/main/java/com/boydti/fawe/bukkit/v1_8/BukkitEditSessionWrapper_1_8.java b/src/main/java/com/boydti/fawe/bukkit/v1_8/BukkitEditSessionWrapper_1_8.java
index 73089ec2..af5df568 100644
--- a/src/main/java/com/boydti/fawe/bukkit/v1_8/BukkitEditSessionWrapper_1_8.java
+++ b/src/main/java/com/boydti/fawe/bukkit/v1_8/BukkitEditSessionWrapper_1_8.java
@@ -13,50 +13,50 @@ import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.blocks.BlockType;
public class BukkitEditSessionWrapper_1_8 extends BukkitEditSessionWrapper_0 {
-
+
private final RefClass classCraftWorld = getRefClass("{cb}.CraftWorld");
private final RefClass classChunk = getRefClass("{nms}.Chunk");
private final RefClass classWorld = getRefClass("{nms}.World");
-
+
private RefMethod worldGetHandle;
private RefMethod methodGetChunkAt;
private RefField heightMap;
private Object nmsWorld;
-
+
private int lastXMin;
private int lastZMin;
private Object lastChunk;
-
+
public BukkitEditSessionWrapper_1_8(final EditSession session) {
super(session);
try {
- worldGetHandle = classCraftWorld.getMethod("getHandle");
- methodGetChunkAt = classWorld.getMethod("getChunkAt", int.class, int.class);
- heightMap = classChunk.getField("heightMap");
- nmsWorld = worldGetHandle.of(Bukkit.getWorld(session.getWorld().getName())).call();
+ this.worldGetHandle = this.classCraftWorld.getMethod("getHandle");
+ this.methodGetChunkAt = this.classWorld.getMethod("getChunkAt", int.class, int.class);
+ this.heightMap = this.classChunk.getField("heightMap");
+ this.nmsWorld = this.worldGetHandle.of(Bukkit.getWorld(session.getWorld().getName())).call();
} catch (final Exception e) {
e.printStackTrace();
}
}
-
+
@Override
public int getHighestTerrainBlock(final int x, final int z, final int minY, final int maxY, final boolean naturalOnly) {
final int bx = x >> 4;
final int bz = z >> 4;
int[] heights;
- if ((lastChunk == null) || (bx != lastXMin) || (bz != lastZMin)) {
- lastXMin = bx;
- lastZMin = bz;
- lastChunk = methodGetChunkAt.of(nmsWorld).call(bx, bz);
+ if ((this.lastChunk == null) || (bx != this.lastXMin) || (bz != this.lastZMin)) {
+ this.lastXMin = bx;
+ this.lastZMin = bz;
+ this.lastChunk = this.methodGetChunkAt.of(this.nmsWorld).call(bx, bz);
}
- if (lastChunk != null) {
- heights = (int[]) heightMap.of(lastChunk).get();
+ if (this.lastChunk != null) {
+ heights = (int[]) this.heightMap.of(this.lastChunk).get();
final int lx = x & 15;
final int lz = z & 15;
final int height = heights[((lz << 4) | lx)];
if ((height <= maxY) && (height >= minY)) {
final Vector pt = new Vector(x, height, z);
- final int id = session.getBlockType(pt);
+ final int id = this.session.getBlockType(pt);
if (naturalOnly ? BlockType.isNaturalTerrainBlock(id, 0) : !BlockType.canPassThrough(id, 0)) {
return height;
}
@@ -64,7 +64,7 @@ public class BukkitEditSessionWrapper_1_8 extends BukkitEditSessionWrapper_0 {
}
for (int y = maxY; y >= minY; --y) {
final Vector pt = new Vector(x, y, z);
- final int id = session.getBlockType(pt);
+ final int id = this.session.getBlockType(pt);
int data;
switch (id) {
case 0: {
@@ -160,5 +160,5 @@ public class BukkitEditSessionWrapper_1_8 extends BukkitEditSessionWrapper_0 {
}
return minY;
}
-
+
}
diff --git a/src/main/java/com/boydti/fawe/bukkit/v1_8/BukkitQueue_1_8.java b/src/main/java/com/boydti/fawe/bukkit/v1_8/BukkitQueue_1_8.java
index 11689046..8075229b 100644
--- a/src/main/java/com/boydti/fawe/bukkit/v1_8/BukkitQueue_1_8.java
+++ b/src/main/java/com/boydti/fawe/bukkit/v1_8/BukkitQueue_1_8.java
@@ -47,7 +47,7 @@ import com.sk89q.worldedit.bukkit.BukkitUtil;
import com.sk89q.worldedit.world.biome.BaseBiome;
public class BukkitQueue_1_8 extends BukkitQueue_0 {
-
+
private final RefClass classEntityPlayer = getRefClass("{nms}.EntityPlayer");
private final RefClass classMapChunk = getRefClass("{nms}.PacketPlayOutMapChunk");
private final RefClass classPacket = getRefClass("{nms}.Packet");
@@ -56,10 +56,10 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
private final RefClass classCraftPlayer = getRefClass("{cb}.entity.CraftPlayer");
private final RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
private final RefClass classWorld = getRefClass("{nms}.World");
- private final RefField mustSave = classChunk.getField("mustSave");
+ private final RefField mustSave = this.classChunk.getField("mustSave");
private final RefClass classBlockPosition = getRefClass("{nms}.BlockPosition");
private final RefClass classChunkSection = getRefClass("{nms}.ChunkSection");
-
+
private RefMethod methodGetHandlePlayer;
private RefMethod methodGetHandleChunk;
private RefConstructor MapChunk;
@@ -75,52 +75,52 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
private RefMethod methodGetIdArray;
private RefMethod methodGetWorld;
private RefField tileEntityListTick;
-
+
private final HashMap worldMap = new HashMap<>();
-
+
public BukkitQueue_1_8() {
try {
- methodGetHandlePlayer = classCraftPlayer.getMethod("getHandle");
- methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
- methodInitLighting = classChunk.getMethod("initLighting");
- MapChunk = classMapChunk.getConstructor(classChunk.getRealClass(), boolean.class, int.class);
- connection = classEntityPlayer.getField("playerConnection");
- send = classConnection.getMethod("sendPacket", classPacket.getRealClass());
- classBlockPositionConstructor = classBlockPosition.getConstructor(int.class, int.class, int.class);
- methodX = classWorld.getMethod("x", classBlockPosition.getRealClass());
- fieldSections = classChunk.getField("sections");
- fieldWorld = classChunk.getField("world");
- methodGetIdArray = classChunkSection.getMethod("getIdArray");
- methodAreNeighborsLoaded = classChunk.getMethod("areNeighborsLoaded", int.class);
- classChunkSectionConstructor = classChunkSection.getConstructor(int.class, boolean.class, char[].class);
- this.tileEntityListTick = classWorld.getField("tileEntityList");
- this.methodGetWorld = classChunk.getMethod("getWorld");
+ this.methodGetHandlePlayer = this.classCraftPlayer.getMethod("getHandle");
+ this.methodGetHandleChunk = this.classCraftChunk.getMethod("getHandle");
+ this.methodInitLighting = this.classChunk.getMethod("initLighting");
+ this.MapChunk = this.classMapChunk.getConstructor(this.classChunk.getRealClass(), boolean.class, int.class);
+ this.connection = this.classEntityPlayer.getField("playerConnection");
+ this.send = this.classConnection.getMethod("sendPacket", this.classPacket.getRealClass());
+ this.classBlockPositionConstructor = this.classBlockPosition.getConstructor(int.class, int.class, int.class);
+ this.methodX = this.classWorld.getMethod("x", this.classBlockPosition.getRealClass());
+ this.fieldSections = this.classChunk.getField("sections");
+ this.fieldWorld = this.classChunk.getField("world");
+ this.methodGetIdArray = this.classChunkSection.getMethod("getIdArray");
+ this.methodAreNeighborsLoaded = this.classChunk.getMethod("areNeighborsLoaded", int.class);
+ this.classChunkSectionConstructor = this.classChunkSection.getConstructor(int.class, boolean.class, char[].class);
+ this.tileEntityListTick = this.classWorld.getField("tileEntityList");
+ this.methodGetWorld = this.classChunk.getMethod("getWorld");
} catch (final NoSuchMethodException e) {
e.printStackTrace();
}
}
-
+
public FaweGenerator_1_8 getFaweGenerator(final World world) {
final ChunkGenerator gen = world.getGenerator();
if ((gen != null) && (gen instanceof FaweGenerator_1_8)) {
return (FaweGenerator_1_8) gen;
}
- FaweGenerator_1_8 faweGen = worldMap.get(world.getName());
+ FaweGenerator_1_8 faweGen = this.worldMap.get(world.getName());
if (faweGen != null) {
return faweGen;
}
faweGen = new FaweGenerator_1_8(this, world);
- worldMap.put(world.getName(), faweGen);
+ this.worldMap.put(world.getName(), faweGen);
return faweGen;
}
-
+
@Override
public Collection> sendChunk(final Collection> fcs) {
final HashMap, Object> packets = new HashMap<>();
final HashMap>> map = new HashMap<>();
for (final FaweChunk fc : fcs) {
- String world = fc.getChunkLoc().world;
+ final String world = fc.getChunkLoc().world;
ArrayList> list = map.get(world);
if (list == null) {
list = new ArrayList<>();
@@ -138,19 +138,19 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
final Location loc = player.getLocation();
final int cx = loc.getBlockX() >> 4;
final int cz = loc.getBlockZ() >> 4;
- final Object entity = methodGetHandlePlayer.of(player).call();
-
+ final Object entity = this.methodGetHandlePlayer.of(player).call();
+
for (final FaweChunk fc : list) {
final int dx = Math.abs(cx - fc.getChunkLoc().x);
final int dz = Math.abs(cz - fc.getChunkLoc().z);
if ((dx > view) || (dz > view)) {
continue;
}
- RefExecutor con = send.of(connection.of(entity).get());
+ final RefExecutor con = this.send.of(this.connection.of(entity).get());
Object packet = packets.get(fc);
if (packet == null) {
- final Object c = methodGetHandleChunk.of(fc.getChunk()).call();
- packet = MapChunk.create(c, true, 65535);
+ final Object c = this.methodGetHandleChunk.of(fc.getChunk()).call();
+ packet = this.MapChunk.create(c, true, 65535);
packets.put(fc, packet);
con.call(packet);
} else {
@@ -159,53 +159,53 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
}
}
final HashSet> chunks = new HashSet>();
- for (FaweChunk fc : fcs) {
- Chunk chunk = fc.getChunk();
+ for (final FaweChunk fc : fcs) {
+ final Chunk chunk = fc.getChunk();
chunk.unload(true, false);
chunk.load();
- ChunkLoc loc = fc.getChunkLoc();
+ final ChunkLoc loc = fc.getChunkLoc();
chunk.getWorld().refreshChunk(loc.x, loc.z);
- if (!fixLighting(fc, Settings.FIX_ALL_LIGHTING)) {
+ if (!this.fixLighting(fc, Settings.FIX_ALL_LIGHTING)) {
chunks.add(fc);
}
}
return chunks;
}
-
+
@Override
- public boolean fixLighting(final FaweChunk> fc, boolean fixAll) {
+ public boolean fixLighting(final FaweChunk> fc, final boolean fixAll) {
try {
- BukkitChunk_1_8 bc = (BukkitChunk_1_8) fc;
+ final BukkitChunk_1_8 bc = (BukkitChunk_1_8) fc;
final Chunk chunk = bc.getChunk();
if (!chunk.isLoaded()) {
chunk.load(false);
}
-
- // Initialize lighting
- final Object c = methodGetHandleChunk.of(chunk).call();
-
- methodInitLighting.of(c).call();
- if ((bc.getTotalRelight() == 0 && !fixAll)) {
+ // Initialize lighting
+ final Object c = this.methodGetHandleChunk.of(chunk).call();
+
+ this.methodInitLighting.of(c).call();
+
+ if (((bc.getTotalRelight() == 0) && !fixAll)) {
return true;
}
- final Object[] sections = (Object[]) fieldSections.of(c).get();
- final Object w = fieldWorld.of(c).get();
-
+ final Object[] sections = (Object[]) this.fieldSections.of(c).get();
+ final Object w = this.fieldWorld.of(c).get();
+
final int X = chunk.getX() << 4;
final int Z = chunk.getZ() << 4;
-
- RefExecutor relight = methodX.of(w);
+
+ final RefExecutor relight = this.methodX.of(w);
for (int j = 0; j < sections.length; j++) {
final Object section = sections[j];
if (section == null) {
continue;
}
- if ((bc.getRelight(j) == 0 && !fixAll) || bc.getCount(j) == 0 || (bc.getCount(j) >= 4096 && bc.getAir(j) == 0)) {
+ if (((bc.getRelight(j) == 0) && !fixAll) || (bc.getCount(j) == 0) || ((bc.getCount(j) >= 4096) && (bc.getAir(j) == 0))) {
continue;
}
- final char[] array = getIdArray(section);
+ final char[] array = this.getIdArray(section);
if (array == null) {
continue;
}
@@ -243,10 +243,10 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
final int x = FaweCache.CACHE_X[j][k];
final int y = FaweCache.CACHE_Y[j][k];
final int z = FaweCache.CACHE_Z[j][k];
- if (isSurrounded(sections, x, y, z)) {
+ if (this.isSurrounded(sections, x, y, z)) {
continue;
}
- final Object pos = classBlockPositionConstructor.create(X + x, y, Z + z);
+ final Object pos = this.classBlockPositionConstructor.create(X + x, y, Z + z);
relight.call(pos);
}
}
@@ -257,36 +257,36 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
}
return false;
}
-
- public boolean isSurrounded(Object[] sections, int x, int y, int z) {
- return isSolid(getId(sections, x, y + 1, z))
- && isSolid(getId(sections, x + 1, y - 1, z))
- && isSolid(getId(sections, x - 1, y, z))
- && isSolid(getId(sections, x, y, z + 1))
- && isSolid(getId(sections, x, y, z - 1));
+
+ public boolean isSurrounded(final Object[] sections, final int x, final int y, final int z) {
+ return this.isSolid(this.getId(sections, x, y + 1, z))
+ && this.isSolid(this.getId(sections, x + 1, y - 1, z))
+ && this.isSolid(this.getId(sections, x - 1, y, z))
+ && this.isSolid(this.getId(sections, x, y, z + 1))
+ && this.isSolid(this.getId(sections, x, y, z - 1));
}
-
- public boolean isSolid(int i) {
+
+ public boolean isSolid(final int i) {
if (i == 0) {
return false;
}
return Material.getMaterial(i).isOccluding();
}
- public int getId(Object[] sections, int x, int y, int z) {
- if (x < 0 || x > 15 || z < 0 || z > 15) {
+ public int getId(final Object[] sections, final int x, final int y, final int z) {
+ if ((x < 0) || (x > 15) || (z < 0) || (z > 15)) {
return 1;
}
- if (y < 0 || y > 255) {
+ if ((y < 0) || (y > 255)) {
return 1;
}
- int i = FaweCache.CACHE_I[y][x][z];
- Object section = sections[i];
+ final int i = FaweCache.CACHE_I[y][x][z];
+ final Object section = sections[i];
if (section == null) {
return 0;
}
- char[] array = getIdArray(section);
- int j = FaweCache.CACHE_J[y][x][z];
+ final char[] array = this.getIdArray(section);
+ final int j = FaweCache.CACHE_J[y][x][z];
return array[j] >> 4;
}
@@ -296,27 +296,27 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
final BukkitChunk_1_8 fs = ((BukkitChunk_1_8) fc);
final Chunk chunk = fs.getChunk();
final World world = chunk.getWorld();
-
+
final boolean flag = world.getEnvironment() == Environment.NORMAL;
-
+
// Sections
final Method getHandele = chunk.getClass().getDeclaredMethod("getHandle");
final Object c = getHandele.invoke(chunk);
- Object w = methodGetWorld.of(c).call();
+ final Object w = this.methodGetWorld.of(c).call();
final Class extends Object> clazz = c.getClass();
final Field sf = clazz.getDeclaredField("sections");
sf.setAccessible(true);
final Field tf = clazz.getDeclaredField("tileEntities");
final Field ef = clazz.getDeclaredField("entitySlices");
-
+
final Object[] sections = (Object[]) sf.get(c);
final HashMap, ?> tiles = (HashMap, ?>) tf.get(c);
final Collection>[] entities = (Collection>[]) ef.get(c);
-
+
Method xm = null;
Method ym = null;
Method zm = null;
-
+
// Trim tiles
boolean removed = false;
final Set> entryset = (Set>) (Set>) tiles.entrySet();
@@ -347,14 +347,14 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
if (removed) {
((Collection) this.tileEntityListTick.of(w).get()).clear();
}
-
+
// Trim entities
for (int i = 0; i < 16; i++) {
if ((entities[i] != null) && (fs.getCount(i) >= 4096)) {
entities[i].clear();
}
}
-
+
// Efficiently merge sections
for (int j = 0; j < sections.length; j++) {
if (fs.getCount(j) == 0) {
@@ -366,10 +366,10 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
}
Object section = sections[j];
if ((section == null) || (fs.getCount(j) >= 4096)) {
- section = sections[j] = newChunkSection(j << 4, flag, newArray);
+ section = sections[j] = this.newChunkSection(j << 4, flag, newArray);
continue;
}
- final char[] currentArray = getIdArray(section);
+ final char[] currentArray = this.getIdArray(section);
boolean fill = true;
for (int k = 0; k < newArray.length; k++) {
final char n = newArray[k];
@@ -394,22 +394,22 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
fs.setCount(j, Short.MAX_VALUE);
}
}
-
+
// Biomes
- int[][] biomes = fs.getBiomeArray();
+ final int[][] biomes = fs.getBiomeArray();
if (biomes != null) {
- LocalWorld lw = BukkitUtil.getLocalWorld(world);
- int X = fs.getChunkLoc().x << 4;
- int Z = fs.getChunkLoc().z << 4;
- BaseBiome bb = new BaseBiome(0);
+ final LocalWorld lw = BukkitUtil.getLocalWorld(world);
+ final int X = fs.getChunkLoc().x << 4;
+ final int Z = fs.getChunkLoc().z << 4;
+ final BaseBiome bb = new BaseBiome(0);
int last = 0;
for (int x = 0; x < 16; x++) {
- int[] array = biomes[x];
+ final int[] array = biomes[x];
if (array == null) {
continue;
}
for (int z = 0; z < 16; z++) {
- int biome = array[z];
+ final int biome = array[z];
if (biome == 0) {
continue;
}
@@ -421,7 +421,7 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
}
}
}
-
+
// Clear
fs.clear();
return true;
@@ -430,7 +430,7 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
}
return false;
}
-
+
@Override
public void clear() {
super.clear();
@@ -439,8 +439,8 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
HashMap> players = new HashMap<>();
for (final Player player : Bukkit.getOnlinePlayers()) {
// Clear history
- FawePlayer
*/
public class EditSession implements Extent {
-
+
private final Logger log = Logger.getLogger(EditSession.class.getCanonicalName());
-
+
/**
* Used by {@link #setBlock(Vector, BaseBlock, Stage)} to
* determine which {@link Extent}s should be bypassed.
@@ -147,7 +147,7 @@ public class EditSession implements Extent {
public enum Stage {
BEFORE_HISTORY, BEFORE_REORDER, BEFORE_CHANGE
}
-
+
protected final World world;
private final ChangeSet changeSet = new BlockOptimizedHistory();
private final EditSessionWrapper wrapper;
@@ -160,7 +160,7 @@ public class EditSession implements Extent {
private final Extent bypassNone;
private boolean fastmode;
private Mask oldMask;
-
+
public static BaseBiome nullBiome = new BaseBiome(0);
public static BaseBlock nullBlock = new BaseBlock(0);
@@ -175,7 +175,7 @@ public class EditSession implements Extent {
public EditSession(final LocalWorld world, final int maxBlocks) {
this(world, maxBlocks, null);
}
-
+
/**
* Create a new instance.
*
@@ -188,14 +188,13 @@ public class EditSession implements Extent {
public EditSession(final LocalWorld world, final int maxBlocks, @Nullable final BlockBag blockBag) {
this(WorldEdit.getInstance().getEventBus(), world, maxBlocks, blockBag, new EditSessionEvent(world, null, maxBlocks, null));
}
-
-
+
private final Thread thread;
-
+
private int changes = 0;
private int maxBlocks;
private BlockBag blockBag;
-
+
/**
* Construct the object with a maximum number of blocks and a block bag.
*
@@ -209,58 +208,58 @@ public class EditSession implements Extent {
checkNotNull(eventBus);
checkArgument(maxBlocks >= -1, "maxBlocks >= -1 required");
checkNotNull(event);
-
+
this.blockBag = blockBag;
this.maxBlocks = maxBlocks;
this.thread = Fawe.get().getMainThread();
this.world = world;
- wrapper = Fawe.imp().getEditSessionWrapper(this);
-
+ this.wrapper = Fawe.imp().getEditSessionWrapper(this);
+
// Invalid; return null extent
if (world == null) {
- Extent extent = new NullExtent();
- bypassReorderHistory = extent;
- bypassHistory = extent;
- bypassNone = extent;
+ final Extent extent = new NullExtent();
+ this.bypassReorderHistory = extent;
+ this.bypassHistory = extent;
+ this.bypassNone = extent;
return;
}
- Actor actor = event.getActor();
-
+ final Actor actor = event.getActor();
+
// Not a player; bypass history
- if (actor == null || !actor.isPlayer()) {
- Extent extent = new FastWorldEditExtent(world, thread);
+ if ((actor == null) || !actor.isPlayer()) {
+ Extent extent = new FastWorldEditExtent(world, this.thread);
// Everything bypasses
- extent = wrapExtent(extent, eventBus, event, Stage.BEFORE_CHANGE);
- extent = wrapExtent(extent, eventBus, event, Stage.BEFORE_REORDER);
- extent = wrapExtent(extent, eventBus, event, Stage.BEFORE_HISTORY);
- bypassReorderHistory = extent;
- bypassHistory = extent;
- bypassNone = extent;
+ extent = this.wrapExtent(extent, eventBus, event, Stage.BEFORE_CHANGE);
+ extent = this.wrapExtent(extent, eventBus, event, Stage.BEFORE_REORDER);
+ extent = this.wrapExtent(extent, eventBus, event, Stage.BEFORE_HISTORY);
+ this.bypassReorderHistory = extent;
+ this.bypassHistory = extent;
+ this.bypassNone = extent;
return;
}
-
+
Extent extent;
- String name = actor.getName();
- FawePlayer fp = FawePlayer.wrap(name);
- LocalSession session = fp.getSession();
- if (fastmode = session.hasFastMode()) {
+ final String name = actor.getName();
+ final FawePlayer fp = FawePlayer.wrap(name);
+ final LocalSession session = fp.getSession();
+ if (this.fastmode = session.hasFastMode()) {
session.clearHistory();
}
if (fp.hasWorldEditBypass()) {
// Bypass skips processing and area restrictions
- extent = new FastWorldEditExtent(world, thread);
- if (hasFastMode()) {
+ extent = new FastWorldEditExtent(world, this.thread);
+ if (this.hasFastMode()) {
// Fastmode skips history and memory checks
- extent = wrapExtent(extent, eventBus, event, Stage.BEFORE_CHANGE);
- extent = wrapExtent(extent, eventBus, event, Stage.BEFORE_REORDER);
- extent = wrapExtent(extent, eventBus, event, Stage.BEFORE_HISTORY);
- bypassReorderHistory = extent;
- bypassHistory = extent;
- bypassNone = extent;
+ extent = this.wrapExtent(extent, eventBus, event, Stage.BEFORE_CHANGE);
+ extent = this.wrapExtent(extent, eventBus, event, Stage.BEFORE_REORDER);
+ extent = this.wrapExtent(extent, eventBus, event, Stage.BEFORE_HISTORY);
+ this.bypassReorderHistory = extent;
+ this.bypassHistory = extent;
+ this.bypassNone = extent;
return;
}
} else {
- HashSet mask = WEManager.IMP.getMask(fp);
+ final HashSet mask = WEManager.IMP.getMask(fp);
if (mask.size() == 0) {
if (Perm.hasPermission(fp, "fawe.admin")) {
BBC.WORLDEDIT_BYPASS.send(fp);
@@ -269,24 +268,24 @@ public class EditSession implements Extent {
}
// No allowed area; return null extent
extent = new NullExtent();
- bypassReorderHistory = extent;
- bypassHistory = extent;
- bypassNone = extent;
+ this.bypassReorderHistory = extent;
+ this.bypassHistory = extent;
+ this.bypassNone = extent;
return;
}
// Process the WorldEdit action
- extent = processed = new ProcessedWEExtent(world, thread, fp, mask, maxBlocks);
- if (hasFastMode()) {
+ extent = this.processed = new ProcessedWEExtent(world, this.thread, fp, mask, maxBlocks);
+ if (this.hasFastMode()) {
// Fastmode skips history, masking, and memory checks
- extent = wrapExtent(extent, eventBus, event, Stage.BEFORE_CHANGE);
- extent = wrapExtent(extent, eventBus, event, Stage.BEFORE_REORDER);
- extent = wrapExtent(extent, eventBus, event, Stage.BEFORE_HISTORY);
+ extent = this.wrapExtent(extent, eventBus, event, Stage.BEFORE_CHANGE);
+ extent = this.wrapExtent(extent, eventBus, event, Stage.BEFORE_REORDER);
+ extent = this.wrapExtent(extent, eventBus, event, Stage.BEFORE_HISTORY);
extent = new ExtentWrapper(extent);
// Set the parent. This allows efficient cancelling
- processed.setParent(extent);
- bypassReorderHistory = extent;
- bypassHistory = extent;
- bypassNone = extent;
+ this.processed.setParent(extent);
+ this.bypassReorderHistory = extent;
+ this.bypassHistory = extent;
+ this.bypassNone = extent;
return;
} else {
if (MemUtil.isMemoryLimited()) {
@@ -296,22 +295,22 @@ public class EditSession implements Extent {
}
// Memory limit reached; return null extent
extent = new NullExtent();
- bypassReorderHistory = extent;
- bypassHistory = extent;
- bypassNone = extent;
+ this.bypassReorderHistory = extent;
+ this.bypassHistory = extent;
+ this.bypassNone = extent;
return;
}
}
// Perform memory checks after reorder
extent = new SafeExtentWrapper(fp, extent);
- processed.setParent(extent);
+ this.processed.setParent(extent);
}
// Include history, masking and memory checking.
Extent wrapped;
- extent = wrapped = wrapExtent(extent, eventBus, event, Stage.BEFORE_CHANGE);
- extent = reorderExtent = new MultiStageReorder(extent, false);
- extent = wrapExtent(extent, eventBus, event, Stage.BEFORE_REORDER);
- extent = changeSetExtent = wrapper.getHistoryExtent(extent, changeSet, fp);
+ extent = wrapped = this.wrapExtent(extent, eventBus, event, Stage.BEFORE_CHANGE);
+ extent = this.reorderExtent = new MultiStageReorder(extent, false);
+ extent = this.wrapExtent(extent, eventBus, event, Stage.BEFORE_REORDER);
+ extent = this.changeSetExtent = this.wrapper.getHistoryExtent(extent, this.changeSet, fp);
final Player skp = (Player) actor;
final int item = skp.getItemInHand();
boolean hasMask = session.getMask() != null;
@@ -324,22 +323,22 @@ public class EditSession implements Extent {
} catch (final Exception e) {}
}
if (hasMask) {
- extent = maskingExtent = new MaskingExtent(extent, Masks.alwaysTrue());
+ extent = this.maskingExtent = new MaskingExtent(extent, Masks.alwaysTrue());
}
-
- extent = wrapExtent(extent, eventBus, event, Stage.BEFORE_HISTORY);
+
+ extent = this.wrapExtent(extent, eventBus, event, Stage.BEFORE_HISTORY);
extent = new SafeExtentWrapper(fp, extent);
this.bypassReorderHistory = wrapped;
- this.bypassHistory = reorderExtent;
+ this.bypassHistory = this.reorderExtent;
this.bypassNone = extent;
return;
}
-
+
private Extent wrapExtent(final Extent extent, final EventBus eventBus, EditSessionEvent event, final Stage stage) {
event = event.clone(stage);
event.setExtent(extent);
eventBus.post(event);
- Extent toReturn = event.getExtent();
+ final Extent toReturn = event.getExtent();
if (toReturn != extent) {
Fawe.debug("&cPotentially inefficient WorldEdit extent: " + toReturn.getClass().getCanonicalName());
Fawe.debug("&8 - &7For area restrictions, it is recommended to use the FaweAPI");
@@ -347,25 +346,25 @@ public class EditSession implements Extent {
}
return toReturn;
}
-
+
/**
* Get the world.
*
* @return the world
*/
public World getWorld() {
- return world;
+ return this.world;
}
-
+
/**
* Get the underlying {@link ChangeSet}.
*
* @return the change set
*/
public ChangeSet getChangeSet() {
- return changeSet;
+ return this.changeSet;
}
-
+
/**
* Get the maximum number of blocks that can be changed. -1 will be returned
* if it the limit disabled.
@@ -373,77 +372,77 @@ public class EditSession implements Extent {
* @return the limit (>= 0) or -1 for no limit
*/
public int getBlockChangeLimit() {
- return maxBlocks;
+ return this.maxBlocks;
}
-
+
/**
* Set the maximum number of blocks that can be changed.
*
* @param limit the limit (>= 0) or -1 for no limit
*/
public void setBlockChangeLimit(final int limit) {
- if (processed != null) {
- maxBlocks = limit;
- processed.setMax(limit);
+ if (this.processed != null) {
+ this.maxBlocks = limit;
+ this.processed.setMax(limit);
}
}
-
+
/**
* Returns queue status.
*
* @return whether the queue is enabled
*/
public boolean isQueueEnabled() {
- return reorderExtent != null && reorderExtent.isEnabled();
+ return (this.reorderExtent != null) && this.reorderExtent.isEnabled();
}
-
+
/**
* Queue certain types of block for better reproduction of those blocks.
*/
public void enableQueue() {
- if (reorderExtent != null) {
- reorderExtent.setEnabled(true);
+ if (this.reorderExtent != null) {
+ this.reorderExtent.setEnabled(true);
}
}
-
+
/**
* Disable the queue. This will flush the queue.
*/
public void disableQueue() {
- if (isQueueEnabled()) {
- flushQueue();
+ if (this.isQueueEnabled()) {
+ this.flushQueue();
}
- if (reorderExtent != null) {
- reorderExtent.setEnabled(true);
+ if (this.reorderExtent != null) {
+ this.reorderExtent.setEnabled(true);
}
}
-
+
/**
* Get the mask.
*
* @return mask, may be null
*/
public Mask getMask() {
- return oldMask;
+ return this.oldMask;
}
-
+
/**
* Set a mask.
*
* @param mask mask or null
*/
public void setMask(final Mask mask) {
- if (maskingExtent == null) {
+ if (this.maskingExtent == null) {
return;
}
- oldMask = mask;
+ this.oldMask = mask;
if (mask == null) {
- maskingExtent.setMask(Masks.alwaysTrue());
+ this.maskingExtent.setMask(Masks.alwaysTrue());
} else {
- maskingExtent.setMask(mask);
+ this.maskingExtent.setMask(mask);
}
}
-
+
/**
* Set the mask.
*
@@ -453,12 +452,12 @@ public class EditSession implements Extent {
@Deprecated
public void setMask(final com.sk89q.worldedit.masks.Mask mask) {
if (mask == null) {
- setMask((Mask) null);
+ this.setMask((Mask) null);
} else {
- setMask(Masks.wrap(mask));
+ this.setMask(Masks.wrap(mask));
}
}
-
+
/**
* Get the {@link SurvivalModeExtent}.
*
@@ -467,7 +466,7 @@ public class EditSession implements Extent {
public SurvivalModeExtent getSurvivalExtent() {
return null;
}
-
+
/**
* Set whether fast mode is enabled.
*
@@ -477,9 +476,9 @@ public class EditSession implements Extent {
* @param enabled true to enable
*/
public void setFastMode(final boolean enabled) {
- fastmode = enabled;
+ this.fastmode = enabled;
}
-
+
/**
* Return fast mode status.
*
@@ -489,18 +488,18 @@ public class EditSession implements Extent {
* @return true if enabled
*/
public boolean hasFastMode() {
- return fastmode;
+ return this.fastmode;
}
-
+
/**
* Get the {@link BlockBag} is used.
*
* @return a block bag or null
*/
public BlockBag getBlockBag() {
- return blockBag;
+ return this.blockBag;
}
-
+
/**
* Set a {@link BlockBag} to use.
*
@@ -509,7 +508,7 @@ public class EditSession implements Extent {
public void setBlockBag(final BlockBag blockBag) {
this.blockBag = blockBag;
}
-
+
/**
* Gets the list of missing blocks and clears the list for the next
* operation.
@@ -519,7 +518,7 @@ public class EditSession implements Extent {
public Map popMissingBlocks() {
return new HashMap<>();
}
-
+
/**
* Get the number of blocks changed, including repeated block changes.
*
@@ -528,36 +527,36 @@ public class EditSession implements Extent {
* @return the number of block changes
*/
public int getBlockChangeCount() {
- return changes;
+ return this.changes;
}
-
+
@Override
public BaseBiome getBiome(final Vector2D position) {
- synchronized (thread) {
- return bypassNone.getBiome(position);
+ synchronized (this.thread) {
+ return this.bypassNone.getBiome(position);
}
}
-
+
@Override
public boolean setBiome(final Vector2D position, final BaseBiome biome) {
- changes = -1;
- return bypassNone.setBiome(position, biome);
+ this.changes = -1;
+ return this.bypassNone.setBiome(position, biome);
}
-
+
@Override
public BaseBlock getLazyBlock(final Vector position) {
- synchronized (thread) {
- return world.getBlock(position);
+ synchronized (this.thread) {
+ return this.world.getBlock(position);
}
}
-
+
@Override
public synchronized BaseBlock getBlock(final Vector position) {
- synchronized (thread) {
- return world.getBlock(position);
+ synchronized (this.thread) {
+ return this.world.getBlock(position);
}
}
-
+
/**
* Get a block type at the given position.
*
@@ -567,11 +566,11 @@ public class EditSession implements Extent {
*/
@Deprecated
public synchronized int getBlockType(final Vector position) {
- synchronized (thread) {
- return world.getBlockType(position);
+ synchronized (this.thread) {
+ return this.world.getBlockType(position);
}
}
-
+
/**
* Get a block data at the given position.
*
@@ -581,11 +580,11 @@ public class EditSession implements Extent {
*/
@Deprecated
public synchronized int getBlockData(final Vector position) {
- synchronized (thread) {
- return world.getBlockData(position);
+ synchronized (this.thread) {
+ return this.world.getBlockData(position);
}
}
-
+
/**
* Gets the block type at a position.
*
@@ -595,9 +594,9 @@ public class EditSession implements Extent {
*/
@Deprecated
public BaseBlock rawGetBlock(final Vector position) {
- return getBlock(position);
+ return this.getBlock(position);
}
-
+
/**
* Returns the highest solid 'terrain' block which can occur naturally.
*
@@ -608,9 +607,9 @@ public class EditSession implements Extent {
* @return height of highest block found or 'minY'
*/
public int getHighestTerrainBlock(final int x, final int z, final int minY, final int maxY) {
- return getHighestTerrainBlock(x, z, minY, maxY, false);
+ return this.getHighestTerrainBlock(x, z, minY, maxY, false);
}
-
+
/**
* Returns the highest solid 'terrain' block which can occur naturally.
*
@@ -622,9 +621,9 @@ public class EditSession implements Extent {
* @return height of highest block found or 'minY'
*/
public int getHighestTerrainBlock(final int x, final int z, final int minY, final int maxY, final boolean naturalOnly) {
- return wrapper.getHighestTerrainBlock(x, z, minY, maxY, naturalOnly);
+ return this.wrapper.getHighestTerrainBlock(x, z, minY, maxY, naturalOnly);
}
-
+
/**
* Set a block, bypassing both history and block re-ordering.
*
@@ -635,19 +634,19 @@ public class EditSession implements Extent {
* @throws WorldEditException thrown on a set error
*/
public boolean setBlock(final Vector position, final BaseBlock block, final Stage stage) throws WorldEditException {
- changes = -1;
+ this.changes = -1;
switch (stage) {
case BEFORE_HISTORY:
- return bypassNone.setBlock(position, block);
+ return this.bypassNone.setBlock(position, block);
case BEFORE_CHANGE:
- return bypassHistory.setBlock(position, block);
+ return this.bypassHistory.setBlock(position, block);
case BEFORE_REORDER:
- return bypassReorderHistory.setBlock(position, block);
+ return this.bypassReorderHistory.setBlock(position, block);
}
-
+
throw new RuntimeException("New enum entry added that is unhandled here");
}
-
+
/**
* Set a block, bypassing both history and block re-ordering.
*
@@ -657,12 +656,12 @@ public class EditSession implements Extent {
*/
public boolean rawSetBlock(final Vector position, final BaseBlock block) {
try {
- return setBlock(position, block, Stage.BEFORE_CHANGE);
+ return this.setBlock(position, block, Stage.BEFORE_CHANGE);
} catch (final WorldEditException e) {
throw new RuntimeException("Unexpected exception", e);
}
}
-
+
/**
* Set a block, bypassing history but still utilizing block re-ordering.
*
@@ -672,23 +671,23 @@ public class EditSession implements Extent {
*/
public boolean smartSetBlock(final Vector position, final BaseBlock block) {
try {
- return setBlock(position, block, Stage.BEFORE_REORDER);
+ return this.setBlock(position, block, Stage.BEFORE_REORDER);
} catch (final WorldEditException e) {
throw new RuntimeException("Unexpected exception", e);
}
}
-
+
@Override
public boolean setBlock(final Vector position, final BaseBlock block) throws MaxChangedBlocksException {
try {
- return setBlock(position, block, Stage.BEFORE_HISTORY);
+ return this.setBlock(position, block, Stage.BEFORE_HISTORY);
} catch (final MaxChangedBlocksException e) {
throw e;
} catch (final WorldEditException e) {
throw new RuntimeException("Unexpected exception", e);
}
}
-
+
/**
* Sets the block at a position, subject to both history and block re-ordering.
*
@@ -699,9 +698,9 @@ public class EditSession implements Extent {
*/
@SuppressWarnings("deprecation")
public boolean setBlock(final Vector position, final Pattern pattern) throws MaxChangedBlocksException {
- return setBlock(position, pattern.next(position));
+ return this.setBlock(position, pattern.next(position));
}
-
+
/**
* Set blocks that are in a set of positions and return the number of times
* that the block set calls returned true.
@@ -715,11 +714,11 @@ public class EditSession implements Extent {
private int setBlocks(final Set vset, final Pattern pattern) throws MaxChangedBlocksException {
int affected = 0;
for (final Vector v : vset) {
- affected += setBlock(v, pattern) ? 1 : 0;
+ affected += this.setBlock(v, pattern) ? 1 : 0;
}
return affected;
}
-
+
/**
* Set a block (only if a previous block was not there) if {@link Math#random()}
* returns a number less than the given probability.
@@ -731,9 +730,9 @@ public class EditSession implements Extent {
* @throws MaxChangedBlocksException thrown if too many blocks are changed
*/
public boolean setChanceBlockIfAir(final Vector position, final BaseBlock block, final double probability) throws MaxChangedBlocksException {
- return (FaweCache.RANDOM.random(65536) <= (probability * 65536)) && setBlockIfAir(position, block);
+ return (FaweCache.RANDOM.random(65536) <= (probability * 65536)) && this.setBlockIfAir(position, block);
}
-
+
/**
* Set a block only if there's no block already there.
*
@@ -745,15 +744,15 @@ public class EditSession implements Extent {
*/
@Deprecated
public boolean setBlockIfAir(final Vector position, final BaseBlock block) throws MaxChangedBlocksException {
- return getBlock(position).isAir() && setBlock(position, block);
+ return this.getBlock(position).isAir() && this.setBlock(position, block);
}
-
+
@Override
@Nullable
public Entity createEntity(final com.sk89q.worldedit.util.Location location, final BaseEntity entity) {
- return bypassNone.createEntity(location, entity);
+ return this.bypassNone.createEntity(location, entity);
}
-
+
/**
* Insert a contrived block change into the history.
*
@@ -764,9 +763,9 @@ public class EditSession implements Extent {
*/
@Deprecated
public void rememberChange(final Vector position, final BaseBlock existing, final BaseBlock block) {
- changeSet.add(new BlockChange(position.toBlockVector(), existing, block));
+ this.changeSet.add(new BlockChange(position.toBlockVector(), existing, block));
}
-
+
/**
* Restores all blocks to their initial state.
*
@@ -775,16 +774,16 @@ public class EditSession implements Extent {
public void undo(final EditSession editSession) {
final UndoContext context = new UndoContext();
context.setExtent(editSession.bypassHistory);
- Operations.completeSmart(ChangeSetExecutor.createUndo(changeSet, context), new Runnable() {
+ Operations.completeSmart(ChangeSetExecutor.createUndo(this.changeSet, context), new Runnable() {
@Override
public void run() {
editSession.flushQueue();
}
}, true);
editSession.changes = 0;
- changes = 0;
+ this.changes = 0;
}
-
+
/**
* Sets to new state.
*
@@ -793,45 +792,45 @@ public class EditSession implements Extent {
public void redo(final EditSession editSession) {
final UndoContext context = new UndoContext();
context.setExtent(editSession.bypassHistory);
- Operations.completeSmart(ChangeSetExecutor.createRedo(changeSet, context), new Runnable() {
+ Operations.completeSmart(ChangeSetExecutor.createRedo(this.changeSet, context), new Runnable() {
@Override
public void run() {
editSession.flushQueue();
}
}, true);
editSession.changes = 0;
- changes = 0;
+ this.changes = 0;
}
-
+
/**
* Get the number of changed blocks.
*
* @return the number of changes
*/
public int size() {
- return getBlockChangeCount();
+ return this.getBlockChangeCount();
}
-
+
@Override
public Vector getMinimumPoint() {
- return getWorld().getMinimumPoint();
+ return this.getWorld().getMinimumPoint();
}
-
+
@Override
public Vector getMaximumPoint() {
- return getWorld().getMaximumPoint();
+ return this.getWorld().getMaximumPoint();
}
-
+
@Override
public List extends Entity> getEntities(final Region region) {
- return bypassNone.getEntities(region);
+ return this.bypassNone.getEntities(region);
}
-
+
@Override
public List extends Entity> getEntities() {
- return bypassNone.getEntities();
+ return this.bypassNone.getEntities();
}
-
+
/**
* Finish off the queue.
*/
@@ -839,16 +838,16 @@ public class EditSession implements Extent {
TaskManager.IMP.async(new Runnable() {
@Override
public void run() {
- Operations.completeBlindly(commit());
+ Operations.completeBlindly(EditSession.this.commit());
}
});
}
-
+
@Override
public @Nullable Operation commit() {
- return bypassNone.commit();
+ return this.bypassNone.commit();
}
-
+
/**
* Count the number of blocks of a given list of types in a region.
*
@@ -863,20 +862,20 @@ public class EditSession implements Extent {
ids[id] = true;
}
}
- return countBlock(region, ids);
+ return this.countBlock(region, ids);
}
-
+
public int countBlock(final Region region, final boolean[] ids) {
int i = 0;
for (final Vector pt : region) {
- final int id = getBlockType(pt);
+ final int id = this.getBlockType(pt);
if (ids[id]) {
i++;
}
}
return i;
}
-
+
/**
* Count the number of blocks of a list of types in a region.
*
@@ -892,9 +891,9 @@ public class EditSession implements Extent {
ids[id] = true;
}
}
- return countBlock(region, ids);
+ return this.countBlock(region, ids);
}
-
+
/**
* Fills an area recursively in the X/Z directions.
*
@@ -908,9 +907,9 @@ public class EditSession implements Extent {
*/
@SuppressWarnings("deprecation")
public int fillXZ(final Vector origin, final BaseBlock block, final double radius, final int depth, final boolean recursive) throws MaxChangedBlocksException {
- return fillXZ(origin, new SingleBlockPattern(block), radius, depth, recursive);
+ return this.fillXZ(origin, new SingleBlockPattern(block), radius, depth, recursive);
}
-
+
/**
* Fills an area recursively in the X/Z directions.
*
@@ -928,16 +927,16 @@ public class EditSession implements Extent {
checkNotNull(pattern);
checkArgument(radius >= 0, "radius >= 0");
checkArgument(depth >= 1, "depth >= 1");
-
+
TaskManager.IMP.async(new Runnable() {
@Override
public void run() {
final MaskIntersection mask = new MaskIntersection(new RegionMask(new EllipsoidRegion(null, origin, new Vector(radius, radius, radius))), new BoundedHeightMask(Math.max(
- (origin.getBlockY() - depth) + 1, 0), Math.min(getWorld().getMaxY(), origin.getBlockY())), Masks.negate(new ExistingBlockMask(EditSession.this)));
-
+ (origin.getBlockY() - depth) + 1, 0), Math.min(EditSession.this.getWorld().getMaxY(), origin.getBlockY())), Masks.negate(new ExistingBlockMask(EditSession.this)));
+
// Want to replace blocks
final BlockReplace replace = new BlockReplace(EditSession.this, Patterns.wrap(pattern));
-
+
// Pick how we're going to visit blocks
RecursiveVisitor visitor;
if (recursive) {
@@ -945,10 +944,10 @@ public class EditSession implements Extent {
} else {
visitor = new DownwardVisitor(mask, replace, origin.getBlockY());
}
-
+
// Start at the origin
visitor.visit(origin);
-
+
// Execute
Operations.completeSmart(visitor, new Runnable() {
@Override
@@ -958,9 +957,9 @@ public class EditSession implements Extent {
}, true);
}
});
- return changes = -1;
+ return this.changes = -1;
}
-
+
/**
* Remove a cuboid above the given position with a given apothem and a given height.
*
@@ -975,13 +974,13 @@ public class EditSession implements Extent {
checkNotNull(position);
checkArgument(apothem >= 1, "apothem >= 1");
checkArgument(height >= 1, "height >= 1");
-
- final Region region = new CuboidRegion(getWorld(), // Causes clamping of Y range
+
+ final Region region = new CuboidRegion(this.getWorld(), // Causes clamping of Y range
position.add(-apothem + 1, 0, -apothem + 1), position.add(apothem - 1, height - 1, apothem - 1));
final Pattern pattern = new SingleBlockPattern(new BaseBlock(BlockID.AIR));
- return setBlocks(region, pattern);
+ return this.setBlocks(region, pattern);
}
-
+
/**
* Remove a cuboid below the given position with a given apothem and a given height.
*
@@ -996,13 +995,13 @@ public class EditSession implements Extent {
checkNotNull(position);
checkArgument(apothem >= 1, "apothem >= 1");
checkArgument(height >= 1, "height >= 1");
-
- final Region region = new CuboidRegion(getWorld(), // Causes clamping of Y range
+
+ final Region region = new CuboidRegion(this.getWorld(), // Causes clamping of Y range
position.add(-apothem + 1, 0, -apothem + 1), position.add(apothem - 1, -height + 1, apothem - 1));
final Pattern pattern = new SingleBlockPattern(new BaseBlock(BlockID.AIR));
- return setBlocks(region, pattern);
+ return this.setBlocks(region, pattern);
}
-
+
/**
* Remove blocks of a certain type nearby a given position.
*
@@ -1016,15 +1015,15 @@ public class EditSession implements Extent {
public int removeNear(final Vector position, final int blockType, final int apothem) throws MaxChangedBlocksException {
checkNotNull(position);
checkArgument(apothem >= 1, "apothem >= 1");
-
+
final Mask mask = new FuzzyBlockMask(this, new BaseBlock(blockType, -1));
final Vector adjustment = new Vector(1, 1, 1).multiply(apothem - 1);
- final Region region = new CuboidRegion(getWorld(), // Causes clamping of Y range
+ final Region region = new CuboidRegion(this.getWorld(), // Causes clamping of Y range
position.add(adjustment.multiply(-1)), position.add(adjustment));
final Pattern pattern = new SingleBlockPattern(new BaseBlock(BlockID.AIR));
- return replaceBlocks(region, mask, pattern);
+ return this.replaceBlocks(region, mask, pattern);
}
-
+
/**
* Sets all the blocks inside a region to a given block type.
*
@@ -1035,9 +1034,9 @@ public class EditSession implements Extent {
*/
@SuppressWarnings("deprecation")
public int setBlocks(final Region region, final BaseBlock block) throws MaxChangedBlocksException {
- return setBlocks(region, new SingleBlockPattern(block));
+ return this.setBlocks(region, new SingleBlockPattern(block));
}
-
+
/**
* Sets all the blocks inside a region to a given pattern.
*
@@ -1050,7 +1049,7 @@ public class EditSession implements Extent {
public int setBlocks(final Region region, final Pattern pattern) throws MaxChangedBlocksException {
checkNotNull(region);
checkNotNull(pattern);
-
+
TaskManager.IMP.async(new Runnable() {
@Override
public void run() {
@@ -1064,9 +1063,9 @@ public class EditSession implements Extent {
}, true);
}
});
- return changes = -1;
+ return this.changes = -1;
}
-
+
/**
* Replaces all the blocks matching a given filter, within a given region, to a block
* returned by a given pattern.
@@ -1079,9 +1078,9 @@ public class EditSession implements Extent {
*/
@SuppressWarnings("deprecation")
public int replaceBlocks(final Region region, final Set filter, final BaseBlock replacement) throws MaxChangedBlocksException {
- return replaceBlocks(region, filter, new SingleBlockPattern(replacement));
+ return this.replaceBlocks(region, filter, new SingleBlockPattern(replacement));
}
-
+
/**
* Replaces all the blocks matching a given filter, within a given region, to a block
* returned by a given pattern.
@@ -1095,9 +1094,9 @@ public class EditSession implements Extent {
@SuppressWarnings("deprecation")
public int replaceBlocks(final Region region, final Set filter, final Pattern pattern) throws MaxChangedBlocksException {
final Mask mask = filter == null ? new ExistingBlockMask(this) : new FuzzyBlockMask(this, filter);
- return replaceBlocks(region, mask, pattern);
+ return this.replaceBlocks(region, mask, pattern);
}
-
+
/**
* Replaces all the blocks matching a given mask, within a given region, to a block
* returned by a given pattern.
@@ -1113,7 +1112,7 @@ public class EditSession implements Extent {
checkNotNull(region);
checkNotNull(mask);
checkNotNull(pattern);
-
+
TaskManager.IMP.async(new Runnable() {
@Override
public void run() {
@@ -1128,9 +1127,9 @@ public class EditSession implements Extent {
}, true);
}
});
- return changes = -1;
+ return this.changes = -1;
}
-
+
/**
* Sets the blocks at the center of the given region to the given pattern.
* If the center sits between two blocks on a certain axis, then two blocks
@@ -1145,13 +1144,13 @@ public class EditSession implements Extent {
public int center(final Region region, final Pattern pattern) throws MaxChangedBlocksException {
checkNotNull(region);
checkNotNull(pattern);
-
+
final Vector center = region.getCenter();
- final Region centerRegion = new CuboidRegion(getWorld(), // Causes clamping of Y range
+ final Region centerRegion = new CuboidRegion(this.getWorld(), // Causes clamping of Y range
new Vector((int) center.getX(), (int) center.getY(), (int) center.getZ()), center.toBlockVector());
- return setBlocks(centerRegion, pattern);
+ return this.setBlocks(centerRegion, pattern);
}
-
+
/**
* Make the faces of the given region as if it was a {@link CuboidRegion}.
*
@@ -1162,9 +1161,9 @@ public class EditSession implements Extent {
*/
@SuppressWarnings("deprecation")
public int makeCuboidFaces(final Region region, final BaseBlock block) throws MaxChangedBlocksException {
- return makeCuboidFaces(region, new SingleBlockPattern(block));
+ return this.makeCuboidFaces(region, new SingleBlockPattern(block));
}
-
+
/**
* Make the faces of the given region as if it was a {@link CuboidRegion}.
*
@@ -1177,12 +1176,12 @@ public class EditSession implements Extent {
public int makeCuboidFaces(final Region region, final Pattern pattern) throws MaxChangedBlocksException {
checkNotNull(region);
checkNotNull(pattern);
-
+
final CuboidRegion cuboid = CuboidRegion.makeCuboid(region);
final Region faces = cuboid.getFaces();
- return setBlocks(faces, pattern);
+ return this.setBlocks(faces, pattern);
}
-
+
/**
* Make the faces of the given region. The method by which the faces are found
* may be inefficient, because there may not be an efficient implementation supported
@@ -1197,14 +1196,14 @@ public class EditSession implements Extent {
public int makeFaces(final Region region, final Pattern pattern) throws MaxChangedBlocksException {
checkNotNull(region);
checkNotNull(pattern);
-
+
if (region instanceof CuboidRegion) {
- return makeCuboidFaces(region, pattern);
+ return this.makeCuboidFaces(region, pattern);
} else {
return new RegionShape(region).generate(this, pattern, true);
}
}
-
+
/**
* Make the walls (all faces but those parallel to the X-Z plane) of the given region
* as if it was a {@link CuboidRegion}.
@@ -1216,9 +1215,9 @@ public class EditSession implements Extent {
*/
@SuppressWarnings("deprecation")
public int makeCuboidWalls(final Region region, final BaseBlock block) throws MaxChangedBlocksException {
- return makeCuboidWalls(region, new SingleBlockPattern(block));
+ return this.makeCuboidWalls(region, new SingleBlockPattern(block));
}
-
+
/**
* Make the walls (all faces but those parallel to the X-Z plane) of the given region
* as if it was a {@link CuboidRegion}.
@@ -1232,12 +1231,12 @@ public class EditSession implements Extent {
public int makeCuboidWalls(final Region region, final Pattern pattern) throws MaxChangedBlocksException {
checkNotNull(region);
checkNotNull(pattern);
-
+
final CuboidRegion cuboid = CuboidRegion.makeCuboid(region);
final Region faces = cuboid.getWalls();
- return setBlocks(faces, pattern);
+ return this.setBlocks(faces, pattern);
}
-
+
/**
* Make the walls of the given region. The method by which the walls are found
* may be inefficient, because there may not be an efficient implementation supported
@@ -1252,9 +1251,9 @@ public class EditSession implements Extent {
public int makeWalls(final Region region, final Pattern pattern) throws MaxChangedBlocksException {
checkNotNull(region);
checkNotNull(pattern);
-
+
if (region instanceof CuboidRegion) {
- return makeCuboidWalls(region, pattern);
+ return this.makeCuboidWalls(region, pattern);
} else {
final int minY = region.getMinimumPoint().getBlockY();
final int maxY = region.getMaximumPoint().getBlockY();
@@ -1265,14 +1264,14 @@ public class EditSession implements Extent {
// Put holes into the floor and ceiling by telling ArbitraryShape that the shape goes on outside the region
return defaultMaterial;
}
-
+
return super.getMaterial(x, y, z, defaultMaterial);
}
};
return shape.generate(this, pattern, true);
}
}
-
+
/**
* Places a layer of blocks on top of ground blocks in the given region
* (as if it were a cuboid).
@@ -1285,10 +1284,10 @@ public class EditSession implements Extent {
@SuppressWarnings("deprecation")
public int overlayCuboidBlocks(final Region region, final BaseBlock block) throws MaxChangedBlocksException {
checkNotNull(block);
-
- return overlayCuboidBlocks(region, new SingleBlockPattern(block));
+
+ return this.overlayCuboidBlocks(region, new SingleBlockPattern(block));
}
-
+
/**
* Places a layer of blocks on top of ground blocks in the given region
* (as if it were a cuboid).
@@ -1302,7 +1301,7 @@ public class EditSession implements Extent {
public int overlayCuboidBlocks(final Region region, final Pattern pattern) throws MaxChangedBlocksException {
checkNotNull(region);
checkNotNull(pattern);
-
+
TaskManager.IMP.async(new Runnable() {
@Override
public void run() {
@@ -1318,9 +1317,9 @@ public class EditSession implements Extent {
}, true);
}
});
- return changes = -1;
+ return this.changes = -1;
}
-
+
/**
* Turns the first 3 layers into dirt/grass and the bottom layers
* into rock, like a natural Minecraft mountain.
@@ -1331,9 +1330,9 @@ public class EditSession implements Extent {
*/
public int naturalizeCuboidBlocks(final Region region) throws MaxChangedBlocksException {
checkNotNull(region);
-
+
TaskManager.IMP.async(new Runnable() {
-
+
@Override
public void run() {
final Naturalizer naturalizer = new Naturalizer(EditSession.this);
@@ -1347,9 +1346,9 @@ public class EditSession implements Extent {
}, true);
}
});
- return changes = -1;
+ return this.changes = -1;
}
-
+
/**
* Stack a cuboid region.
*
@@ -1364,7 +1363,7 @@ public class EditSession implements Extent {
checkNotNull(region);
checkNotNull(dir);
checkArgument(count >= 1, "count >= 1 required");
-
+
TaskManager.IMP.async(new Runnable() {
@Override
public void run() {
@@ -1384,9 +1383,9 @@ public class EditSession implements Extent {
}, true);
}
});
- return changes = -1;
+ return this.changes = -1;
}
-
+
/**
* Move the blocks in a region a certain direction.
*
@@ -1402,16 +1401,16 @@ public class EditSession implements Extent {
checkNotNull(region);
checkNotNull(dir);
checkArgument(distance >= 1, "distance >= 1 required");
-
+
TaskManager.IMP.async(new Runnable() {
@Override
public void run() {
final Vector to = region.getMinimumPoint();
-
+
// Remove the original blocks
final com.sk89q.worldedit.function.pattern.Pattern pattern = replacement != null ? new BlockPattern(replacement) : new BlockPattern(new BaseBlock(BlockID.AIR));
final BlockReplace remove = new BlockReplace(EditSession.this, pattern);
-
+
// Copy to a buffer so we don't destroy our original before we can copy all the blocks from it
final ForgetfulExtentBuffer buffer = new ForgetfulExtentBuffer(EditSession.this, new RegionMask(region));
final ForwardExtentCopy copy = new ForwardExtentCopy(EditSession.this, region, buffer, to);
@@ -1421,11 +1420,11 @@ public class EditSession implements Extent {
if (!copyAir) {
copy.setSourceMask(new ExistingBlockMask(EditSession.this));
}
-
+
// Then we need to copy the buffer to the world
final BlockReplace replace = new BlockReplace(EditSession.this, buffer);
final RegionVisitor visitor = new RegionVisitor(buffer.asRegion(), replace);
-
+
final OperationQueue operation = new OperationQueue(copy, visitor);
Operations.completeSmart(operation, new Runnable() {
@Override
@@ -1435,9 +1434,9 @@ public class EditSession implements Extent {
}, true);
}
});
- return changes = -1;
+ return this.changes = -1;
}
-
+
/**
* Move the blocks in a region a certain direction.
*
@@ -1450,9 +1449,9 @@ public class EditSession implements Extent {
* @throws MaxChangedBlocksException thrown if too many blocks are changed
*/
public int moveCuboidRegion(final Region region, final Vector dir, final int distance, final boolean copyAir, final BaseBlock replacement) throws MaxChangedBlocksException {
- return moveRegion(region, dir, distance, copyAir, replacement);
+ return this.moveRegion(region, dir, distance, copyAir, replacement);
}
-
+
/**
* Drain nearby pools of water or lava.
*
@@ -1464,23 +1463,23 @@ public class EditSession implements Extent {
public int drainArea(final Vector origin, final double radius) throws MaxChangedBlocksException {
checkNotNull(origin);
checkArgument(radius >= 0, "radius >= 0 required");
-
+
TaskManager.IMP.async(new Runnable() {
@Override
public void run() {
- final MaskIntersection mask = new MaskIntersection(new BoundedHeightMask(0, getWorld().getMaxY()),
- new RegionMask(new EllipsoidRegion(null, origin, new Vector(radius, radius, radius))), getWorld().createLiquidMask());
-
+ final MaskIntersection mask = new MaskIntersection(new BoundedHeightMask(0, EditSession.this.getWorld().getMaxY()), new RegionMask(new EllipsoidRegion(null, origin, new Vector(radius,
+ radius, radius))), EditSession.this.getWorld().createLiquidMask());
+
final BlockReplace replace = new BlockReplace(EditSession.this, new BlockPattern(new BaseBlock(BlockID.AIR)));
final RecursiveVisitor visitor = new RecursiveVisitor(mask, replace);
-
+
// Around the origin in a 3x3 block
for (final BlockVector position : CuboidRegion.fromCenter(origin, 1)) {
if (mask.test(position)) {
visitor.visit(position);
}
}
-
+
Operations.completeSmart(visitor, new Runnable() {
@Override
public void run() {
@@ -1489,9 +1488,9 @@ public class EditSession implements Extent {
}, true);
}
});
- return changes = -1;
+ return this.changes = -1;
}
-
+
/**
* Fix liquids so that they turn into stationary blocks and extend outward.
*
@@ -1505,31 +1504,31 @@ public class EditSession implements Extent {
public int fixLiquid(final Vector origin, final double radius, final int moving, final int stationary) throws MaxChangedBlocksException {
checkNotNull(origin);
checkArgument(radius >= 0, "radius >= 0 required");
-
+
TaskManager.IMP.async(new Runnable() {
-
+
@Override
public void run() {
// Our origins can only be liquids
final BlockMask liquidMask = new BlockMask(EditSession.this, new BaseBlock(moving, -1), new BaseBlock(stationary, -1));
-
+
// But we will also visit air blocks
final MaskIntersection blockMask = new MaskUnion(liquidMask, new BlockMask(EditSession.this, new BaseBlock(BlockID.AIR)));
-
+
// There are boundaries that the routine needs to stay in
- final MaskIntersection mask = new MaskIntersection(new BoundedHeightMask(0, Math.min(origin.getBlockY(), getWorld().getMaxY())), new RegionMask(new EllipsoidRegion(null, origin,
- new Vector(radius, radius, radius))), blockMask);
-
+ final MaskIntersection mask = new MaskIntersection(new BoundedHeightMask(0, Math.min(origin.getBlockY(), EditSession.this.getWorld().getMaxY())), new RegionMask(new EllipsoidRegion(
+ null, origin, new Vector(radius, radius, radius))), blockMask);
+
final BlockReplace replace = new BlockReplace(EditSession.this, new BlockPattern(new BaseBlock(stationary)));
final NonRisingVisitor visitor = new NonRisingVisitor(mask, replace);
-
+
// Around the origin in a 3x3 block
for (final BlockVector position : CuboidRegion.fromCenter(origin, 1)) {
if (liquidMask.test(position)) {
visitor.visit(position);
}
}
-
+
Operations.completeSmart(visitor, new Runnable() {
@Override
public void run() {
@@ -1538,9 +1537,9 @@ public class EditSession implements Extent {
}, true);
}
});
- return changes = -1;
+ return this.changes = -1;
}
-
+
/**
* Makes a cylinder.
*
@@ -1553,9 +1552,9 @@ public class EditSession implements Extent {
* @throws MaxChangedBlocksException thrown if too many blocks are changed
*/
public int makeCylinder(final Vector pos, final Pattern block, final double radius, final int height, final boolean filled) throws MaxChangedBlocksException {
- return makeCylinder(pos, block, radius, radius, height, filled);
+ return this.makeCylinder(pos, block, radius, radius, height, filled);
}
-
+
/**
* Makes a cylinder.
*
@@ -1570,29 +1569,29 @@ public class EditSession implements Extent {
*/
public int makeCylinder(Vector pos, final Pattern block, double radiusX, double radiusZ, int height, final boolean filled) throws MaxChangedBlocksException {
int affected = 0;
-
+
radiusX += 0.5;
radiusZ += 0.5;
-
+
if (height == 0) {
- return changes = -1;
+ return this.changes = -1;
} else if (height < 0) {
height = -height;
pos = pos.subtract(0, height, 0);
}
-
+
if (pos.getBlockY() < 0) {
pos = pos.setY(0);
- } else if (((pos.getBlockY() + height) - 1) > world.getMaxY()) {
- height = (world.getMaxY() - pos.getBlockY()) + 1;
+ } else if (((pos.getBlockY() + height) - 1) > this.world.getMaxY()) {
+ height = (this.world.getMaxY() - pos.getBlockY()) + 1;
}
-
+
final double invRadiusX = 1 / radiusX;
final double invRadiusZ = 1 / radiusZ;
-
+
final int ceilRadiusX = (int) Math.ceil(radiusX);
final int ceilRadiusZ = (int) Math.ceil(radiusZ);
-
+
double nextXn = 0;
forX: for (int x = 0; x <= ceilRadiusX; ++x) {
final double xn = nextXn;
@@ -1601,41 +1600,41 @@ public class EditSession implements Extent {
forZ: for (int z = 0; z <= ceilRadiusZ; ++z) {
final double zn = nextZn;
nextZn = (z + 1) * invRadiusZ;
-
- final double distanceSq = lengthSq(xn, zn);
+
+ final double distanceSq = this.lengthSq(xn, zn);
if (distanceSq > 1) {
if (z == 0) {
break forX;
}
break forZ;
}
-
+
if (!filled) {
- if ((lengthSq(nextXn, zn) <= 1) && (lengthSq(xn, nextZn) <= 1)) {
+ if ((this.lengthSq(nextXn, zn) <= 1) && (this.lengthSq(xn, nextZn) <= 1)) {
continue;
}
}
-
+
for (int y = 0; y < height; ++y) {
- if (setBlock(pos.add(x, y, z), block)) {
+ if (this.setBlock(pos.add(x, y, z), block)) {
++affected;
}
- if (setBlock(pos.add(-x, y, z), block)) {
+ if (this.setBlock(pos.add(-x, y, z), block)) {
++affected;
}
- if (setBlock(pos.add(x, y, -z), block)) {
+ if (this.setBlock(pos.add(x, y, -z), block)) {
++affected;
}
- if (setBlock(pos.add(-x, y, -z), block)) {
+ if (this.setBlock(pos.add(-x, y, -z), block)) {
++affected;
}
}
}
}
-
+
return affected;
}
-
+
/**
* Makes a sphere.
*
@@ -1647,9 +1646,9 @@ public class EditSession implements Extent {
* @throws MaxChangedBlocksException thrown if too many blocks are changed
*/
public int makeSphere(final Vector pos, final Pattern block, final double radius, final boolean filled) throws MaxChangedBlocksException {
- return makeSphere(pos, block, radius, radius, radius, filled);
+ return this.makeSphere(pos, block, radius, radius, radius, filled);
}
-
+
/**
* Makes a sphere or ellipsoid.
*
@@ -1664,19 +1663,19 @@ public class EditSession implements Extent {
*/
public int makeSphere(final Vector pos, final Pattern block, double radiusX, double radiusY, double radiusZ, final boolean filled) throws MaxChangedBlocksException {
int affected = 0;
-
+
radiusX += 0.5;
radiusY += 0.5;
radiusZ += 0.5;
-
+
final double invRadiusX = 1 / radiusX;
final double invRadiusY = 1 / radiusY;
final double invRadiusZ = 1 / radiusZ;
-
+
final int ceilRadiusX = (int) Math.ceil(radiusX);
final int ceilRadiusY = (int) Math.ceil(radiusY);
final int ceilRadiusZ = (int) Math.ceil(radiusZ);
-
+
double nextXn = 0;
forX: for (int x = 0; x <= ceilRadiusX; ++x) {
final double xn = nextXn;
@@ -1689,8 +1688,8 @@ public class EditSession implements Extent {
forZ: for (int z = 0; z <= ceilRadiusZ; ++z) {
final double zn = nextZn;
nextZn = (z + 1) * invRadiusZ;
-
- final double distanceSq = lengthSq(xn, yn, zn);
+
+ final double distanceSq = this.lengthSq(xn, yn, zn);
if (distanceSq > 1) {
if (z == 0) {
if (y == 0) {
@@ -1700,44 +1699,44 @@ public class EditSession implements Extent {
}
break forZ;
}
-
+
if (!filled) {
- if ((lengthSq(nextXn, yn, zn) <= 1) && (lengthSq(xn, nextYn, zn) <= 1) && (lengthSq(xn, yn, nextZn) <= 1)) {
+ if ((this.lengthSq(nextXn, yn, zn) <= 1) && (this.lengthSq(xn, nextYn, zn) <= 1) && (this.lengthSq(xn, yn, nextZn) <= 1)) {
continue;
}
}
-
- if (setBlock(pos.add(x, y, z), block)) {
+
+ if (this.setBlock(pos.add(x, y, z), block)) {
++affected;
}
- if (setBlock(pos.add(-x, y, z), block)) {
+ if (this.setBlock(pos.add(-x, y, z), block)) {
++affected;
}
- if (setBlock(pos.add(x, -y, z), block)) {
+ if (this.setBlock(pos.add(x, -y, z), block)) {
++affected;
}
- if (setBlock(pos.add(x, y, -z), block)) {
+ if (this.setBlock(pos.add(x, y, -z), block)) {
++affected;
}
- if (setBlock(pos.add(-x, -y, z), block)) {
+ if (this.setBlock(pos.add(-x, -y, z), block)) {
++affected;
}
- if (setBlock(pos.add(x, -y, -z), block)) {
+ if (this.setBlock(pos.add(x, -y, -z), block)) {
++affected;
}
- if (setBlock(pos.add(-x, y, -z), block)) {
+ if (this.setBlock(pos.add(-x, y, -z), block)) {
++affected;
}
- if (setBlock(pos.add(-x, -y, -z), block)) {
+ if (this.setBlock(pos.add(-x, -y, -z), block)) {
++affected;
}
}
}
}
-
+
return affected;
}
-
+
/**
* Makes a pyramid.
*
@@ -1750,36 +1749,36 @@ public class EditSession implements Extent {
*/
public int makePyramid(final Vector position, final Pattern block, int size, final boolean filled) throws MaxChangedBlocksException {
int affected = 0;
-
+
final 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(position.add(x, y, z), block)) {
+
+ if (this.setBlock(position.add(x, y, z), block)) {
++affected;
}
- if (setBlock(position.add(-x, y, z), block)) {
+ if (this.setBlock(position.add(-x, y, z), block)) {
++affected;
}
- if (setBlock(position.add(x, y, -z), block)) {
+ if (this.setBlock(position.add(x, y, -z), block)) {
++affected;
}
- if (setBlock(position.add(-x, y, -z), block)) {
+ if (this.setBlock(position.add(-x, y, -z), block)) {
++affected;
}
}
}
}
}
-
+
return affected;
}
-
+
/**
* Thaw blocks in a radius.
*
@@ -1791,53 +1790,53 @@ public class EditSession implements Extent {
public int thaw(final Vector position, final double radius) throws MaxChangedBlocksException {
int affected = 0;
final double radiusSq = radius * radius;
-
+
final int ox = position.getBlockX();
final int oy = position.getBlockY();
final int oz = position.getBlockZ();
-
+
final BaseBlock air = new BaseBlock(0);
final BaseBlock water = new BaseBlock(BlockID.STATIONARY_WATER);
-
+
final int ceilRadius = (int) Math.ceil(radius);
for (int x = ox - ceilRadius; x <= (ox + ceilRadius); ++x) {
for (int z = oz - ceilRadius; z <= (oz + ceilRadius); ++z) {
if ((new Vector(x, oy, z)).distanceSq(position) > radiusSq) {
continue;
}
-
- for (int y = world.getMaxY(); y >= 1; --y) {
+
+ for (int y = this.world.getMaxY(); y >= 1; --y) {
final Vector pt = new Vector(x, y, z);
- final int id = getBlockType(pt);
-
+ final int id = this.getBlockType(pt);
+
switch (id) {
case BlockID.ICE:
- if (setBlock(pt, water)) {
+ if (this.setBlock(pt, water)) {
++affected;
}
break;
-
+
case BlockID.SNOW:
- if (setBlock(pt, air)) {
+ if (this.setBlock(pt, air)) {
++affected;
}
break;
-
+
case BlockID.AIR:
continue;
-
+
default:
break;
}
-
+
break;
}
}
}
-
+
return affected;
}
-
+
/**
* Make snow in a radius.
*
@@ -1849,59 +1848,59 @@ public class EditSession implements Extent {
public int simulateSnow(final Vector position, final double radius) throws MaxChangedBlocksException {
int affected = 0;
final double radiusSq = radius * radius;
-
+
final int ox = position.getBlockX();
final int oy = position.getBlockY();
final int oz = position.getBlockZ();
-
+
final BaseBlock ice = new BaseBlock(BlockID.ICE);
final BaseBlock snow = new BaseBlock(BlockID.SNOW);
-
+
final int ceilRadius = (int) Math.ceil(radius);
for (int x = ox - ceilRadius; x <= (ox + ceilRadius); ++x) {
for (int z = oz - ceilRadius; z <= (oz + ceilRadius); ++z) {
if ((new Vector(x, oy, z)).distanceSq(position) > radiusSq) {
continue;
}
-
- for (int y = world.getMaxY(); y >= 1; --y) {
+
+ for (int y = this.world.getMaxY(); y >= 1; --y) {
final Vector pt = new Vector(x, y, z);
- final int id = getBlockType(pt);
-
+ final int id = this.getBlockType(pt);
+
if (id == BlockID.AIR) {
continue;
}
-
+
// Ice!
if ((id == BlockID.WATER) || (id == BlockID.STATIONARY_WATER)) {
- if (setBlock(pt, ice)) {
+ if (this.setBlock(pt, ice)) {
++affected;
}
break;
}
-
+
// Snow should not cover these blocks
if (BlockType.isTranslucent(id)) {
break;
}
-
+
// Too high?
- if (y == world.getMaxY()) {
+ if (y == this.world.getMaxY()) {
break;
}
-
+
// add snow cover
- if (setBlock(pt.add(0, 1, 0), snow)) {
+ if (this.setBlock(pt.add(0, 1, 0), snow)) {
++affected;
}
break;
}
}
}
-
+
return affected;
}
-
+
/**
* Make dirt green.
*
@@ -1913,9 +1912,9 @@ public class EditSession implements Extent {
*/
@Deprecated
public int green(final Vector position, final double radius) throws MaxChangedBlocksException {
- return green(position, radius, true);
+ return this.green(position, radius, true);
}
-
+
/**
* Make dirt green.
*
@@ -1928,43 +1927,43 @@ public class EditSession implements Extent {
public int green(final Vector position, final double radius, final boolean onlyNormalDirt) throws MaxChangedBlocksException {
int affected = 0;
final double radiusSq = radius * radius;
-
+
final int ox = position.getBlockX();
final int oy = position.getBlockY();
final int oz = position.getBlockZ();
-
+
final BaseBlock grass = new BaseBlock(BlockID.GRASS);
-
+
final int ceilRadius = (int) Math.ceil(radius);
for (int x = ox - ceilRadius; x <= (ox + ceilRadius); ++x) {
for (int z = oz - ceilRadius; z <= (oz + ceilRadius); ++z) {
if ((new Vector(x, oy, z)).distanceSq(position) > radiusSq) {
continue;
}
-
- loop: for (int y = world.getMaxY(); y >= 1; --y) {
+
+ loop: for (int y = this.world.getMaxY(); y >= 1; --y) {
final Vector pt = new Vector(x, y, z);
- final int id = getBlockType(pt);
- final int data = getBlockData(pt);
-
+ final int id = this.getBlockType(pt);
+ final int data = this.getBlockData(pt);
+
switch (id) {
case BlockID.DIRT:
if (onlyNormalDirt && (data != 0)) {
break loop;
}
-
- if (setBlock(pt, grass)) {
+
+ if (this.setBlock(pt, grass)) {
++affected;
}
break loop;
-
+
case BlockID.WATER:
case BlockID.STATIONARY_WATER:
case BlockID.LAVA:
case BlockID.STATIONARY_LAVA:
// break on liquids...
break loop;
-
+
default:
// ...and all non-passable blocks
if (!BlockType.canPassThrough(id, data)) {
@@ -1974,10 +1973,10 @@ public class EditSession implements Extent {
}
}
}
-
+
return affected;
}
-
+
/**
* Makes pumpkin patches randomly in an area around the given position.
*
@@ -1987,19 +1986,19 @@ public class EditSession implements Extent {
* @throws MaxChangedBlocksException thrown if too many blocks are changed
*/
public int makePumpkinPatches(final Vector position, final int apothem) throws MaxChangedBlocksException {
-
+
TaskManager.IMP.async(new Runnable() {
@Override
public void run() {
// We want to generate pumpkins
final GardenPatchGenerator generator = new GardenPatchGenerator(EditSession.this);
generator.setPlant(GardenPatchGenerator.getPumpkinPattern());
-
+
// In a region of the given radius
- final FlatRegion region = new CuboidRegion(getWorld(), // Causes clamping of Y range
+ final FlatRegion region = new CuboidRegion(EditSession.this.getWorld(), // Causes clamping of Y range
position.add(-apothem, -5, -apothem), position.add(apothem, 10, apothem));
final double density = 0.02;
-
+
final GroundFunction ground = new GroundFunction(new ExistingBlockMask(EditSession.this), generator);
final LayerVisitor visitor = new LayerVisitor(region, minimumBlockY(region), maximumBlockY(region), ground);
visitor.setMask(new NoiseFilter2D(new RandomNoise(), density));
@@ -2011,9 +2010,9 @@ public class EditSession implements Extent {
}, true);
}
});
- return changes = -1;
+ return this.changes = -1;
}
-
+
/**
* Makes a forest.
*
@@ -2028,31 +2027,31 @@ public class EditSession implements Extent {
for (int x = basePosition.getBlockX() - size; x <= (basePosition.getBlockX() + size); ++x) {
for (int z = basePosition.getBlockZ() - size; z <= (basePosition.getBlockZ() + size); ++z) {
// Don't want to be in the ground
- if (!getBlock(new Vector(x, basePosition.getBlockY(), z)).isAir()) {
+ if (!this.getBlock(new Vector(x, basePosition.getBlockY(), z)).isAir()) {
continue;
}
// The gods don't want a tree here
if (FaweCache.RANDOM.random(65536) >= (density * 65536)) {
continue;
} // def 0.05
-
+
for (int y = basePosition.getBlockY(); y >= (basePosition.getBlockY() - 10); --y) {
// Check if we hit the ground
- final int t = getBlock(new Vector(x, y, z)).getType();
+ final int t = this.getBlock(new Vector(x, y, z)).getType();
if ((t == BlockID.GRASS) || (t == BlockID.DIRT)) {
treeGenerator.generate(this, new Vector(x, y + 1, z));
break;
} else if (t == BlockID.SNOW) {
- setBlock(new Vector(x, y, z), new BaseBlock(BlockID.AIR));
+ this.setBlock(new Vector(x, y, z), new BaseBlock(BlockID.AIR));
} else if (t != BlockID.AIR) { // Trees won't grow on this!
break;
}
}
}
}
- return changes = -1;
+ return this.changes = -1;
}
-
+
/**
* Get the block distribution inside a region.
*
@@ -2062,26 +2061,26 @@ public class EditSession implements Extent {
public List> getBlockDistribution(final Region region) {
final List> distribution = new ArrayList>();
final Map> map = new HashMap>();
-
+
if (region instanceof CuboidRegion) {
// Doing this for speed
final Vector min = region.getMinimumPoint();
final Vector max = region.getMaximumPoint();
-
+
final int minX = min.getBlockX();
final int minY = min.getBlockY();
final int minZ = min.getBlockZ();
final int maxX = max.getBlockX();
final int maxY = max.getBlockY();
final int maxZ = max.getBlockZ();
-
+
for (int x = minX; x <= maxX; ++x) {
for (int y = minY; y <= maxY; ++y) {
for (int z = minZ; z <= maxZ; ++z) {
final Vector pt = new Vector(x, y, z);
-
- final int id = getBlockType(pt);
-
+
+ final int id = this.getBlockType(pt);
+
if (map.containsKey(id)) {
map.get(id).increment();
} else {
@@ -2094,8 +2093,8 @@ public class EditSession implements Extent {
}
} else {
for (final Vector pt : region) {
- final int id = getBlockType(pt);
-
+ final int id = this.getBlockType(pt);
+
if (map.containsKey(id)) {
map.get(id).increment();
} else {
@@ -2104,13 +2103,13 @@ public class EditSession implements Extent {
}
}
}
-
+
Collections.sort(distribution);
// Collections.reverse(distribution);
-
+
return distribution;
}
-
+
/**
* Get the block distribution (with data values) inside a region.
*
@@ -2120,26 +2119,26 @@ public class EditSession implements Extent {
public List> getBlockDistributionWithData(final Region region) {
final List> distribution = new ArrayList>();
final Map> map = new HashMap>();
-
+
if (region instanceof CuboidRegion) {
// Doing this for speed
final Vector min = region.getMinimumPoint();
final Vector max = region.getMaximumPoint();
-
+
final int minX = min.getBlockX();
final int minY = min.getBlockY();
final int minZ = min.getBlockZ();
final int maxX = max.getBlockX();
final int maxY = max.getBlockY();
final int maxZ = max.getBlockZ();
-
+
for (int x = minX; x <= maxX; ++x) {
for (int y = minY; y <= maxY; ++y) {
for (int z = minZ; z <= maxZ; ++z) {
final Vector pt = new Vector(x, y, z);
-
- final BaseBlock blk = new BaseBlock(getBlockType(pt), getBlockData(pt));
-
+
+ final BaseBlock blk = new BaseBlock(this.getBlockType(pt), this.getBlockData(pt));
+
if (map.containsKey(blk)) {
map.get(blk).increment();
} else {
@@ -2152,8 +2151,8 @@ public class EditSession implements Extent {
}
} else {
for (final Vector pt : region) {
- final BaseBlock blk = new BaseBlock(getBlockType(pt), getBlockData(pt));
-
+ final BaseBlock blk = new BaseBlock(this.getBlockType(pt), this.getBlockData(pt));
+
if (map.containsKey(blk)) {
map.get(blk).increment();
} else {
@@ -2162,90 +2161,90 @@ public class EditSession implements Extent {
}
}
}
-
+
Collections.sort(distribution);
// Collections.reverse(distribution);
-
+
return distribution;
}
-
+
public int makeShape(final Region region, final Vector zero, final Vector unit, final Pattern pattern, final String expressionString, final boolean hollow) throws ExpressionException,
MaxChangedBlocksException {
final Expression expression = Expression.compile(expressionString, "x", "y", "z", "type", "data");
expression.optimize();
-
+
final RValue typeVariable = expression.getVariable("type", false);
final RValue dataVariable = expression.getVariable("data", false);
-
+
final WorldEditExpressionEnvironment environment = new WorldEditExpressionEnvironment(this, unit, zero);
expression.setEnvironment(environment);
-
+
final ArbitraryShape shape = new ArbitraryShape(region) {
@Override
protected BaseBlock getMaterial(final int x, final int y, final int z, final BaseBlock defaultMaterial) {
final Vector current = new Vector(x, y, z);
environment.setCurrentBlock(current);
final Vector scaled = current.subtract(zero).divide(unit);
-
+
try {
if (expression.evaluate(scaled.getX(), scaled.getY(), scaled.getZ(), defaultMaterial.getType(), defaultMaterial.getData()) <= 0) {
return null;
}
-
+
return new BaseBlock((int) typeVariable.getValue(), (int) dataVariable.getValue());
} catch (final Exception e) {
- log.log(Level.WARNING, "Failed to create shape", e);
+ EditSession.this.log.log(Level.WARNING, "Failed to create shape", e);
return null;
}
}
};
-
+
return shape.generate(this, pattern, hollow);
}
-
+
public int deformRegion(final Region region, final Vector zero, final Vector unit, final String expressionString) throws ExpressionException, MaxChangedBlocksException {
final Expression expression = Expression.compile(expressionString, "x", "y", "z");
expression.optimize();
-
+
final RValue x = expression.getVariable("x", false);
final RValue y = expression.getVariable("y", false);
final RValue z = expression.getVariable("z", false);
-
+
final WorldEditExpressionEnvironment environment = new WorldEditExpressionEnvironment(this, unit, zero);
expression.setEnvironment(environment);
-
+
final DoubleArrayList queue = new DoubleArrayList(false);
-
+
for (final BlockVector position : region) {
// offset, scale
final Vector scaled = position.subtract(zero).divide(unit);
-
+
// transform
expression.evaluate(scaled.getX(), scaled.getY(), scaled.getZ());
-
+
final BlockVector sourcePosition = environment.toWorld(x.getValue(), y.getValue(), z.getValue());
-
+
// read block from world
- final BaseBlock material = new BaseBlock(world.getBlockType(sourcePosition), world.getBlockData(sourcePosition));
-
+ final BaseBlock material = new BaseBlock(this.world.getBlockType(sourcePosition), this.world.getBlockData(sourcePosition));
+
// queue operation
queue.put(position, material);
}
-
+
int affected = 0;
for (final Map.Entry entry : queue) {
final BlockVector position = entry.getKey();
final BaseBlock material = entry.getValue();
-
+
// set at new position
- if (setBlock(position, material)) {
+ if (this.setBlock(position, material)) {
++affected;
}
}
-
+
return affected;
}
-
+
/**
* Hollows out the region (Semi-well-defined for non-cuboid selections).
*
@@ -2258,73 +2257,73 @@ public class EditSession implements Extent {
*/
public int hollowOutRegion(final Region region, final int thickness, final Pattern pattern) throws MaxChangedBlocksException {
int affected = 0;
-
+
final Set outside = new HashSet();
-
+
final Vector min = region.getMinimumPoint();
final Vector max = region.getMaximumPoint();
-
+
final int minX = min.getBlockX();
final int minY = min.getBlockY();
final int minZ = min.getBlockZ();
final int maxX = max.getBlockX();
final int maxY = max.getBlockY();
final int maxZ = max.getBlockZ();
-
+
for (int x = minX; x <= maxX; ++x) {
for (int y = minY; y <= maxY; ++y) {
- recurseHollow(region, new BlockVector(x, y, minZ), outside);
- recurseHollow(region, new BlockVector(x, y, maxZ), outside);
+ this.recurseHollow(region, new BlockVector(x, y, minZ), outside);
+ this.recurseHollow(region, new BlockVector(x, y, maxZ), outside);
}
}
-
+
for (int y = minY; y <= maxY; ++y) {
for (int z = minZ; z <= maxZ; ++z) {
- recurseHollow(region, new BlockVector(minX, y, z), outside);
- recurseHollow(region, new BlockVector(maxX, y, z), outside);
+ this.recurseHollow(region, new BlockVector(minX, y, z), outside);
+ this.recurseHollow(region, new BlockVector(maxX, y, z), outside);
}
}
-
+
for (int z = minZ; z <= maxZ; ++z) {
for (int x = minX; x <= maxX; ++x) {
- recurseHollow(region, new BlockVector(x, minY, z), outside);
- recurseHollow(region, new BlockVector(x, maxY, z), outside);
+ this.recurseHollow(region, new BlockVector(x, minY, z), outside);
+ this.recurseHollow(region, new BlockVector(x, maxY, z), outside);
}
}
-
+
for (int i = 1; i < thickness; ++i) {
final Set newOutside = new HashSet();
outer: for (final BlockVector position : region) {
- for (final Vector recurseDirection : recurseDirections) {
+ for (final Vector recurseDirection : this.recurseDirections) {
final BlockVector neighbor = position.add(recurseDirection).toBlockVector();
-
+
if (outside.contains(neighbor)) {
newOutside.add(position);
continue outer;
}
}
}
-
+
outside.addAll(newOutside);
}
-
+
outer: for (final BlockVector position : region) {
- for (final Vector recurseDirection : recurseDirections) {
+ for (final Vector recurseDirection : this.recurseDirections) {
final BlockVector neighbor = position.add(recurseDirection).toBlockVector();
-
+
if (outside.contains(neighbor)) {
continue outer;
}
}
-
- if (setBlock(position, pattern.next(position))) {
+
+ if (this.setBlock(position, pattern.next(position))) {
++affected;
}
}
-
+
return affected;
}
-
+
/**
* Draws a line (out of blocks) between two vectors.
*
@@ -2338,60 +2337,60 @@ public class EditSession implements Extent {
* @throws MaxChangedBlocksException thrown if too many blocks are changed
*/
public int drawLine(final Pattern pattern, final Vector pos1, final Vector pos2, final double radius, final boolean filled) throws MaxChangedBlocksException {
-
+
Set vset = new HashSet();
boolean notdrawn = true;
-
+
final int x1 = pos1.getBlockX(), y1 = pos1.getBlockY(), z1 = pos1.getBlockZ();
final int x2 = pos2.getBlockX(), y2 = pos2.getBlockY(), z2 = pos2.getBlockZ();
int tipx = x1, tipy = y1, tipz = z1;
final int dx = Math.abs(x2 - x1), dy = Math.abs(y2 - y1), dz = Math.abs(z2 - z1);
-
+
if ((dx + dy + dz) == 0) {
vset.add(new Vector(tipx, tipy, tipz));
notdrawn = false;
}
-
+
if ((Math.max(Math.max(dx, dy), dz) == dx) && notdrawn) {
for (int domstep = 0; domstep <= dx; domstep++) {
tipx = x1 + (domstep * ((x2 - x1) > 0 ? 1 : -1));
tipy = (int) Math.round(y1 + (((domstep * ((double) dy)) / (dx)) * ((y2 - y1) > 0 ? 1 : -1)));
tipz = (int) Math.round(z1 + (((domstep * ((double) dz)) / (dx)) * ((z2 - z1) > 0 ? 1 : -1)));
-
+
vset.add(new Vector(tipx, tipy, tipz));
}
notdrawn = false;
}
-
+
if ((Math.max(Math.max(dx, dy), dz) == dy) && notdrawn) {
for (int domstep = 0; domstep <= dy; domstep++) {
tipy = y1 + (domstep * ((y2 - y1) > 0 ? 1 : -1));
tipx = (int) Math.round(x1 + (((domstep * ((double) dx)) / (dy)) * ((x2 - x1) > 0 ? 1 : -1)));
tipz = (int) Math.round(z1 + (((domstep * ((double) dz)) / (dy)) * ((z2 - z1) > 0 ? 1 : -1)));
-
+
vset.add(new Vector(tipx, tipy, tipz));
}
notdrawn = false;
}
-
+
if ((Math.max(Math.max(dx, dy), dz) == dz) && notdrawn) {
for (int domstep = 0; domstep <= dz; domstep++) {
tipz = z1 + (domstep * ((z2 - z1) > 0 ? 1 : -1));
tipy = (int) Math.round(y1 + (((domstep * ((double) dy)) / (dz)) * ((y2 - y1) > 0 ? 1 : -1)));
tipx = (int) Math.round(x1 + (((domstep * ((double) dx)) / (dz)) * ((x2 - x1) > 0 ? 1 : -1)));
-
+
vset.add(new Vector(tipx, tipy, tipz));
}
notdrawn = false;
}
-
- vset = getBallooned(vset, radius);
+
+ vset = this.getBallooned(vset, radius);
if (!filled) {
- vset = getHollowed(vset);
+ vset = this.getHollowed(vset);
}
- return setBlocks(vset, pattern);
+ return this.setBlocks(vset, pattern);
}
-
+
/**
* Draws a spline (out of blocks) between specified vectors.
*
@@ -2409,12 +2408,12 @@ public class EditSession implements Extent {
*/
public int drawSpline(final Pattern pattern, final List nodevectors, final double tension, final double bias, final double continuity, final double quality, final double radius,
final boolean filled) throws MaxChangedBlocksException {
-
+
Set vset = new HashSet();
final List nodes = new ArrayList(nodevectors.size());
-
+
final Interpolation interpol = new KochanekBartelsInterpolation();
-
+
for (final Vector nodevector : nodevectors) {
final Node n = new Node(nodevector);
n.setTension(tension);
@@ -2422,7 +2421,7 @@ public class EditSession implements Extent {
n.setContinuity(continuity);
nodes.add(n);
}
-
+
interpol.setNodes(nodes);
final double splinelength = interpol.arcLength(0, 1);
for (double loop = 0; loop <= 1; loop += 1D / splinelength / quality) {
@@ -2430,17 +2429,17 @@ public class EditSession implements Extent {
final int tipx = (int) Math.round(tipv.getX());
final int tipy = (int) Math.round(tipv.getY());
final int tipz = (int) Math.round(tipv.getZ());
-
+
vset.add(new Vector(tipx, tipy, tipz));
}
-
- vset = getBallooned(vset, radius);
+
+ vset = this.getBallooned(vset, radius);
if (!filled) {
- vset = getHollowed(vset);
+ vset = this.getHollowed(vset);
}
- return setBlocks(vset, pattern);
+ return this.setBlocks(vset, pattern);
}
-
+
private double hypot(final double... pars) {
double sum = 0;
for (final double d : pars) {
@@ -2448,18 +2447,18 @@ public class EditSession implements Extent {
}
return Math.sqrt(sum);
}
-
+
private Set getBallooned(final Set vset, final double radius) {
final Set returnset = new HashSet();
final int ceilrad = (int) Math.ceil(radius);
-
+
for (final Vector v : vset) {
final int tipx = v.getBlockX(), tipy = v.getBlockY(), tipz = v.getBlockZ();
-
+
for (int loopx = tipx - ceilrad; loopx <= (tipx + ceilrad); loopx++) {
for (int loopy = tipy - ceilrad; loopy <= (tipy + ceilrad); loopy++) {
for (int loopz = tipz - ceilrad; loopz <= (tipz + ceilrad); loopz++) {
- if (hypot(loopx - tipx, loopy - tipy, loopz - tipz) <= radius) {
+ if (this.hypot(loopx - tipx, loopy - tipy, loopz - tipz) <= radius) {
returnset.add(new Vector(loopx, loopy, loopz));
}
}
@@ -2468,7 +2467,7 @@ public class EditSession implements Extent {
}
return returnset;
}
-
+
private Set getHollowed(final Set vset) {
final Set returnset = new HashSet();
for (final Vector v : vset) {
@@ -2483,66 +2482,66 @@ public class EditSession implements Extent {
}
return returnset;
}
-
+
private void recurseHollow(final Region region, final BlockVector origin, final Set outside) {
final LinkedList queue = new LinkedList();
queue.addLast(origin);
-
+
while (!queue.isEmpty()) {
final BlockVector current = queue.removeFirst();
- if (!BlockType.canPassThrough(getBlockType(current), getBlockData(current))) {
+ if (!BlockType.canPassThrough(this.getBlockType(current), this.getBlockData(current))) {
continue;
}
-
+
if (!outside.add(current)) {
continue;
}
-
+
if (!region.contains(current)) {
continue;
}
-
- for (final Vector recurseDirection : recurseDirections) {
+
+ for (final Vector recurseDirection : this.recurseDirections) {
queue.addLast(current.add(recurseDirection).toBlockVector());
}
} // while
}
-
+
public int makeBiomeShape(final Region region, final Vector zero, final Vector unit, final BaseBiome biomeType, final String expressionString, final boolean hollow) throws ExpressionException,
MaxChangedBlocksException {
final Vector2D zero2D = zero.toVector2D();
final Vector2D unit2D = unit.toVector2D();
-
+
final Expression expression = Expression.compile(expressionString, "x", "z");
expression.optimize();
-
+
final EditSession editSession = this;
final WorldEditExpressionEnvironment environment = new WorldEditExpressionEnvironment(editSession, unit, zero);
expression.setEnvironment(environment);
-
+
final ArbitraryBiomeShape shape = new ArbitraryBiomeShape(region) {
@Override
protected BaseBiome getBiome(final int x, final int z, final BaseBiome defaultBiomeType) {
final Vector2D current = new Vector2D(x, z);
environment.setCurrentBlock(current.toVector(0));
final Vector2D scaled = current.subtract(zero2D).divide(unit2D);
-
+
try {
if (expression.evaluate(scaled.getX(), scaled.getZ()) <= 0) {
return null;
}
-
+
return defaultBiomeType;
} catch (final Exception e) {
- log.log(Level.WARNING, "Failed to create shape", e);
+ EditSession.this.log.log(Level.WARNING, "Failed to create shape", e);
return null;
}
}
};
-
+
return shape.generate(this, biomeType, hollow);
}
-
+
private final Vector[] recurseDirections = {
PlayerDirection.NORTH.vector(),
PlayerDirection.EAST.vector(),
@@ -2550,15 +2549,15 @@ public class EditSession implements Extent {
PlayerDirection.WEST.vector(),
PlayerDirection.UP.vector(),
PlayerDirection.DOWN.vector(), };
-
+
private double lengthSq(final double x, final double y, final double z) {
return (x * x) + (y * y) + (z * z);
}
-
+
private double lengthSq(final double x, final double z) {
return (x * x) + (z * z);
}
-
+
public static Class> inject() {
return EditSession.class;
}
diff --git a/src/main/java/com/sk89q/worldedit/command/DispatcherWrapper.java b/src/main/java/com/sk89q/worldedit/command/DispatcherWrapper.java
index 403ad2eb..daac9f18 100644
--- a/src/main/java/com/sk89q/worldedit/command/DispatcherWrapper.java
+++ b/src/main/java/com/sk89q/worldedit/command/DispatcherWrapper.java
@@ -18,96 +18,94 @@ import com.sk89q.worldedit.util.command.Dispatcher;
public class DispatcherWrapper implements Dispatcher {
private final Dispatcher parent;
-
+
public final Dispatcher getParent() {
- return parent;
+ return this.parent;
}
-
- public DispatcherWrapper(Dispatcher parent) {
+
+ public DispatcherWrapper(final Dispatcher parent) {
this.parent = parent;
}
-
+
@Override
- public void registerCommand(CommandCallable callable, String... alias) {
- parent.registerCommand(callable, alias);
+ public void registerCommand(final CommandCallable callable, final String... alias) {
+ this.parent.registerCommand(callable, alias);
}
-
+
@Override
public Set getCommands() {
- return parent.getCommands();
+ return this.parent.getCommands();
}
-
+
@Override
public Collection getPrimaryAliases() {
- return parent.getPrimaryAliases();
+ return this.parent.getPrimaryAliases();
}
-
+
@Override
public Collection getAliases() {
- return parent.getAliases();
+ return this.parent.getAliases();
}
-
+
@Override
- public CommandMapping get(String alias) {
- return parent.get(alias);
+ public CommandMapping get(final String alias) {
+ return this.parent.get(alias);
}
-
+
@Override
- public boolean contains(String alias) {
- return parent.contains(alias);
+ public boolean contains(final String alias) {
+ return this.parent.contains(alias);
}
-
-
-
+
@Override
public Object call(final String arguments, final CommandLocals locals, final String[] parentCommands) throws CommandException {
TaskManager.IMP.async(new Runnable() {
@Override
public void run() {
try {
- parent.call(arguments, locals, parentCommands);
- } catch (CommandException e) {
+ DispatcherWrapper.this.parent.call(arguments, locals, parentCommands);
+ } catch (final CommandException e) {
e.printStackTrace();
}
}
});
return true;
}
-
+
@Override
public Description getDescription() {
- return parent.getDescription();
- }
-
- @Override
- public boolean testPermission(CommandLocals locals) {
- return parent.testPermission(locals);
+ return this.parent.getDescription();
}
@Override
- public List getSuggestions(String arguments, CommandLocals locals) throws CommandException {
- return parent.getSuggestions(arguments, locals);
+ public boolean testPermission(final CommandLocals locals) {
+ return this.parent.testPermission(locals);
}
-
+
+ @Override
+ public List getSuggestions(final String arguments, final CommandLocals locals) throws CommandException {
+ return this.parent.getSuggestions(arguments, locals);
+ }
+
public static void inject() {
// Delayed injection
TaskManager.IMP.task(new Runnable() {
@Override
public void run() {
try {
- PlatformManager platform = WorldEdit.getInstance().getPlatformManager();
- CommandManager command = platform.getCommandManager();
- Class extends CommandManager> clazz = command.getClass();
- Field field = clazz.getDeclaredField("dispatcher");
+ final PlatformManager platform = WorldEdit.getInstance().getPlatformManager();
+ final CommandManager command = platform.getCommandManager();
+ final Class extends CommandManager> clazz = command.getClass();
+ final Field field = clazz.getDeclaredField("dispatcher");
field.setAccessible(true);
- Dispatcher parent = (Dispatcher) field.get(command);
- DispatcherWrapper dispatcher = new DispatcherWrapper(parent);
+ final Dispatcher parent = (Dispatcher) field.get(command);
+ final DispatcherWrapper dispatcher = new DispatcherWrapper(parent);
field.set(command, dispatcher);
- } catch (Throwable e) {
+ } catch (final Throwable e) {
e.printStackTrace();
}
}
});
}
-
-}
\ No newline at end of file
+
+}
diff --git a/src/main/java/com/sk89q/worldedit/command/FlattenedClipboardTransform.java b/src/main/java/com/sk89q/worldedit/command/FlattenedClipboardTransform.java
index 79895cd4..bb534b61 100644
--- a/src/main/java/com/sk89q/worldedit/command/FlattenedClipboardTransform.java
+++ b/src/main/java/com/sk89q/worldedit/command/FlattenedClipboardTransform.java
@@ -43,11 +43,11 @@ import com.sk89q.worldedit.world.registry.WorldData;
* @see Transform
*/
public class FlattenedClipboardTransform {
-
+
private final Clipboard original;
private final Transform transform;
private final WorldData worldData;
-
+
/**
* Create a new instance.
*
@@ -63,19 +63,20 @@ public class FlattenedClipboardTransform {
this.transform = transform;
this.worldData = worldData;
}
-
+
/**
* Get the transformed region.
*
* @return the transformed region
*/
public Region getTransformedRegion() {
- final Region region = original.getRegion();
+ final Region region = this.original.getRegion();
final Vector minimum = region.getMinimumPoint();
final Vector maximum = region.getMaximumPoint();
-
- final Transform transformAround = new CombinedTransform(new AffineTransform().translate(original.getOrigin().multiply(-1)), transform, new AffineTransform().translate(original.getOrigin()));
-
+
+ final Transform transformAround = new CombinedTransform(new AffineTransform().translate(this.original.getOrigin().multiply(-1)), this.transform, new AffineTransform().translate(this.original
+ .getOrigin()));
+
final Vector[] corners = new Vector[] {
minimum,
maximum,
@@ -85,32 +86,32 @@ public class FlattenedClipboardTransform {
maximum.setX(minimum.getX()),
maximum.setY(minimum.getY()),
maximum.setZ(minimum.getZ()) };
-
+
for (int i = 0; i < corners.length; i++) {
corners[i] = transformAround.apply(corners[i]);
}
-
+
Vector newMinimum = corners[0];
Vector newMaximum = corners[0];
-
+
for (int i = 1; i < corners.length; i++) {
newMinimum = Vector.getMinimum(newMinimum, corners[i]);
newMaximum = Vector.getMaximum(newMaximum, corners[i]);
}
-
+
// After transformation, the points may not really sit on a block,
// so we should expand the region for edge cases
newMinimum = newMinimum.setX(Math.floor(newMinimum.getX()));
newMinimum = newMinimum.setY(Math.floor(newMinimum.getY()));
newMinimum = newMinimum.setZ(Math.floor(newMinimum.getZ()));
-
+
newMaximum = newMaximum.setX(Math.ceil(newMaximum.getX()));
newMaximum = newMaximum.setY(Math.ceil(newMaximum.getY()));
newMaximum = newMaximum.setZ(Math.ceil(newMaximum.getZ()));
-
+
return new CuboidRegion(newMinimum, newMaximum);
}
-
+
/**
* Create an operation to copy from the original clipboard to the given extent.
*
@@ -118,12 +119,12 @@ public class FlattenedClipboardTransform {
* @return the operation
*/
public Operation copyTo(final Extent target) {
- final BlockTransformExtent extent = new BlockTransformExtent(original, transform, worldData.getBlockRegistry());
- final ForwardExtentCopy copy = new ForwardExtentCopy(extent, original.getRegion(), original.getOrigin(), target, original.getOrigin());
- copy.setTransform(transform);
+ final BlockTransformExtent extent = new BlockTransformExtent(this.original, this.transform, this.worldData.getBlockRegistry());
+ final ForwardExtentCopy copy = new ForwardExtentCopy(extent, this.original.getRegion(), this.original.getOrigin(), target, this.original.getOrigin());
+ copy.setTransform(this.transform);
return copy;
}
-
+
/**
* Create a new instance to bake the transform with.
*
@@ -135,5 +136,5 @@ public class FlattenedClipboardTransform {
public static FlattenedClipboardTransform transform(final Clipboard original, final Transform transform, final WorldData worldData) {
return new FlattenedClipboardTransform(original, transform, worldData);
}
-
+
}
diff --git a/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java b/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java
index 08d43100..1f750c70 100644
--- a/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java
+++ b/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java
@@ -64,10 +64,10 @@ import com.sk89q.worldedit.world.registry.WorldData;
* Commands that work with schematic files.
*/
public class SchematicCommands {
-
+
private static final Logger log = Logger.getLogger(SchematicCommands.class.getCanonicalName());
private final WorldEdit worldEdit;
-
+
/**
* Create a new instance.
*
@@ -77,27 +77,27 @@ public class SchematicCommands {
checkNotNull(worldEdit);
this.worldEdit = worldEdit;
}
-
+
@Command(aliases = { "load" }, usage = "[] ", desc = "Load a schematic into your clipboard")
@Deprecated
@CommandPermissions({ "worldedit.clipboard.load", "worldedit.schematic.load" })
public void load(final Player player, final LocalSession session, @Optional("schematic") final String formatName, final String filename) throws FilenameException {
- final LocalConfiguration config = worldEdit.getConfiguration();
-
- final File dir = worldEdit.getWorkingDirectoryFile(config.saveDir);
- final File f = worldEdit.getSafeOpenFile(player, dir, filename, "schematic", "schematic");
-
+ final LocalConfiguration config = this.worldEdit.getConfiguration();
+
+ final File dir = this.worldEdit.getWorkingDirectoryFile(config.saveDir);
+ final File f = this.worldEdit.getSafeOpenFile(player, dir, filename, "schematic", "schematic");
+
if (!f.exists()) {
player.printError("Schematic " + filename + " does not exist!");
return;
}
-
+
final ClipboardFormat format = ClipboardFormat.findByAlias(formatName);
if (format == null) {
player.printError("Unknown schematic format: " + formatName);
return;
}
-
+
SetQueue.IMP.addTask(new Runnable() {
@Override
public void run() {
@@ -108,18 +108,18 @@ public class SchematicCommands {
try {
final String filePath = f.getCanonicalPath();
final String dirPath = dir.getCanonicalPath();
-
+
if (!filePath.substring(0, dirPath.length()).equals(dirPath)) {
player.printError("Clipboard file could not read or it does not exist.");
} else {
final FileInputStream fis = closer.register(new FileInputStream(f));
final BufferedInputStream bis = closer.register(new BufferedInputStream(fis));
final ClipboardReader reader = format.getReader(bis);
-
+
final WorldData worldData = player.getWorld().getWorldData();
final Clipboard clipboard = reader.read(player.getWorld().getWorldData());
session.setClipboard(new ClipboardHolder(clipboard, worldData));
-
+
log.info(player.getName() + " loaded " + filePath);
player.print(filename + " loaded. Paste it with //paste");
}
@@ -136,27 +136,27 @@ public class SchematicCommands {
}
});
}
-
+
@Command(aliases = { "save" }, usage = "[] ", desc = "Save a schematic into your clipboard")
@Deprecated
@CommandPermissions({ "worldedit.clipboard.save", "worldedit.schematic.save" })
public void save(final Player player, final LocalSession session, @Optional("schematic") final String formatName, final String filename) throws CommandException, WorldEditException {
- final LocalConfiguration config = worldEdit.getConfiguration();
-
- final File dir = worldEdit.getWorkingDirectoryFile(config.saveDir);
- final File f = worldEdit.getSafeSaveFile(player, dir, filename, "schematic", "schematic");
-
+ final LocalConfiguration config = this.worldEdit.getConfiguration();
+
+ final File dir = this.worldEdit.getWorkingDirectoryFile(config.saveDir);
+ final File f = this.worldEdit.getSafeSaveFile(player, dir, filename, "schematic", "schematic");
+
final ClipboardFormat format = ClipboardFormat.findByAlias(formatName);
if (format == null) {
player.printError("Unknown schematic format: " + formatName);
return;
}
-
+
final ClipboardHolder holder = session.getClipboard();
final Clipboard clipboard = holder.getClipboard();
final Transform transform = holder.getTransform();
final Clipboard target;
-
+
// If we have a transform, bake it into the copy
if (!transform.isIdentity()) {
final FlattenedClipboardTransform result = FlattenedClipboardTransform.transform(clipboard, transform, holder.getWorldData());
@@ -166,7 +166,7 @@ public class SchematicCommands {
} else {
target = clipboard;
}
-
+
SetQueue.IMP.addTask(new Runnable() {
@Override
public void run() {
@@ -183,7 +183,7 @@ public class SchematicCommands {
return;
}
}
-
+
final FileOutputStream fos = closer.register(new FileOutputStream(f));
final BufferedOutputStream bos = closer.register(new BufferedOutputStream(fos));
final ClipboardWriter writer = closer.register(format.getWriter(bos));
@@ -203,15 +203,15 @@ public class SchematicCommands {
}
});
}
-
+
@Command(aliases = { "delete", "d" }, usage = "", desc = "Delete a saved schematic", help = "Delete a schematic from the schematic list", min = 1, max = 1)
@CommandPermissions("worldedit.schematic.delete")
public void delete(final Player player, final LocalSession session, final EditSession editSession, final CommandContext args) throws WorldEditException {
- final LocalConfiguration config = worldEdit.getConfiguration();
+ final LocalConfiguration config = this.worldEdit.getConfiguration();
final String filename = args.getString(0);
-
- final File dir = worldEdit.getWorkingDirectoryFile(config.saveDir);
- final File f = worldEdit.getSafeSaveFile(player, dir, filename, "schematic", "schematic");
+
+ final File dir = this.worldEdit.getWorkingDirectoryFile(config.saveDir);
+ final File f = this.worldEdit.getSafeSaveFile(player, dir, filename, "schematic", "schematic");
TaskManager.IMP.async(new Runnable() {
@Override
public void run() {
@@ -219,17 +219,17 @@ public class SchematicCommands {
player.printError("Schematic " + filename + " does not exist!");
return;
}
-
+
if (!f.delete()) {
player.printError("Deletion of " + filename + " failed! Maybe it is read-only.");
return;
}
-
+
player.print(filename + " has been deleted.");
}
});
}
-
+
@Command(aliases = { "formats", "listformats", "f" }, desc = "List available formats", max = 0)
@CommandPermissions("worldedit.schematic.formats")
public void formats(final Actor actor) throws WorldEditException {
@@ -250,13 +250,13 @@ public class SchematicCommands {
actor.print(builder.toString());
}
}
-
+
@Command(aliases = { "list", "all", "ls" }, desc = "List saved schematics", max = 0, flags = "dn", help = "List all schematics in the schematics directory\n"
+ " -d sorts by date, oldest first\n"
+ " -n sorts by date, newest first\n")
@CommandPermissions("worldedit.schematic.list")
public void list(final Actor actor, final CommandContext args) throws WorldEditException {
- final File dir = worldEdit.getWorkingDirectoryFile(worldEdit.getConfiguration().saveDir);
+ final File dir = this.worldEdit.getWorkingDirectoryFile(this.worldEdit.getConfiguration().saveDir);
final File[] files = dir.listFiles(new FileFilter() {
@Override
public boolean accept(final File file) {
@@ -269,7 +269,7 @@ public class SchematicCommands {
if (files == null) {
throw new FilenameResolutionException(dir.getPath(), "Schematics directory invalid or not found.");
}
-
+
final int sortType = args.hasFlag('d') ? -1 : args.hasFlag('n') ? 1 : 0;
// cleanup file list
Arrays.sort(files, new Comparator() {
@@ -283,37 +283,37 @@ public class SchematicCommands {
}
// http://stackoverflow.com/questions/203030/best-way-to-list-files-in-java-sorted-by-date-modified
int result = sortType == 0 ? f1.getName().compareToIgnoreCase(f2.getName()) : // use name by default
- Long.valueOf(f1.lastModified()).compareTo(f2.lastModified()); // use date if there is a flag
+ Long.valueOf(f1.lastModified()).compareTo(f2.lastModified()); // use date if there is a flag
if (sortType == 1) {
result = -result; // flip date for newest first instead of oldest first
}
return result;
}
});
-
+
actor.print("Available schematics (Filename (Format)):");
- actor.print(listFiles("", files));
+ actor.print(this.listFiles("", files));
}
-
+
private String listFiles(final String prefix, final File[] files) {
final StringBuilder build = new StringBuilder();
for (final File file : files) {
if (file.isDirectory()) {
- build.append(listFiles(prefix + file.getName() + "/", file.listFiles()));
+ build.append(this.listFiles(prefix + file.getName() + "/", file.listFiles()));
continue;
}
-
+
if (!file.isFile()) {
continue;
}
-
+
build.append("\n\u00a79");
final ClipboardFormat format = ClipboardFormat.findByFile(file);
build.append(prefix).append(file.getName()).append(": ").append(format == null ? "Unknown" : format.name());
}
return build.toString();
}
-
+
public static Class> inject() {
return SchematicCommands.class;
}
diff --git a/src/main/java/com/sk89q/worldedit/command/ScriptingCommands.java b/src/main/java/com/sk89q/worldedit/command/ScriptingCommands.java
index ea2eb50d..331dcb81 100644
--- a/src/main/java/com/sk89q/worldedit/command/ScriptingCommands.java
+++ b/src/main/java/com/sk89q/worldedit/command/ScriptingCommands.java
@@ -40,9 +40,9 @@ import com.sk89q.worldedit.entity.Player;
* Commands related to scripting.
*/
public class ScriptingCommands {
-
+
private final WorldEdit worldEdit;
-
+
/**
* Create a new instance.
*
@@ -52,23 +52,23 @@ public class ScriptingCommands {
checkNotNull(worldEdit);
this.worldEdit = worldEdit;
}
-
+
@Command(aliases = { "cs" }, usage = " [args...]", desc = "Execute a CraftScript", min = 1, max = -1)
@CommandPermissions("worldedit.scripting.execute")
@Logging(ALL)
public void execute(final Player player, final LocalSession session, final EditSession editSession, final CommandContext args) throws WorldEditException {
final String[] scriptArgs = args.getSlice(1);
final String name = args.getString(0);
-
+
if (!player.hasPermission("worldedit.scripting.execute." + name)) {
player.printError("You don't have permission to use that script.");
return;
}
-
+
session.setLastScript(name);
-
- final File dir = worldEdit.getWorkingDirectoryFile(worldEdit.getConfiguration().scriptsDir);
- final File f = worldEdit.getSafeOpenFile(player, dir, name, "js", "js");
+
+ final File dir = this.worldEdit.getWorkingDirectoryFile(this.worldEdit.getConfiguration().scriptsDir);
+ final File f = this.worldEdit.getSafeOpenFile(player, dir, name, "js", "js");
SetQueue.IMP.addTask(new Runnable() {
@Override
public void run() {
@@ -76,7 +76,7 @@ public class ScriptingCommands {
@Override
public void run() {
try {
- worldEdit.runScript(player, f, scriptArgs);
+ ScriptingCommands.this.worldEdit.runScript(player, f, scriptArgs);
} catch (final WorldEditException ex) {
player.printError("Error while executing CraftScript.");
}
@@ -85,28 +85,28 @@ public class ScriptingCommands {
}
});
}
-
+
@Command(aliases = { ".s" }, usage = "[args...]", desc = "Execute last CraftScript", min = 0, max = -1)
@CommandPermissions("worldedit.scripting.execute")
@Logging(ALL)
public void executeLast(final Player player, final LocalSession session, final EditSession editSession, final CommandContext args) throws WorldEditException {
final String lastScript = session.getLastScript();
-
+
if (!player.hasPermission("worldedit.scripting.execute." + lastScript)) {
player.printError("You don't have permission to use that script.");
return;
}
-
+
if (lastScript == null) {
player.printError("Use /cs with a script name first.");
return;
}
-
+
final String[] scriptArgs = args.getSlice(0);
-
- final File dir = worldEdit.getWorkingDirectoryFile(worldEdit.getConfiguration().scriptsDir);
- final File f = worldEdit.getSafeOpenFile(player, dir, lastScript, "js", "js");
-
+
+ final File dir = this.worldEdit.getWorkingDirectoryFile(this.worldEdit.getConfiguration().scriptsDir);
+ final File f = this.worldEdit.getSafeOpenFile(player, dir, lastScript, "js", "js");
+
SetQueue.IMP.addTask(new Runnable() {
@Override
public void run() {
@@ -114,7 +114,7 @@ public class ScriptingCommands {
@Override
public void run() {
try {
- worldEdit.runScript(player, f, scriptArgs);
+ ScriptingCommands.this.worldEdit.runScript(player, f, scriptArgs);
} catch (final WorldEditException ex) {
player.printError("Error while executing CraftScript.");
}
@@ -123,7 +123,7 @@ public class ScriptingCommands {
}
});
}
-
+
public static Class> inject() {
return ScriptingCommands.class;
}
diff --git a/src/main/java/com/sk89q/worldedit/function/operation/Operations.java b/src/main/java/com/sk89q/worldedit/function/operation/Operations.java
index 7f219718..15809f06 100644
--- a/src/main/java/com/sk89q/worldedit/function/operation/Operations.java
+++ b/src/main/java/com/sk89q/worldedit/function/operation/Operations.java
@@ -28,9 +28,9 @@ import com.sk89q.worldedit.WorldEditException;
* Operation helper methods.
*/
public final class Operations {
-
+
private Operations() {}
-
+
/**
* Complete a given operation synchronously until it completes.
*
@@ -42,7 +42,7 @@ public final class Operations {
operation = operation.resume(new RunContext());
}
}
-
+
/**
* Complete a given operation synchronously until it completes. Catch all
* errors that is not {@link MaxChangedBlocksException} for legacy reasons.
@@ -59,7 +59,7 @@ public final class Operations {
e.printStackTrace();
}
}
-
+
/**
* Complete a given operation synchronously until it completes. Re-throw all
* {@link com.sk89q.worldedit.WorldEditException} exceptions as
@@ -76,7 +76,7 @@ public final class Operations {
e.printStackTrace();
}
}
-
+
public static void completeSmart(final Operation op, final Runnable whenDone, final boolean threadsafe) {
if (!threadsafe) {
completeBlindly(op);
@@ -105,7 +105,7 @@ public final class Operations {
};
});
}
-
+
public static Class> inject() {
return Operations.class;
}
diff --git a/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java b/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java
index 1419ff16..02705e91 100644
--- a/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java
+++ b/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java
@@ -49,13 +49,13 @@ import com.sk89q.worldedit.function.operation.RunContext;
* those points.
*/
public abstract class BreadthFirstSearch implements Operation {
-
+
private final RegionFunction function;
private final Queue queue = new ArrayDeque();
private final Set visited = new HashSet();
private final List directions = new ArrayList();
private int affected = 0;
-
+
/**
* Create a new instance.
*
@@ -64,9 +64,9 @@ public abstract class BreadthFirstSearch implements Operation {
protected BreadthFirstSearch(final RegionFunction function) {
checkNotNull(function);
this.function = function;
- addAxes();
+ this.addAxes();
}
-
+
/**
* Get the list of directions will be visited.
*
@@ -80,31 +80,31 @@ public abstract class BreadthFirstSearch implements Operation {
* @return the list of directions
*/
protected Collection getDirections() {
- return directions;
+ return this.directions;
}
-
+
/**
* Add the directions along the axes as directions to visit.
*/
protected void addAxes() {
- directions.add(new Vector(0, -1, 0));
- directions.add(new Vector(0, 1, 0));
- directions.add(new Vector(-1, 0, 0));
- directions.add(new Vector(1, 0, 0));
- directions.add(new Vector(0, 0, -1));
- directions.add(new Vector(0, 0, 1));
+ this.directions.add(new Vector(0, -1, 0));
+ this.directions.add(new Vector(0, 1, 0));
+ this.directions.add(new Vector(-1, 0, 0));
+ this.directions.add(new Vector(1, 0, 0));
+ this.directions.add(new Vector(0, 0, -1));
+ this.directions.add(new Vector(0, 0, 1));
}
-
+
/**
* Add the diagonal directions as directions to visit.
*/
protected void addDiagonal() {
- directions.add(new Vector(1, 0, 1));
- directions.add(new Vector(-1, 0, -1));
- directions.add(new Vector(1, 0, -1));
- directions.add(new Vector(-1, 0, 1));
+ this.directions.add(new Vector(1, 0, 1));
+ this.directions.add(new Vector(-1, 0, -1));
+ this.directions.add(new Vector(1, 0, -1));
+ this.directions.add(new Vector(-1, 0, 1));
}
-
+
/**
* Add the given location to the list of locations to visit, provided
* that it has not been visited. The position passed to this method
@@ -121,12 +121,12 @@ public abstract class BreadthFirstSearch implements Operation {
*/
public void visit(final Vector position) {
final BlockVector blockVector = position.toBlockVector();
- if (!visited.contains(blockVector)) {
- queue.add(blockVector);
- visited.add(blockVector);
+ if (!this.visited.contains(blockVector)) {
+ this.queue.add(blockVector);
+ this.visited.add(blockVector);
}
}
-
+
/**
* Try to visit the given 'to' location.
*
@@ -135,14 +135,14 @@ public abstract class BreadthFirstSearch implements Operation {
*/
private void visit(final Vector from, final Vector to) {
final BlockVector blockVector = to.toBlockVector();
- if (!visited.contains(blockVector)) {
- visited.add(blockVector);
- if (isVisitable(from, to)) {
- queue.add(blockVector);
+ if (!this.visited.contains(blockVector)) {
+ this.visited.add(blockVector);
+ if (this.isVisitable(from, to)) {
+ this.queue.add(blockVector);
}
}
}
-
+
/**
* Return whether the given 'to' block should be visited, starting from the
* 'from' block.
@@ -152,40 +152,40 @@ public abstract class BreadthFirstSearch implements Operation {
* @return true if the 'to' block should be visited
*/
protected abstract boolean isVisitable(final Vector from, final Vector to);
-
+
/**
* Get the number of affected objects.
*
* @return the number of affected
*/
public int getAffected() {
- return affected;
+ return this.affected;
}
-
+
@Override
public Operation resume(final RunContext run) throws WorldEditException {
Vector position;
- while ((position = queue.poll()) != null) {
- if (function.apply(position)) {
- affected++;
+ while ((position = this.queue.poll()) != null) {
+ if (this.function.apply(position)) {
+ this.affected++;
}
-
- for (final Vector dir : directions) {
- visit(position, position.add(dir));
+
+ for (final Vector dir : this.directions) {
+ this.visit(position, position.add(dir));
}
}
return null;
}
-
+
@Override
public void cancel() {}
-
+
public static Class> inject() {
return Operations.class;
}
-
+
@Override
- public void addStatusMessages(List messages) {
- messages.add(getAffected() + " blocks affected");
+ public void addStatusMessages(final List messages) {
+ messages.add(this.getAffected() + " blocks affected");
}
}
diff --git a/src/main/java/com/sk89q/worldedit/function/visitor/DownwardVisitor.java b/src/main/java/com/sk89q/worldedit/function/visitor/DownwardVisitor.java
index 123da36c..aa29cefa 100644
--- a/src/main/java/com/sk89q/worldedit/function/visitor/DownwardVisitor.java
+++ b/src/main/java/com/sk89q/worldedit/function/visitor/DownwardVisitor.java
@@ -36,9 +36,9 @@ import com.sk89q.worldedit.function.operation.Operations;
*
This is used by {@code //fill}.
*/
public class DownwardVisitor extends RecursiveVisitor {
-
+
private final int baseY;
-
+
/**
* Create a new visitor.
*
@@ -49,10 +49,10 @@ public class DownwardVisitor extends RecursiveVisitor {
public DownwardVisitor(final Mask mask, final RegionFunction function, final int baseY) {
super(mask, function);
checkNotNull(mask);
-
+
this.baseY = baseY;
-
- final Collection directions = getDirections();
+
+ final Collection directions = this.getDirections();
directions.clear();
directions.add(new Vector(1, 0, 0));
directions.add(new Vector(-1, 0, 0));
@@ -60,13 +60,13 @@ public class DownwardVisitor extends RecursiveVisitor {
directions.add(new Vector(0, 0, -1));
directions.add(new Vector(0, -1, 0));
}
-
+
@Override
protected boolean isVisitable(final Vector from, final Vector to) {
final int fromY = from.getBlockY();
- return ((fromY == baseY) || (to.subtract(from).getBlockY() < 0)) && super.isVisitable(from, to);
+ return ((fromY == this.baseY) || (to.subtract(from).getBlockY() < 0)) && super.isVisitable(from, to);
}
-
+
public static Class> inject() {
return Operations.class;
}
diff --git a/src/main/java/com/sk89q/worldedit/function/visitor/EntityVisitor.java b/src/main/java/com/sk89q/worldedit/function/visitor/EntityVisitor.java
index fccc4f8c..23a70456 100644
--- a/src/main/java/com/sk89q/worldedit/function/visitor/EntityVisitor.java
+++ b/src/main/java/com/sk89q/worldedit/function/visitor/EntityVisitor.java
@@ -35,11 +35,11 @@ import com.sk89q.worldedit.function.operation.RunContext;
* Visits entities as provided by an {@code Iterator}.
*/
public class EntityVisitor implements Operation {
-
+
private final EntityFunction function;
private final int affected = 0;
private final Iterator extends Entity> iterator;
-
+
/**
* Create a new instance.
*
@@ -49,36 +49,36 @@ public class EntityVisitor implements Operation {
public EntityVisitor(final Iterator extends Entity> iterator, final EntityFunction function) {
checkNotNull(iterator);
checkNotNull(function);
-
+
this.function = function;
this.iterator = iterator;
}
-
+
/**
* Get the number of affected objects.
*
* @return the number of affected
*/
public int getAffected() {
- return affected;
+ return this.affected;
}
-
+
@Override
public Operation resume(final RunContext run) throws WorldEditException {
- while (iterator.hasNext()) {
- function.apply(iterator.next());
+ while (this.iterator.hasNext()) {
+ this.function.apply(this.iterator.next());
}
return null;
}
-
+
@Override
public void cancel() {}
-
+
@Override
- public void addStatusMessages(List messages) {
- messages.add(getAffected() + " blocks affected");
+ public void addStatusMessages(final List messages) {
+ messages.add(this.getAffected() + " blocks affected");
}
-
+
public static Class> inject() {
return Operations.class;
}
diff --git a/src/main/java/com/sk89q/worldedit/function/visitor/FlatRegionVisitor.java b/src/main/java/com/sk89q/worldedit/function/visitor/FlatRegionVisitor.java
index 2f8827aa..5c2cb47e 100644
--- a/src/main/java/com/sk89q/worldedit/function/visitor/FlatRegionVisitor.java
+++ b/src/main/java/com/sk89q/worldedit/function/visitor/FlatRegionVisitor.java
@@ -35,11 +35,11 @@ import com.sk89q.worldedit.regions.FlatRegion;
* Applies region functions to columns in a {@link FlatRegion}.
*/
public class FlatRegionVisitor implements Operation {
-
+
private final FlatRegionFunction function;
private final int affected = 0;
private final Iterable iterator;
-
+
/**
* Create a new visitor.
*
@@ -50,36 +50,36 @@ public class FlatRegionVisitor implements Operation {
checkNotNull(flatRegion);
checkNotNull(function);
this.function = function;
- iterator = flatRegion.asFlatRegion();
+ this.iterator = flatRegion.asFlatRegion();
}
-
+
/**
* Get the number of affected objects.
*
* @return the number of affected
*/
public int getAffected() {
- return affected;
+ return this.affected;
}
-
+
@Override
public Operation resume(final RunContext run) throws WorldEditException {
- for (final Vector2D pt : iterator) {
- function.apply(pt);
+ for (final Vector2D pt : this.iterator) {
+ this.function.apply(pt);
}
return null;
}
-
+
@Override
public void cancel() {}
-
+
@Override
- public void addStatusMessages(List messages) {
- messages.add(getAffected() + " columns affected");
+ public void addStatusMessages(final List messages) {
+ messages.add(this.getAffected() + " columns affected");
}
public static Class> inject() {
return Operations.class;
}
-
+
}
diff --git a/src/main/java/com/sk89q/worldedit/function/visitor/LayerVisitor.java b/src/main/java/com/sk89q/worldedit/function/visitor/LayerVisitor.java
index 10f70075..873f002c 100644
--- a/src/main/java/com/sk89q/worldedit/function/visitor/LayerVisitor.java
+++ b/src/main/java/com/sk89q/worldedit/function/visitor/LayerVisitor.java
@@ -44,13 +44,13 @@ import com.sk89q.worldedit.regions.FlatRegion;
* each layer.
*/
public class LayerVisitor implements Operation {
-
+
private final LayerFunction function;
private Mask2D mask = Masks.alwaysTrue2D();
private final int minY;
private final int maxY;
private final Iterable iterator;
-
+
/**
* Create a new visitor.
*
@@ -66,9 +66,9 @@ public class LayerVisitor implements Operation {
this.minY = minY;
this.maxY = maxY;
this.function = function;
- iterator = flatRegion.asFlatRegion();
+ this.iterator = flatRegion.asFlatRegion();
}
-
+
/**
* Get the mask that determines which columns within the flat region
* will be visited.
@@ -76,9 +76,9 @@ public class LayerVisitor implements Operation {
* @return a 2D mask
*/
public Mask2D getMask() {
- return mask;
+ return this.mask;
}
-
+
/**
* Set the mask that determines which columns within the flat region
* will be visited.
@@ -89,32 +89,32 @@ public class LayerVisitor implements Operation {
checkNotNull(mask);
this.mask = mask;
}
-
+
@Override
public Operation resume(final RunContext run) throws WorldEditException {
- for (final Vector2D column : iterator) {
- if (!mask.test(column)) {
+ for (final Vector2D column : this.iterator) {
+ if (!this.mask.test(column)) {
continue;
}
-
+
// Abort if we are underground
- if (function.isGround(column.toVector(maxY + 1))) {
+ if (this.function.isGround(column.toVector(this.maxY + 1))) {
return null;
}
-
+
boolean found = false;
int groundY = 0;
- for (int y = maxY; y >= minY; --y) {
+ for (int y = this.maxY; y >= this.minY; --y) {
final Vector test = column.toVector(y);
if (!found) {
- if (function.isGround(test)) {
+ if (this.function.isGround(test)) {
found = true;
groundY = y;
}
}
-
+
if (found) {
- if (!function.apply(test, groundY - y)) {
+ if (!this.function.apply(test, groundY - y)) {
break;
}
}
@@ -122,12 +122,12 @@ public class LayerVisitor implements Operation {
}
return null;
}
-
+
@Override
public void cancel() {}
-
+
@Override
- public void addStatusMessages(List messages) {}
+ public void addStatusMessages(final List messages) {}
public static Class> inject() {
return Operations.class;
diff --git a/src/main/java/com/sk89q/worldedit/function/visitor/NonRisingVisitor.java b/src/main/java/com/sk89q/worldedit/function/visitor/NonRisingVisitor.java
index c102beb0..e1f2720d 100644
--- a/src/main/java/com/sk89q/worldedit/function/visitor/NonRisingVisitor.java
+++ b/src/main/java/com/sk89q/worldedit/function/visitor/NonRisingVisitor.java
@@ -30,7 +30,7 @@ import com.sk89q.worldedit.function.operation.Operations;
* A {@link RecursiveVisitor} that goes orthogonally to the side and down, but never up.
*/
public class NonRisingVisitor extends RecursiveVisitor {
-
+
/**
* Create a new recursive visitor.
*
@@ -39,7 +39,7 @@ public class NonRisingVisitor extends RecursiveVisitor {
*/
public NonRisingVisitor(final Mask mask, final RegionFunction function) {
super(mask, function);
- final Collection directions = getDirections();
+ final Collection directions = this.getDirections();
directions.clear();
directions.add(new Vector(1, 0, 0));
directions.add(new Vector(-1, 0, 0));
@@ -47,9 +47,9 @@ public class NonRisingVisitor extends RecursiveVisitor {
directions.add(new Vector(0, 0, -1));
directions.add(new Vector(0, -1, 0));
}
-
+
public static Class> inject() {
return Operations.class;
}
-
+
}
diff --git a/src/main/java/com/sk89q/worldedit/function/visitor/RecursiveVisitor.java b/src/main/java/com/sk89q/worldedit/function/visitor/RecursiveVisitor.java
index 964eb030..56713b26 100644
--- a/src/main/java/com/sk89q/worldedit/function/visitor/RecursiveVisitor.java
+++ b/src/main/java/com/sk89q/worldedit/function/visitor/RecursiveVisitor.java
@@ -31,9 +31,9 @@ import com.sk89q.worldedit.function.operation.Operations;
* determine where a block should be visited.
*/
public class RecursiveVisitor extends BreadthFirstSearch {
-
+
private final Mask mask;
-
+
/**
* Create a new recursive visitor.
*
@@ -45,12 +45,12 @@ public class RecursiveVisitor extends BreadthFirstSearch {
checkNotNull(mask);
this.mask = mask;
}
-
+
@Override
protected boolean isVisitable(final Vector from, final Vector to) {
- return mask.test(to);
+ return this.mask.test(to);
}
-
+
public static Class> inject() {
return Operations.class;
}
diff --git a/src/main/java/com/sk89q/worldedit/function/visitor/RegionVisitor.java b/src/main/java/com/sk89q/worldedit/function/visitor/RegionVisitor.java
index fdbc75ad..1cd4e4dd 100644
--- a/src/main/java/com/sk89q/worldedit/function/visitor/RegionVisitor.java
+++ b/src/main/java/com/sk89q/worldedit/function/visitor/RegionVisitor.java
@@ -34,45 +34,45 @@ import com.sk89q.worldedit.regions.Region;
* Utility class to apply region functions to {@link com.sk89q.worldedit.regions.Region}.
*/
public class RegionVisitor implements Operation {
-
+
private final RegionFunction function;
private final int affected = 0;
-
+
private final Iterator iterator;
-
+
public RegionVisitor(final Region region, final RegionFunction function) {
this.function = function;
- iterator = region.iterator();
-
+ this.iterator = region.iterator();
+
}
-
+
/**
* Get the number of affected objects.
*
* @return the number of affected
*/
public int getAffected() {
- return affected;
+ return this.affected;
}
-
+
@Override
public Operation resume(final RunContext run) throws WorldEditException {
- while (iterator.hasNext()) {
- function.apply(iterator.next());
+ while (this.iterator.hasNext()) {
+ this.function.apply(this.iterator.next());
}
return null;
}
-
+
@Override
public void cancel() {}
-
+
@Override
- public void addStatusMessages(List messages) {
- messages.add(getAffected() + " blocks affected");
+ public void addStatusMessages(final List messages) {
+ messages.add(this.getAffected() + " blocks affected");
}
public static Class> inject() {
return Operations.class;
}
-
+
}