This commit is contained in:
Jesse Boyd 2016-03-31 20:23:10 +11:00
parent c2749bc3af
commit 74a03b2b19
80 changed files with 2161 additions and 2175 deletions

View File

@ -95,38 +95,38 @@ public class Fawe {
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();
@ -136,28 +136,28 @@ public class Fawe {
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() {
@ -202,7 +202,7 @@ public class Fawe {
}
public Thread getMainThread() {
return thread;
return this.thread;
}
/*

View File

@ -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,7 +85,7 @@ 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);
}
@ -106,7 +106,7 @@ public class FaweAPI {
* @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();
}
@ -116,8 +116,8 @@ public class FaweAPI {
* @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();
}
@ -127,7 +127,7 @@ public class FaweAPI {
* - 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);
}
@ -136,8 +136,8 @@ public class FaweAPI {
* - 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);
}
@ -150,7 +150,7 @@ 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);
}
@ -167,9 +167,9 @@ 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();
}
}
@ -188,10 +188,10 @@ 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();
}
}
@ -206,24 +206,24 @@ 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<String, Tag> tagMap = (Map<String, Tag>) 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;
final 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 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:

View File

@ -19,7 +19,7 @@ public class BukkitCommand implements CommandExecutor {
@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;

View File

@ -19,49 +19,49 @@ public class BukkitPlayer extends FawePlayer<Player> {
@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.<FaweBukkit> imp().getVault() == null) {
parent.addAttachment(Fawe.<FaweBukkit> imp()).setPermission("fawe.bypass", flag);
this.parent.addAttachment(Fawe.<FaweBukkit> imp()).setPermission("fawe.bypass", flag);
} else if (flag) {
Fawe.<FaweBukkit> imp().getVault().permission.playerAdd(parent, perm);
Fawe.<FaweBukkit> imp().getVault().permission.playerAdd(this.parent, perm);
} else {
Fawe.<FaweBukkit> imp().getVault().permission.playerRemove(parent, perm);
Fawe.<FaweBukkit> 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.<FaweBukkit> imp().getWorldEditPlugin().wrapPlayer(parent);
return Fawe.<FaweBukkit> imp().getWorldEditPlugin().wrapPlayer(this.parent);
}
}

View File

@ -12,18 +12,18 @@ 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);
@ -34,7 +34,7 @@ public class BukkitTaskMan extends TaskManager {
if (r == null) {
return;
}
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, r).getTaskId();
this.plugin.getServer().getScheduler().runTaskAsynchronously(this.plugin, r).getTaskId();
}
@Override
@ -42,7 +42,7 @@ public class BukkitTaskMan extends TaskManager {
if (r == null) {
return;
}
plugin.getServer().getScheduler().runTask(plugin, r).getTaskId();
this.plugin.getServer().getScheduler().runTask(this.plugin, r).getTaskId();
}
@Override
@ -50,12 +50,12 @@ public class BukkitTaskMan extends TaskManager {
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

View File

@ -42,14 +42,14 @@ public class FaweBukkit extends JavaPlugin implements IFawe {
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
@ -57,31 +57,31 @@ public class FaweBukkit extends JavaPlugin implements IFawe {
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
@ -97,15 +97,15 @@ public class FaweBukkit extends JavaPlugin implements IFawe {
@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!");
}
}
@ -127,18 +127,18 @@ 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();
}
}
@ -148,23 +148,23 @@ public class FaweBukkit extends JavaPlugin implements IFawe {
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
@ -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 {

View File

@ -11,9 +11,9 @@ public class VaultUtil {
public VaultUtil() {
final RegisteredServiceProvider<Permission> 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;
}
}
}

View File

@ -99,12 +99,12 @@ public class WEListener implements Listener {
}
public boolean checkSelection(final FawePlayer<Player> 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,7 +139,7 @@ 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)
@ -156,58 +156,58 @@ public class WEListener implements Listener {
// 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<RegionWrapper> 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;

View File

@ -18,8 +18,8 @@ public class FactionsFeature extends BukkitMaskManager implements Listener {
public FactionsFeature(final Plugin factionsPlugin, final FaweBukkit p3) {
super(factionsPlugin.getName());
factions = factionsPlugin;
plugin = p3;
this.factions = factionsPlugin;
this.plugin = p3;
BoardColl.get();
}
@ -27,7 +27,7 @@ public class FactionsFeature extends BukkitMaskManager implements Listener {
public FaweMask getMask(final FawePlayer<Player> 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)) {

View File

@ -20,7 +20,7 @@ public class FactionsUUIDFeature extends BukkitMaskManager implements Listener {
public FactionsUUIDFeature(final Plugin factionsPlugin, final FaweBukkit p3) {
super(factionsPlugin.getName());
instance = Board.getInstance();
this.instance = Board.getInstance();
}
@Override
@ -33,7 +33,7 @@ public class FactionsUUIDFeature extends BukkitMaskManager implements Listener {
int count = 32;
if (isAdded(locs, world, player, perm)) {
if (this.isAdded(locs, world, player, perm)) {
boolean hasPerm = true;
RegionWrapper chunkSelection;
@ -44,28 +44,28 @@ public class FactionsUUIDFeature extends BukkitMaskManager implements Listener {
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;
}
@ -86,7 +86,7 @@ public class FactionsUUIDFeature extends BukkitMaskManager implements Listener {
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;
}

View File

@ -19,9 +19,9 @@ 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) {
@ -31,26 +31,26 @@ 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<RegionWrapper> 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) {
@ -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 {

View File

@ -17,8 +17,8 @@ public class GriefPreventionFeature extends BukkitMaskManager implements Listene
public GriefPreventionFeature(final Plugin griefpreventionPlugin, final FaweBukkit p3) {
super(griefpreventionPlugin.getName());
griefprevention = griefpreventionPlugin;
plugin = p3;
this.griefprevention = griefpreventionPlugin;
this.plugin = p3;
}
@Override

View File

@ -19,8 +19,8 @@ public class PlotMeFeature extends BukkitMaskManager implements Listener {
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;
}
@ -28,15 +28,15 @@ public class PlotMeFeature extends BukkitMaskManager implements Listener {
public FaweMask getMask(final FawePlayer<Player> 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

View File

@ -22,7 +22,7 @@ public class PlotSquaredFeature extends BukkitMaskManager implements Listener {
public PlotSquaredFeature(final Plugin plotPlugin, final FaweBukkit p3) {
super(plotPlugin.getName());
plugin = p3;
this.plugin = p3;
BukkitMain.worldEdit = null;
PS.get().worldedit = null;
}

View File

@ -20,8 +20,8 @@ public class PreciousStonesFeature extends BukkitMaskManager implements Listener
public PreciousStonesFeature(final Plugin preciousstonesPlugin, final FaweBukkit p3) {
super(preciousstonesPlugin.getName());
preciousstones = preciousstonesPlugin;
plugin = p3;
this.preciousstones = preciousstonesPlugin;
this.plugin = p3;
}

View File

@ -17,8 +17,8 @@ public class ResidenceFeature extends BukkitMaskManager implements Listener {
public ResidenceFeature(final Plugin residencePlugin, final FaweBukkit p3) {
super(residencePlugin.getName());
residence = residencePlugin;
plugin = p3;
this.residence = residencePlugin;
this.plugin = p3;
}

View File

@ -20,8 +20,8 @@ public class TownyFeature extends BukkitMaskManager implements Listener {
public TownyFeature(final Plugin townyPlugin, final FaweBukkit p3) {
super(townyPlugin.getName());
towny = townyPlugin;
plugin = p3;
this.towny = townyPlugin;
this.plugin = p3;
}
@Override
@ -29,7 +29,7 @@ public class TownyFeature extends BukkitMaskManager implements Listener {
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;

View File

@ -31,14 +31,14 @@ public class Worldguard extends BukkitMaskManager implements Listener {
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)) {
@ -55,8 +55,8 @@ public class Worldguard extends BukkitMaskManager implements Listener {
}
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;
@ -75,7 +75,7 @@ public class Worldguard extends BukkitMaskManager implements Listener {
public FaweMask getMask(final FawePlayer<Player> 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());

View File

@ -11,19 +11,19 @@ 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);
}

View File

@ -41,55 +41,55 @@ 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<Long> 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<Long> 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<Long> 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<Long> 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<Long> 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<Long> map = this.loaded.get(world);
if (map != null) {
return map.contains(id);
}
@ -97,17 +97,17 @@ public abstract class BukkitQueue_0 extends FaweQueue implements Listener {
};
@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<ChunkLoc, FaweChunk<Chunk>> blocks = new ConcurrentHashMap<>();
@ -120,15 +120,15 @@ 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<Chunk> result = blocks.get(wrap);
FaweChunk<Chunk> result = this.blocks.get(wrap);
if (result == null) {
result = getChunk(wrap);
result = this.getChunk(wrap);
result.setBlock(x, y, z, id, data);
final FaweChunk<Chunk> previous = blocks.put(wrap, result);
final FaweChunk<Chunk> 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);
@ -136,16 +136,16 @@ public abstract class BukkitQueue_0 extends FaweQueue implements Listener {
}
@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<Chunk> result = blocks.get(wrap);
FaweChunk<Chunk> result = this.blocks.get(wrap);
if (result == null) {
result = getChunk(wrap);
final FaweChunk<Chunk> previous = blocks.put(wrap, result);
result = this.getChunk(wrap);
final FaweChunk<Chunk> previous = this.blocks.put(wrap, result);
if (previous != null) {
blocks.put(wrap, previous);
this.blocks.put(wrap, previous);
result = previous;
}
}
@ -156,16 +156,16 @@ public abstract class BukkitQueue_0 extends FaweQueue implements Listener {
@Override
public FaweChunk<Chunk> next() {
try {
if (blocks.size() == 0) {
if (this.blocks.size() == 0) {
return null;
}
final Iterator<Entry<ChunkLoc, FaweChunk<Chunk>>> iter = blocks.entrySet().iterator();
final Iterator<Entry<ChunkLoc, FaweChunk<Chunk>>> iter = this.blocks.entrySet().iterator();
final FaweChunk<Chunk> 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();
@ -183,7 +183,7 @@ 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;
@ -191,12 +191,12 @@ public abstract class BukkitQueue_0 extends FaweQueue implements Listener {
@Override
public void clear() {
blocks.clear();
this.blocks.clear();
}
@Override
public void setChunk(FaweChunk<?> chunk) {
blocks.put(chunk.getChunkLoc(), (FaweChunk<Chunk>) chunk);
public void setChunk(final FaweChunk<?> chunk) {
this.blocks.put(chunk.getChunkLoc(), (FaweChunk<Chunk>) chunk);
}
public abstract Collection<FaweChunk<Chunk>> sendChunk(final Collection<FaweChunk<Chunk>> fcs);
@ -207,5 +207,5 @@ public abstract class BukkitQueue_0 extends FaweQueue implements Listener {
public abstract FaweChunk<Chunk> getChunk(final ChunkLoc wrap);
@Override
public abstract boolean fixLighting(FaweChunk<?> fc, boolean fixAll);
public abstract boolean fixLighting(final FaweChunk<?> fc, final boolean fixAll);
}

View File

@ -26,25 +26,25 @@ public class BukkitChunk_1_8 extends FaweChunk<Chunk> {
*/
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;
}
/**
@ -53,15 +53,15 @@ public class BukkitChunk_1_8 extends FaweChunk<Chunk> {
* @return
*/
public int getCount(final int i) {
return count[i];
return this.count[i];
}
public int getAir(final int i) {
return air[i];
return this.air[i];
}
public void setCount(int i, short value) {
count[i] = value;
public void setCount(final int i, final short value) {
this.count[i] = value;
}
/**
@ -70,26 +70,26 @@ public class BukkitChunk_1_8 extends FaweChunk<Chunk> {
* @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;
}
@ -100,31 +100,32 @@ public class BukkitChunk_1_8 extends FaweChunk<Chunk> {
* @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<Chunk> {
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<Chunk> {
case 130:
case 76:
case 62:
relight[i]++;
this.relight[i]++;
case 54:
case 146:
case 61:
@ -218,13 +219,13 @@ public class BukkitChunk_1_8 extends FaweChunk<Chunk> {
}
@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();
}

View File

@ -30,10 +30,10 @@ public class BukkitEditSessionWrapper_1_8 extends BukkitEditSessionWrapper_0 {
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();
}
@ -44,19 +44,19 @@ public class BukkitEditSessionWrapper_1_8 extends BukkitEditSessionWrapper_0 {
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: {

View File

@ -56,7 +56,7 @@ 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");
@ -80,21 +80,21 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
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();
}
@ -105,12 +105,12 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
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;
}
@ -120,7 +120,7 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
final HashMap<String, ArrayList<FaweChunk<Chunk>>> map = new HashMap<>();
for (final FaweChunk<Chunk> fc : fcs) {
String world = fc.getChunkLoc().world;
final String world = fc.getChunkLoc().world;
ArrayList<FaweChunk<Chunk>> list = map.get(world);
if (list == null) {
list = new ArrayList<>();
@ -138,7 +138,7 @@ 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<Chunk> fc : list) {
final int dx = Math.abs(cx - fc.getChunkLoc().x);
@ -146,11 +146,11 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
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,13 +159,13 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
}
}
final HashSet<FaweChunk<Chunk>> chunks = new HashSet<FaweChunk<Chunk>>();
for (FaweChunk<Chunk> fc : fcs) {
Chunk chunk = fc.getChunk();
for (final FaweChunk<Chunk> 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);
}
}
@ -173,39 +173,39 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
}
@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();
final Object c = this.methodGetHandleChunk.of(chunk).call();
methodInitLighting.of(c).call();
this.methodInitLighting.of(c).call();
if ((bc.getTotalRelight() == 0 && !fixAll)) {
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);
}
}
@ -258,35 +258,35 @@ 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;
}
@ -302,7 +302,7 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
// 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);
@ -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];
@ -396,20 +396,20 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
}
// 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;
}
@ -439,8 +439,8 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
HashMap<String, HashMap<IntegerPair, Integer>> players = new HashMap<>();
for (final Player player : Bukkit.getOnlinePlayers()) {
// Clear history
FawePlayer<Object> fp = FawePlayer.wrap(player);
LocalSession s = fp.getSession();
final FawePlayer<Object> fp = FawePlayer.wrap(player);
final LocalSession s = fp.getSession();
if (s != null) {
s.clearHistory();
s.setClipboard(null);
@ -490,7 +490,7 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
final boolean save = world.isAutoSave();
world.setAutoSave(false);
for (final Chunk chunk : world.getLoadedChunks()) {
unloadChunk(name, chunk);
this.unloadChunk(name, chunk);
}
world.setAutoSave(save);
continue;
@ -515,7 +515,7 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
int free = MemUtil.calculateMemory();
if (free <= 1) {
for (final Chunk chunk : toUnload) {
unloadChunk(chunk.getWorld().getName(), chunk);
this.unloadChunk(chunk.getWorld().getName(), chunk);
}
} else if (free == Integer.MAX_VALUE) {
for (final Chunk chunk : toUnload) {
@ -546,7 +546,7 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
for (final World world : Bukkit.getWorlds()) {
final String name = world.getName();
for (final Chunk chunk : world.getLoadedChunks()) {
unloadChunk(name, chunk);
this.unloadChunk(name, chunk);
}
}
System.gc();
@ -554,11 +554,11 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
}
public Object newChunkSection(final int i, final boolean flag, final char[] ids) {
return classChunkSectionConstructor.create(i, flag, ids);
return this.classChunkSectionConstructor.create(i, flag, ids);
}
public char[] getIdArray(final Object obj) {
return (char[]) methodGetIdArray.of(obj).call();
return (char[]) this.methodGetIdArray.of(obj).call();
}
@Override
@ -567,8 +567,8 @@ public class BukkitQueue_1_8 extends BukkitQueue_0 {
}
public boolean unloadChunk(final String world, final Chunk chunk) {
final Object c = methodGetHandleChunk.of(chunk).call();
mustSave.of(c).set(false);
final Object c = this.methodGetHandleChunk.of(chunk).call();
this.mustSave.of(c).set(false);
if (chunk.isLoaded()) {
chunk.unload(false, false);
}

View File

@ -46,7 +46,7 @@ public class FaweGenerator_1_8 extends ChunkGenerator implements Listener {
private final BukkitQueue_1_8 queue;
private void registerEvents() {
if (events) {
if (this.events) {
return;
}
Bukkit.getPluginManager().registerEvents(this, Fawe.<FaweBukkit> imp());
@ -62,7 +62,7 @@ public class FaweGenerator_1_8 extends ChunkGenerator implements Listener {
return;
}
fawe.populate(event.getChunk());
decouple((FaweGenerator_1_8) gen, world);
this.decouple((FaweGenerator_1_8) gen, world);
}
}
@ -75,7 +75,7 @@ public class FaweGenerator_1_8 extends ChunkGenerator implements Listener {
public void setBlock(final short[][] result, final int x, final int y, final int z, final short[] blkid) {
if (blkid.length == 1) {
setBlock(result, x, y, z, blkid[0]);
this.setBlock(result, x, y, z, blkid[0]);
}
final short id = blkid[FaweCache.RANDOM.random(blkid.length)];
if (result[FaweCache.CACHE_I[y][x][z]] == null) {
@ -87,10 +87,10 @@ public class FaweGenerator_1_8 extends ChunkGenerator implements Listener {
public void setBlocks(final short[][] ids, final byte[][] data, final int x, final int z) {
this.ids = ids;
this.data = data == null ? new byte[16][] : data;
if (parent == null) {
inject(this, world);
if (this.parent == null) {
this.inject(this, this.world);
}
world.regenerateChunk(x, z);
this.world.regenerateChunk(x, z);
}
/**
@ -123,14 +123,14 @@ public class FaweGenerator_1_8 extends ChunkGenerator implements Listener {
if (!skip) {
try {
chunk.load(true);
biomes = new Biome[16][16];
this.biomes = new Biome[16][16];
final int X = x << 4;
final int Z = z << 4;
for (int xx = 0; xx < 16; xx++) {
final int xxx = X + x;
for (int zz = 0; zz < 16; zz++) {
final int zzz = Z + zz;
biomes[xx][zz] = world.getBiome(xxx, zzz);
this.biomes[xx][zz] = this.world.getBiome(xxx, zzz);
}
}
final Method getHandele = chunk.getClass().getDeclaredMethod("getHandle");
@ -323,17 +323,17 @@ public class FaweGenerator_1_8 extends ChunkGenerator implements Listener {
}
// Execute
this.ids = ids;
data = datas;
if (parent == null) {
inject(this, world);
this.data = datas;
if (this.parent == null) {
this.inject(this, this.world);
}
world.regenerateChunk(x, z);
this.world.regenerateChunk(x, z);
}
public void inject(final FaweGenerator_1_8 gen, final World world) {
queue.setGenerator(world, gen);
queue.setPopulator(world, new ArrayList<BlockPopulator>());
queue.setProvider(world, null);
this.queue.setGenerator(world, gen);
this.queue.setPopulator(world, new ArrayList<BlockPopulator>());
this.queue.setProvider(world, null);
}
public void decouple(final FaweGenerator_1_8 gen, final World world) {
@ -343,10 +343,10 @@ public class FaweGenerator_1_8 extends ChunkGenerator implements Listener {
gen.entities = null;
gen.biomes = null;
if (gen.parent == null) {
queue.setGenerator(world, gen.parent);
queue.setPopulator(world, gen.pops);
this.queue.setGenerator(world, gen.parent);
this.queue.setPopulator(world, gen.pops);
if (gen.provider != null) {
queue.setProvider(world, gen.provider);
this.queue.setProvider(world, gen.provider);
}
}
}
@ -354,21 +354,21 @@ public class FaweGenerator_1_8 extends ChunkGenerator implements Listener {
public FaweGenerator_1_8(final BukkitQueue_1_8 queue, final World world) {
this.queue = queue;
this.world = world;
parent = world.getGenerator();
pops = world.getPopulators();
if (parent == null) {
provider = queue.getProvider(world);
this.parent = world.getGenerator();
this.pops = world.getPopulators();
if (this.parent == null) {
this.provider = queue.getProvider(world);
} else {
provider = null;
this.provider = null;
}
registerEvents();
this.registerEvents();
}
@Override
public short[][] generateExtBlockSections(final World world, final Random random, final int x, final int z, final BiomeGrid biomes) {
short[][] result;
if (ids != null) {
result = ids;
if (this.ids != null) {
result = this.ids;
if ((biomes != null) && (this.biomes != null)) {
for (int i = 0; i < 16; i++) {
for (int j = 0; j < 16; j++) {
@ -376,8 +376,8 @@ public class FaweGenerator_1_8 extends ChunkGenerator implements Listener {
}
}
}
} else if (parent != null) {
result = parent.generateExtBlockSections(world, random, x, z, biomes);
} else if (this.parent != null) {
result = this.parent.generateExtBlockSections(world, random, x, z, biomes);
} else {
result = null;
}
@ -385,8 +385,8 @@ public class FaweGenerator_1_8 extends ChunkGenerator implements Listener {
}
public void populate(final Chunk chunk) {
for (int i = 0; i < data.length; i++) {
final byte[] section = data[i];
for (int i = 0; i < this.data.length; i++) {
final byte[] section = this.data[i];
if (section == null) {
continue;
}
@ -401,19 +401,19 @@ public class FaweGenerator_1_8 extends ChunkGenerator implements Listener {
chunk.getBlock(x, y, z).setData(v != -1 ? v : 0, false);
}
}
if ((tiles != null) || (entities != null)) {
queue.setEntitiesAndTiles(chunk, entities, tiles);
if ((this.tiles != null) || (this.entities != null)) {
this.queue.setEntitiesAndTiles(chunk, this.entities, this.tiles);
}
final BukkitChunk_1_8 fc = new BukkitChunk_1_8(new ChunkLoc(chunk.getWorld().getName(), chunk.getX(), chunk.getZ()));
fc.chunk = chunk;
queue.fixLighting(fc, Settings.FIX_ALL_LIGHTING);
this.queue.fixLighting(fc, Settings.FIX_ALL_LIGHTING);
}
@Override
public byte[] generate(final World world, final Random random, final int x, final int z) {
if (ids == null) {
if (this.ids == null) {
try {
parent.generate(world, random, x, z);
this.parent.generate(world, random, x, z);
} catch (final Throwable e) {
return null;
}
@ -423,32 +423,32 @@ public class FaweGenerator_1_8 extends ChunkGenerator implements Listener {
@Override
public byte[][] generateBlockSections(final World world, final Random random, final int x, final int z, final BiomeGrid biomes) {
if ((ids == null) && (parent != null)) {
return parent.generateBlockSections(world, random, x, z, biomes);
if ((this.ids == null) && (this.parent != null)) {
return this.parent.generateBlockSections(world, random, x, z, biomes);
}
return null;
}
@Override
public boolean canSpawn(final World world, final int x, final int z) {
if (parent != null) {
return parent.canSpawn(world, x, z);
if (this.parent != null) {
return this.parent.canSpawn(world, x, z);
}
return true;
}
@Override
public List<BlockPopulator> getDefaultPopulators(final World world) {
if ((ids == null) && (parent != null)) {
return parent.getDefaultPopulators(world);
if ((this.ids == null) && (this.parent != null)) {
return this.parent.getDefaultPopulators(world);
}
return null;
}
@Override
public Location getFixedSpawnLocation(final World world, final Random random) {
if ((ids == null) && (parent != null)) {
return parent.getFixedSpawnLocation(world, random);
if ((this.ids == null) && (this.parent != null)) {
return this.parent.getFixedSpawnLocation(world, random);
}
return null;
}

View File

@ -26,25 +26,25 @@ public class BukkitChunk_1_9 extends FaweChunk<Chunk> {
*/
protected BukkitChunk_1_9(final ChunkLoc chunk) {
super(chunk);
ids = new int[16][];
count = new short[16];
air = new short[16];
relight = new short[16];
this.ids = new int[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;
}
/**
@ -53,15 +53,15 @@ public class BukkitChunk_1_9 extends FaweChunk<Chunk> {
* @return
*/
public int getCount(final int i) {
return count[i];
return this.count[i];
}
public int getAir(final int i) {
return air[i];
return this.air[i];
}
public void setCount(int i, short value) {
count[i] = value;
public void setCount(final int i, final short value) {
this.count[i] = value;
}
/**
@ -70,26 +70,26 @@ public class BukkitChunk_1_9 extends FaweChunk<Chunk> {
* @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;
}
@ -100,35 +100,36 @@ public class BukkitChunk_1_9 extends FaweChunk<Chunk> {
* @return
*/
public int[] getIdArray(final int i) {
return ids[i];
return this.ids[i];
}
public int[][] getIdArrays() {
return ids;
return this.ids;
}
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];
int[] vs = ids[i];
int[] vs = this.ids[i];
if (vs == null) {
vs = ids[i] = new int[4096];
count[i]++;
vs = this.ids[i] = new int[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] = -1;
return;
case 10:
@ -142,7 +143,7 @@ public class BukkitChunk_1_9 extends FaweChunk<Chunk> {
case 124:
case 138:
case 169:
relight[i]++;
this.relight[i]++;
case 2:
case 4:
case 13:
@ -205,7 +206,7 @@ public class BukkitChunk_1_9 extends FaweChunk<Chunk> {
case 130:
case 76:
case 62:
relight[i]++;
this.relight[i]++;
case 54:
case 146:
case 61:
@ -222,13 +223,13 @@ public class BukkitChunk_1_9 extends FaweChunk<Chunk> {
}
@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();
}

View File

@ -50,7 +50,7 @@ public class BukkitQueue_1_9 extends BukkitQueue_0 {
private final RefClass classChunk = getRefClass("{nms}.Chunk");
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 final RefClass classBlock = getRefClass("{nms}.Block");
@ -72,63 +72,63 @@ public class BukkitQueue_1_9 extends BukkitQueue_0 {
private final RefField tileEntityListTick;
public BukkitQueue_1_9() throws NoSuchMethodException, RuntimeException {
methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
methodInitLighting = classChunk.getMethod("initLighting");
MapChunk = classMapChunk.getConstructor(classChunk.getRealClass(), boolean.class, int.class);
classBlockPositionConstructor = classBlockPosition.getConstructor(int.class, int.class, int.class);
methodW = classWorld.getMethod("w", classBlockPosition.getRealClass());
fieldSections = classChunk.getField("sections");
fieldWorld = classChunk.getField("world");
methodGetByCombinedId = classBlock.getMethod("getByCombinedId", int.class);
methodGetBlocks = classChunkSection.getMethod("getBlocks");
methodSetType = classChunkSection.getMethod("setType", int.class, int.class, int.class, classIBlockData.getRealClass());
methodAreNeighborsLoaded = classChunk.getMethod("areNeighborsLoaded", int.class);
classChunkSectionConstructor = classChunkSection.getConstructor(int.class, boolean.class, char[].class);
air = methodGetByCombinedId.call(0);
this.tileEntityListTick = classWorld.getField("tileEntityListTick");
this.methodGetWorld = classChunk.getMethod("getWorld");
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.classBlockPositionConstructor = this.classBlockPosition.getConstructor(int.class, int.class, int.class);
this.methodW = this.classWorld.getMethod("w", this.classBlockPosition.getRealClass());
this.fieldSections = this.classChunk.getField("sections");
this.fieldWorld = this.classChunk.getField("world");
this.methodGetByCombinedId = this.classBlock.getMethod("getByCombinedId", int.class);
this.methodGetBlocks = this.classChunkSection.getMethod("getBlocks");
this.methodSetType = this.classChunkSection.getMethod("setType", int.class, int.class, int.class, this.classIBlockData.getRealClass());
this.methodAreNeighborsLoaded = this.classChunk.getMethod("areNeighborsLoaded", int.class);
this.classChunkSectionConstructor = this.classChunkSection.getConstructor(int.class, boolean.class, char[].class);
this.air = this.methodGetByCombinedId.call(0);
this.tileEntityListTick = this.classWorld.getField("tileEntityListTick");
this.methodGetWorld = this.classChunk.getMethod("getWorld");
}
@Override
public Collection<FaweChunk<Chunk>> sendChunk(final Collection<FaweChunk<Chunk>> fcs) {
for (FaweChunk<Chunk> fc : fcs) {
Chunk chunk = fc.getChunk();
ChunkLoc loc = fc.getChunkLoc();
for (final FaweChunk<Chunk> fc : fcs) {
final Chunk chunk = fc.getChunk();
final ChunkLoc loc = fc.getChunkLoc();
chunk.getWorld().refreshChunk(loc.x, loc.z);
}
return new ArrayList<>();
}
@Override
public boolean fixLighting(final FaweChunk<?> pc, boolean fixAll) {
public boolean fixLighting(final FaweChunk<?> pc, final boolean fixAll) {
try {
BukkitChunk_1_9 bc = (BukkitChunk_1_9) pc;
final BukkitChunk_1_9 bc = (BukkitChunk_1_9) pc;
final Chunk chunk = bc.getChunk();
if (!chunk.isLoaded()) {
chunk.load(false);
}
// Initialize lighting
final Object c = methodGetHandleChunk.of(chunk).call();
final Object c = this.methodGetHandleChunk.of(chunk).call();
methodInitLighting.of(c).call();
this.methodInitLighting.of(c).call();
if ((bc.getTotalRelight() == 0 && !fixAll)) {
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 = methodW.of(w);
final RefExecutor relight = this.methodW.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 int[] array = bc.getIdArray(j);
@ -169,10 +169,10 @@ public class BukkitQueue_1_9 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(bc.getIdArrays(), x, y, z)) {
if (this.isSurrounded(bc.getIdArrays(), 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);
}
}
@ -184,46 +184,46 @@ public class BukkitQueue_1_9 extends BukkitQueue_0 {
return false;
}
public boolean isSurrounded(int[][] 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 int[][] 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) {
Material material = Material.getMaterial(i);
return material != null && Material.getMaterial(i).isOccluding();
final Material material = Material.getMaterial(i);
return (material != null) && Material.getMaterial(i).isOccluding();
}
return false;
}
public int getId(int[][] sections, int x, int y, int z) {
if (x < 0 || x > 15 || z < 0 || z > 15) {
public int getId(final int[][] 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];
int[] section = sections[i];
final int i = FaweCache.CACHE_I[y][x][z];
final int[] section = sections[i];
if (section == null) {
return 0;
}
int j = FaweCache.CACHE_J[y][x][z];
final int j = FaweCache.CACHE_J[y][x][z];
return section[j];
}
public Object getBlocks(final Object obj) {
return methodGetBlocks.of(obj).call();
return this.methodGetBlocks.of(obj).call();
}
@Override
public boolean setComponents(final FaweChunk<Chunk> pc) {
final BukkitChunk_1_9 fs = (BukkitChunk_1_9) pc;
Chunk chunk = pc.getChunk();
final Chunk chunk = pc.getChunk();
final World world = chunk.getWorld();
chunk.load(true);
try {
@ -232,7 +232,7 @@ public class BukkitQueue_1_9 extends BukkitQueue_0 {
// 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);
@ -296,18 +296,18 @@ public class BukkitQueue_1_9 extends BukkitQueue_0 {
}
Object section = sections[j];
if ((section == null) || (fs.getCount(j) >= 4096)) {
char[] array = new char[4096];
final char[] array = new char[4096];
for (int i = 0; i < newArray.length; i++) {
int combined = newArray[i];
int id = combined & 4095;
int data = combined >> 12;
final int combined = newArray[i];
final int id = combined & 4095;
final int data = combined >> 12;
array[i] = (char) ((id << 4) + data);
}
section = sections[j] = newChunkSection(j << 4, flag, array);
section = sections[j] = this.newChunkSection(j << 4, flag, array);
continue;
}
final Object currentArray = getBlocks(section);
RefExecutor setType = methodSetType.of(section);
this.getBlocks(section);
final RefExecutor setType = this.methodSetType.of(section);
boolean fill = true;
for (int k = 0; k < newArray.length; k++) {
final int n = newArray[k];
@ -317,18 +317,17 @@ public class BukkitQueue_1_9 extends BukkitQueue_0 {
continue;
case -1: {
fill = false;
int x = FaweCache.CACHE_X[j][k];
int y = FaweCache.CACHE_Y[j][k];
int z = FaweCache.CACHE_Z[j][k];
setType.call(x, y & 15, z, air);
final int x = FaweCache.CACHE_X[j][k];
final int y = FaweCache.CACHE_Y[j][k];
final int z = FaweCache.CACHE_Z[j][k];
setType.call(x, y & 15, z, this.air);
continue;
}
default: {
int x = FaweCache.CACHE_X[j][k];
int y = FaweCache.CACHE_Y[j][k];
int z = FaweCache.CACHE_Z[j][k];
int id = n;
Object iblock = methodGetByCombinedId.call(n);
final int x = FaweCache.CACHE_X[j][k];
final int y = FaweCache.CACHE_Y[j][k];
final int z = FaweCache.CACHE_Z[j][k];
final Object iblock = this.methodGetByCombinedId.call(n);
setType.call(x, y & 15, z, iblock);
continue;
}
@ -342,16 +341,16 @@ public class BukkitQueue_1_9 extends BukkitQueue_0 {
} catch (IllegalAccessException | IllegalArgumentException | NoSuchMethodException | SecurityException | InvocationTargetException | NoSuchFieldException e) {
e.printStackTrace();
}
int[][] biomes = fs.biomes;
Biome[] values = Biome.values();
final int[][] biomes = fs.biomes;
final Biome[] values = Biome.values();
if (biomes != null) {
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;
}
@ -362,7 +361,7 @@ public class BukkitQueue_1_9 extends BukkitQueue_0 {
TaskManager.runTaskLater(new Runnable() {
@Override
public void run() {
ChunkLoc loc = fs.getChunkLoc();
final ChunkLoc loc = fs.getChunkLoc();
world.refreshChunk(loc.x, loc.z);
}
}, 1);
@ -377,8 +376,8 @@ public class BukkitQueue_1_9 extends BukkitQueue_0 {
HashMap<String, HashMap<IntegerPair, Integer>> players = new HashMap<>();
for (final Player player : Bukkit.getOnlinePlayers()) {
// Clear history
FawePlayer<Object> fp = FawePlayer.wrap(player);
LocalSession s = fp.getSession();
final FawePlayer<Object> fp = FawePlayer.wrap(player);
final LocalSession s = fp.getSession();
if (s != null) {
s.clearHistory();
s.setClipboard(null);
@ -428,7 +427,7 @@ public class BukkitQueue_1_9 extends BukkitQueue_0 {
final boolean save = world.isAutoSave();
world.setAutoSave(false);
for (final Chunk chunk : world.getLoadedChunks()) {
unloadChunk(name, chunk);
this.unloadChunk(name, chunk);
}
world.setAutoSave(save);
continue;
@ -453,7 +452,7 @@ public class BukkitQueue_1_9 extends BukkitQueue_0 {
int free = MemUtil.calculateMemory();
if (free <= 1) {
for (final Chunk chunk : toUnload) {
unloadChunk(chunk.getWorld().getName(), chunk);
this.unloadChunk(chunk.getWorld().getName(), chunk);
}
} else if (free == Integer.MAX_VALUE) {
for (final Chunk chunk : toUnload) {
@ -484,7 +483,7 @@ public class BukkitQueue_1_9 extends BukkitQueue_0 {
for (final World world : Bukkit.getWorlds()) {
final String name = world.getName();
for (final Chunk chunk : world.getLoadedChunks()) {
unloadChunk(name, chunk);
this.unloadChunk(name, chunk);
}
}
System.gc();
@ -492,7 +491,7 @@ public class BukkitQueue_1_9 extends BukkitQueue_0 {
}
public Object newChunkSection(final int i, final boolean flag, final char[] ids) {
return classChunkSectionConstructor.create(i, flag, ids);
return this.classChunkSectionConstructor.create(i, flag, ids);
}
@Override
@ -501,8 +500,8 @@ public class BukkitQueue_1_9 extends BukkitQueue_0 {
}
public boolean unloadChunk(final String world, final Chunk chunk) {
final Object c = methodGetHandleChunk.of(chunk).call();
mustSave.of(c).set(false);
final Object c = this.methodGetHandleChunk.of(chunk).call();
this.mustSave.of(c).set(false);
if (chunk.isLoaded()) {
chunk.unload(false, false);
}

View File

@ -21,28 +21,28 @@ public class FixLighting extends FaweCommand {
if (player == null) {
return false;
}
FaweLocation loc = player.getLocation();
Region selection = player.getSelection();
final FaweLocation loc = player.getLocation();
final Region selection = player.getSelection();
if (selection == null) {
FaweAPI.fixLighting(new ChunkLoc(loc.world, loc.x >> 4, loc.z >> 4), Settings.FIX_ALL_LIGHTING);
BBC.FIX_LIGHTING_CHUNK.send(player);
return true;
}
int cx = loc.x >> 4;
int cz = loc.z >> 4;
Vector bot = selection.getMinimumPoint();
Vector top = selection.getMaximumPoint();
final int cx = loc.x >> 4;
final int cz = loc.z >> 4;
final Vector bot = selection.getMinimumPoint();
final Vector top = selection.getMaximumPoint();
int minX = Math.max(cx - 8, bot.getBlockX() >> 4);
int minZ = Math.max(cz - 8, bot.getBlockZ() >> 4);
final int minX = Math.max(cx - 8, bot.getBlockX() >> 4);
final int minZ = Math.max(cz - 8, bot.getBlockZ() >> 4);
int maxX = Math.min(cx + 8, top.getBlockX() >> 4);
int maxZ = Math.min(cz + 8, top.getBlockZ() >> 4);
final int maxX = Math.min(cx + 8, top.getBlockX() >> 4);
final int maxZ = Math.min(cz + 8, top.getBlockZ() >> 4);
int count = 0;
for (int x = minX; x <= maxX; x++) {
for (int z = minZ; z <= maxZ; z++) {
ChunkLoc cl = new ChunkLoc(loc.world, x, z);
final ChunkLoc cl = new ChunkLoc(loc.world, x, z);
FaweAPI.fixLighting(cl, Settings.FIX_ALL_LIGHTING);
count++;
}

View File

@ -26,7 +26,7 @@ public class Stream extends FaweCommand {
if (!args[0].endsWith(".schematic")) {
args[0] += ".schematic";
}
File file = Fawe.get().getWorldEdit().getWorkingDirectoryFile(Fawe.get().getWorldEdit().getConfiguration().saveDir + File.separator + args[0]);
final File file = Fawe.get().getWorldEdit().getWorkingDirectoryFile(Fawe.get().getWorldEdit().getConfiguration().saveDir + File.separator + args[0]);
if (!file.exists()) {
BBC.SCHEMATIC_NOT_FOUND.send(player, args);
return false;

View File

@ -15,7 +15,7 @@ public class Wea extends FaweCommand {
if (player == null) {
return false;
}
if (toggle(player)) {
if (this.toggle(player)) {
BBC.WORLDEDIT_BYPASSED.send(player);
} else {
BBC.WORLDEDIT_RESTRICTED.send(player);
@ -23,7 +23,7 @@ public class Wea extends FaweCommand {
return true;
}
private boolean toggle(FawePlayer player) {
private boolean toggle(final FawePlayer player) {
if (player.hasPermission("fawe.bypass")) {
player.setPermission("fawe.bypass", false);
return false;

View File

@ -16,7 +16,7 @@ public class WorldEditRegion extends FaweCommand {
if (player == null) {
return false;
}
RegionWrapper region = player.getLargestRegion();
final RegionWrapper region = player.getLargestRegion();
if (region == null) {
BBC.NO_REGION.send(player);
return false;
@ -25,14 +25,4 @@ public class WorldEditRegion extends FaweCommand {
BBC.SET_REGION.send(player);
return true;
}
private boolean toggle(FawePlayer player) {
if (player.hasPermission("fawe.bypass")) {
player.setPermission("fawe.bypass", false);
return false;
} else {
player.setPermission("fawe.bypass", true);
return true;
}
}
}

View File

@ -82,8 +82,8 @@ public enum BBC {
*/
BBC(final String d, final boolean prefix, final String cat) {
this.d = d;
if (s == null) {
s = d;
if (this.s == null) {
this.s = d;
}
this.prefix = prefix;
this.cat = cat.toLowerCase();
@ -99,7 +99,7 @@ public enum BBC {
}
public String format(final Object... args) {
String m = s;
String m = this.s;
for (int i = args.length - 1; i >= 0; i--) {
if (args[i] == null) {
continue;
@ -180,11 +180,11 @@ public enum BBC {
}
public String s() {
return s;
return this.s;
}
public boolean usePrefix() {
return prefix;
return this.prefix;
}
/**
@ -193,18 +193,18 @@ public enum BBC {
* @see org.bukkit.ChatColor#translateAlternateColorCodes(char, String)
*/
public String translated() {
return ChatColor.translateAlternateColorCodes('&', s());
return ChatColor.translateAlternateColorCodes('&', this.s());
}
public String getCat() {
return cat;
return this.cat;
}
public void send(final FawePlayer<?> player, final Object... args) {
if (player == null) {
Fawe.debug(format(args));
Fawe.debug(this.format(args));
} else {
player.sendMessage(format(args));
player.sendMessage(this.format(args));
}
}

View File

@ -62,7 +62,6 @@ public class Settings {
WE_BLACKLIST = config.getStringList("command-blacklist");
ENABLE_HARD_LIMIT = config.getBoolean("crash-mitigation");
try {
config.save(file);
} catch (final IOException e) {

View File

@ -15,10 +15,10 @@ public class BlocksHubHook {
public BlocksHubHook() {
this.hub = (BlocksHub) Bukkit.getServer().getPluginManager().getPlugin("BlocksHub");
this.api = hub.getApi();
this.api = this.hub.getApi();
}
public Extent getLoggingExtent(Extent parent, ChangeSet set, FawePlayer<?> player) {
return new LoggingExtent(parent, set, (FawePlayer<Player>) player, api);
public Extent getLoggingExtent(final Extent parent, final ChangeSet set, final FawePlayer<?> player) {
return new LoggingExtent(parent, set, (FawePlayer<Player>) player, this.api);
}
}

View File

@ -47,14 +47,14 @@ public class LoggingExtent extends AbstractDelegateExtent {
* @param player
* @param thread
*/
public LoggingExtent(final Extent extent, final ChangeSet changeSet, FawePlayer<Player> player, IBlocksHubApi api) {
public LoggingExtent(final Extent extent, final ChangeSet changeSet, final FawePlayer<Player> player, final IBlocksHubApi api) {
super(extent);
checkNotNull(changeSet);
this.changeSet = changeSet;
this.api = api;
this.playerName = player.getName();
this.world = player.parent.getWorld();
this.loc = new org.bukkit.Location(world, 0, 0, 0);
this.loc = new org.bukkit.Location(this.world, 0, 0, 0);
}
@Override
@ -62,9 +62,9 @@ public class LoggingExtent extends AbstractDelegateExtent {
if (super.setBlock(location, block)) {
BaseBlock previous;
try {
previous = getBlock(location);
previous = this.getBlock(location);
} catch (final Exception e) {
previous = getBlock(location);
previous = this.getBlock(location);
}
final int id_p = previous.getId();
final int id_b = block.getId();
@ -152,22 +152,22 @@ public class LoggingExtent extends AbstractDelegateExtent {
if (id_p == id_b) {
return false;
}
loc.setX(location.getX());
loc.setY(location.getY());
loc.setZ(location.getZ());
api.logBlock(playerName, world, loc, id_p, (byte) 0, id_b, (byte) 0);
this.loc.setX(location.getX());
this.loc.setY(location.getY());
this.loc.setZ(location.getZ());
this.api.logBlock(this.playerName, this.world, this.loc, id_p, (byte) 0, id_b, (byte) 0);
default:
int data_p = previous.getData();
int data_b = block.getData();
if (id_p == id_b && data_b == data_p) {
final int data_p = previous.getData();
final int data_b = block.getData();
if ((id_p == id_b) && (data_b == data_p)) {
return false;
}
loc.setX(location.getX());
loc.setY(location.getY());
loc.setZ(location.getZ());
api.logBlock(playerName, world, loc, id_p, (byte) data_p, id_b, (byte) data_b);
this.loc.setX(location.getX());
this.loc.setY(location.getY());
this.loc.setZ(location.getZ());
this.api.logBlock(this.playerName, this.world, this.loc, id_p, (byte) data_p, id_b, (byte) data_b);
}
changeSet.add(new BlockChange(location.toBlockVector(), previous, block));
this.changeSet.add(new BlockChange(location.toBlockVector(), previous, block));
return true;
}
return false;
@ -178,19 +178,19 @@ public class LoggingExtent extends AbstractDelegateExtent {
public Entity createEntity(final Location location, final BaseEntity state) {
final Entity entity = super.createEntity(location, state);
if (state != null) {
changeSet.add(new EntityCreate(location, state, entity));
this.changeSet.add(new EntityCreate(location, state, entity));
}
return entity;
}
@Override
public List<? extends Entity> getEntities() {
return wrapEntities(super.getEntities());
return this.wrapEntities(super.getEntities());
}
@Override
public List<? extends Entity> getEntities(final Region region) {
return wrapEntities(super.getEntities(region));
return this.wrapEntities(super.getEntities(region));
}
private List<? extends Entity> wrapEntities(final List<? extends Entity> entities) {
@ -210,26 +210,26 @@ public class LoggingExtent extends AbstractDelegateExtent {
@Override
public BaseEntity getState() {
return entity.getState();
return this.entity.getState();
}
@Override
public Location getLocation() {
return entity.getLocation();
return this.entity.getLocation();
}
@Override
public Extent getExtent() {
return entity.getExtent();
return this.entity.getExtent();
}
@Override
public boolean remove() {
final Location location = entity.getLocation();
final BaseEntity state = entity.getState();
final boolean success = entity.remove();
final Location location = this.entity.getLocation();
final BaseEntity state = this.entity.getState();
final boolean success = this.entity.remove();
if ((state != null) && success) {
changeSet.add(new EntityRemove(location, state));
LoggingExtent.this.changeSet.add(new EntityRemove(location, state));
}
return success;
}
@ -237,7 +237,7 @@ public class LoggingExtent extends AbstractDelegateExtent {
@Nullable
@Override
public <T> T getFacet(final Class<? extends T> cls) {
return entity.getFacet(cls);
return this.entity.getFacet(cls);
}
}
}

View File

@ -14,23 +14,23 @@ public class ChunkLoc {
@Override
public int hashCode() {
int result;
if (x >= 0) {
if (z >= 0) {
result = (x * x) + (3 * x) + (2 * x * z) + z + (z * z);
if (this.x >= 0) {
if (this.z >= 0) {
result = (this.x * this.x) + (3 * this.x) + (2 * this.x * this.z) + this.z + (this.z * this.z);
} else {
final int y1 = -z;
result = (x * x) + (3 * x) + (2 * x * y1) + y1 + (y1 * y1) + 1;
final int y1 = -this.z;
result = (this.x * this.x) + (3 * this.x) + (2 * this.x * y1) + y1 + (y1 * y1) + 1;
}
} else {
final int x1 = -x;
if (z >= 0) {
result = -((x1 * x1) + (3 * x1) + (2 * x1 * z) + z + (z * z));
final int x1 = -this.x;
if (this.z >= 0) {
result = -((x1 * x1) + (3 * x1) + (2 * x1 * this.z) + this.z + (this.z * this.z));
} else {
final int y1 = -z;
final int y1 = -this.z;
result = -((x1 * x1) + (3 * x1) + (2 * x1 * y1) + y1 + (y1 * y1) + 1);
}
}
result = (result * 31) + world.hashCode();
result = (result * 31) + this.world.hashCode();
return result;
}
@ -42,15 +42,15 @@ public class ChunkLoc {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
if (this.getClass() != obj.getClass()) {
return false;
}
final ChunkLoc other = (ChunkLoc) obj;
return ((x == other.x) && (z == other.z) && (world.equals(other.world)));
return ((this.x == other.x) && (this.z == other.z) && (this.world.equals(other.world)));
}
@Override
public String toString() {
return world + ":" + x + "," + z;
return this.world + ":" + this.x + "," + this.z;
}
}

View File

@ -17,8 +17,8 @@ public class EditSessionWrapper {
public int getHighestTerrainBlock(final int x, final int z, final int minY, final int maxY, final boolean naturalOnly) {
for (int y = maxY; y >= minY; --y) {
final Vector pt = new Vector(x, y, z);
final int id = session.getBlockType(pt);
final int data = session.getBlockData(pt);
final int id = this.session.getBlockType(pt);
final int data = this.session.getBlockData(pt);
if (naturalOnly ? BlockType.isNaturalTerrainBlock(id, data) : !BlockType.canPassThrough(id, data)) {
return y;
}
@ -26,7 +26,7 @@ public class EditSessionWrapper {
return minY;
}
public Extent getHistoryExtent(Extent parent, ChangeSet set, FawePlayer<?> player) {
public Extent getHistoryExtent(final Extent parent, final ChangeSet set, final FawePlayer<?> player) {
return new HistoryExtent(parent, set);
}
}

View File

@ -23,7 +23,7 @@ public class FastWorldEditExtent extends AbstractDelegateExtent {
private final String world;
private final Thread thread;
public FastWorldEditExtent(World world, Thread thread) {
public FastWorldEditExtent(final World world, final Thread thread) {
super(world);
this.thread = thread;
this.world = world.getName();
@ -41,11 +41,11 @@ public class FastWorldEditExtent extends AbstractDelegateExtent {
}
@Override
public BaseBiome getBiome(Vector2D position) {
if (!SetQueue.IMP.isChunkLoaded(world, position.getBlockX() >> 4, position.getBlockZ() >> 4)) {
public BaseBiome getBiome(final Vector2D position) {
if (!SetQueue.IMP.isChunkLoaded(this.world, position.getBlockX() >> 4, position.getBlockZ() >> 4)) {
return EditSession.nullBiome;
}
synchronized (thread) {
synchronized (this.thread) {
return super.getBiome(position);
}
}
@ -54,55 +54,55 @@ public class FastWorldEditExtent extends AbstractDelegateExtent {
private BlockVector lastVector;
@Override
public BaseBlock getLazyBlock(Vector position) {
if (lastBlock != null && lastVector.equals(position.toBlockVector())) {
return lastBlock;
public BaseBlock getLazyBlock(final Vector position) {
if ((this.lastBlock != null) && this.lastVector.equals(position.toBlockVector())) {
return this.lastBlock;
}
if (!SetQueue.IMP.isChunkLoaded(world, position.getBlockX() >> 4, position.getBlockZ() >> 4)) {
if (!SetQueue.IMP.isChunkLoaded(this.world, position.getBlockX() >> 4, position.getBlockZ() >> 4)) {
try {
lastVector = position.toBlockVector();
return lastBlock = super.getBlock(position);
} catch (Throwable e) {
this.lastVector = position.toBlockVector();
return this.lastBlock = super.getBlock(position);
} catch (final Throwable e) {
return EditSession.nullBlock;
}
}
synchronized (thread) {
lastVector = position.toBlockVector();
return lastBlock = super.getBlock(position);
synchronized (this.thread) {
this.lastVector = position.toBlockVector();
return this.lastBlock = super.getBlock(position);
}
}
@Override
public List<? extends Entity> getEntities() {
synchronized (thread) {
synchronized (this.thread) {
return super.getEntities();
}
}
@Override
public List<? extends Entity> getEntities(Region region) {
synchronized (thread) {
public List<? extends Entity> getEntities(final Region region) {
synchronized (this.thread) {
return super.getEntities(region);
}
}
@Override
public BaseBlock getBlock(Vector position) {
return getLazyBlock(position);
public BaseBlock getBlock(final Vector position) {
return this.getLazyBlock(position);
}
@Override
public boolean setBiome(Vector2D position, BaseBiome biome) {
SetQueue.IMP.setBiome(world, position.getBlockX(), position.getBlockZ(), biome);
public boolean setBiome(final Vector2D position, final BaseBiome biome) {
SetQueue.IMP.setBiome(this.world, position.getBlockX(), position.getBlockZ(), biome);
return true;
}
@Override
public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException {
short id = (short) block.getId();
int x = location.getBlockX();
int y = location.getBlockY();
int z = location.getBlockZ();
public boolean setBlock(final Vector location, final BaseBlock block) throws WorldEditException {
final short id = (short) block.getId();
final int x = location.getBlockX();
final int y = location.getBlockY();
final int z = location.getBlockZ();
switch (id) {
case 0:
case 2:
@ -183,11 +183,11 @@ public class FastWorldEditExtent extends AbstractDelegateExtent {
case 190:
case 191:
case 192: {
SetQueue.IMP.setBlock(world, x, y, z, id);
SetQueue.IMP.setBlock(this.world, x, y, z, id);
return true;
}
default: {
SetQueue.IMP.setBlock(world, x, y, z, id, (byte) block.getData());
SetQueue.IMP.setBlock(this.world, x, y, z, id, (byte) block.getData());
return true;
}
}

View File

@ -21,24 +21,24 @@ public class FaweChangeSet implements ChangeSet {
// int x = pos.getBlockX();
// int y = pos.getBlockY();
// int z = pos.getBlockZ();
changes.add(bc);
this.changes.add(bc);
} else {
changes.add(change);
this.changes.add(change);
}
}
@Override
public Iterator<Change> backwardIterator() {
return changes.descendingIterator();
return this.changes.descendingIterator();
}
@Override
public Iterator<Change> forwardIterator() {
return changes.iterator();
return this.changes.iterator();
}
@Override
public int size() {
return changes.size();
return this.changes.size();
}
}

View File

@ -24,7 +24,7 @@ public abstract class FaweChunk<T> {
}
public void addToQueue() {
if (chunk == null) {
if (this.chunk == null) {
throw new IllegalArgumentException("Chunk location cannot be null!");
}
SetQueue.IMP.queue.setChunk(this);
@ -34,11 +34,11 @@ public abstract class FaweChunk<T> {
SetQueue.IMP.queue.fixLighting(this, Settings.FIX_ALL_LIGHTING);
}
public void fill(int id, byte data) {
public void fill(final int id, final byte data) {
for (int x = 0; x < 16; x++) {
for (int y = 0; y < 256; y++) {
for (int z = 0; z < 16; z++) {
setBlock(x, y, z, id, data);
this.setBlock(x, y, z, id, data);
}
}
}
@ -48,18 +48,18 @@ public abstract class FaweChunk<T> {
public abstract void setBlock(final int x, final int y, final int z, final int id, final byte data);
public abstract void setBiome(int x, int z, BaseBiome biome);
public abstract void setBiome(final int x, final int z, final BaseBiome biome);
@Override
public int hashCode() {
return chunk.hashCode();
return this.chunk.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof FaweChunk)) {
public boolean equals(final Object obj) {
if ((obj == null) || !(obj instanceof FaweChunk)) {
return false;
}
return chunk.equals(((FaweChunk) obj).chunk);
return this.chunk.equals(((FaweChunk) obj).chunk);
}
}

View File

@ -8,7 +8,7 @@ public abstract class FaweCommand<T> {
}
public String getPerm() {
return perm;
return this.perm;
}
public abstract boolean execute(final FawePlayer<T> player, final String... args);

View File

@ -6,13 +6,12 @@ import com.boydti.fawe.util.SetQueue;
*/
public class FaweLocation {
public final int x;
public final int y;
public final int z;
public final String world;
public FaweLocation(String world, int x, int y, int z) {
public FaweLocation(final String world, final int x, final int y, final int z) {
this.world = world;
this.x = x;
this.y = y;
@ -27,19 +26,19 @@ public class FaweLocation {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
if (this.getClass() != obj.getClass()) {
return false;
}
final FaweLocation other = (FaweLocation) obj;
return ((x == other.x) && (y == other.y) && (z == other.z) && (world.equals(other.world)));
return ((this.x == other.x) && (this.y == other.y) && (this.z == other.z) && (this.world.equals(other.world)));
}
@Override
public int hashCode() {
return x << 8 + z << 4 + y;
return this.x << (8 + this.z) << (4 + this.y);
}
public void setBlockAsync(short id, byte data) {
SetQueue.IMP.setBlock(world, x, y, z, id, data);
public void setBlockAsync(final short id, final byte data) {
SetQueue.IMP.setBlock(this.world, this.x, this.y, this.z, id, data);
}
}

View File

@ -43,31 +43,31 @@ public abstract class FawePlayer<T> {
public Region getSelection() {
try {
return getSession().getSelection(getPlayer().getWorld());
} catch (IncompleteRegionException e) {
return this.getSession().getSelection(this.getPlayer().getWorld());
} catch (final IncompleteRegionException e) {
return null;
}
}
public LocalSession getSession() {
return session != null ? session : Fawe.get().getWorldEdit().getSession(getPlayer());
return this.session != null ? this.session : Fawe.get().getWorldEdit().getSession(this.getPlayer());
}
public HashSet<RegionWrapper> getCurrentRegions() {
return WEManager.IMP.getMask(this);
}
public void setSelection(RegionWrapper region) {
Player player = getPlayer();
RegionSelector selector = new CuboidRegionSelector(player.getWorld(), region.getBottomVector(), region.getTopVector());
getSession().setRegionSelector(player.getWorld(), selector);
public void setSelection(final RegionWrapper region) {
final Player player = this.getPlayer();
final RegionSelector selector = new CuboidRegionSelector(player.getWorld(), region.getBottomVector(), region.getTopVector());
this.getSession().setRegionSelector(player.getWorld(), selector);
}
public RegionWrapper getLargestRegion() {
int area = 0;
RegionWrapper max = null;
for (RegionWrapper region : getCurrentRegions()) {
int tmp = (region.maxX - region.minX) * (region.maxZ - region.minZ);
for (final RegionWrapper region : this.getCurrentRegions()) {
final int tmp = (region.maxX - region.minX) * (region.maxZ - region.minZ);
if (tmp > area) {
area = tmp;
max = region;
@ -78,10 +78,10 @@ public abstract class FawePlayer<T> {
@Override
public String toString() {
return getName();
return this.getName();
}
public boolean hasWorldEditBypass() {
return hasPermission("fawe.bypass");
return this.hasPermission("fawe.bypass");
}
}

View File

@ -46,9 +46,9 @@ public class HistoryExtent extends AbstractDelegateExtent {
if (super.setBlock(location, block)) {
BaseBlock previous;
try {
previous = getBlock(location);
previous = this.getBlock(location);
} catch (final Exception e) {
previous = getBlock(location);
previous = this.getBlock(location);
}
final int id_p = previous.getId();
final int id_b = block.getId();
@ -141,7 +141,7 @@ public class HistoryExtent extends AbstractDelegateExtent {
}
}
}
changeSet.add(new BlockChange(location.toBlockVector(), previous, block));
this.changeSet.add(new BlockChange(location.toBlockVector(), previous, block));
return true;
}
return false;
@ -151,20 +151,20 @@ public class HistoryExtent extends AbstractDelegateExtent {
@Override
public Entity createEntity(final Location location, final BaseEntity state) {
final Entity entity = super.createEntity(location, state);
if (state != null && entity != null) {
changeSet.add(new EntityCreate(location, state, entity));
if ((state != null) && (entity != null)) {
this.changeSet.add(new EntityCreate(location, state, entity));
}
return entity;
}
@Override
public List<? extends Entity> getEntities() {
return wrapEntities(super.getEntities());
return this.wrapEntities(super.getEntities());
}
@Override
public List<? extends Entity> getEntities(final Region region) {
return wrapEntities(super.getEntities(region));
return this.wrapEntities(super.getEntities(region));
}
private List<? extends Entity> wrapEntities(final List<? extends Entity> entities) {
@ -184,26 +184,26 @@ public class HistoryExtent extends AbstractDelegateExtent {
@Override
public BaseEntity getState() {
return entity.getState();
return this.entity.getState();
}
@Override
public Location getLocation() {
return entity.getLocation();
return this.entity.getLocation();
}
@Override
public Extent getExtent() {
return entity.getExtent();
return this.entity.getExtent();
}
@Override
public boolean remove() {
final Location location = entity.getLocation();
final BaseEntity state = entity.getState();
final boolean success = entity.remove();
final Location location = this.entity.getLocation();
final BaseEntity state = this.entity.getState();
final boolean success = this.entity.remove();
if ((state != null) && success) {
changeSet.add(new EntityRemove(location, state));
HistoryExtent.this.changeSet.add(new EntityRemove(location, state));
}
return success;
}
@ -211,7 +211,7 @@ public class HistoryExtent extends AbstractDelegateExtent {
@Nullable
@Override
public <T> T getFacet(final Class<? extends T> cls) {
return entity.getFacet(cls);
return this.entity.getFacet(cls);
}
}
}

View File

@ -13,27 +13,27 @@ public class IntegerPair {
@Override
public int hashCode() {
if (hash == 0) {
if (this.hash == 0) {
long val = 0;
if (x >= 0) {
if (z >= 0) {
val = (x * x) + (3 * x) + (2 * x * z) + z + (z * z);
if (this.x >= 0) {
if (this.z >= 0) {
val = (this.x * this.x) + (3 * this.x) + (2 * this.x * this.z) + this.z + (this.z * this.z);
} else {
final int z1 = -z;
val = (x * x) + (3 * x) + (2 * x * z1) + z1 + (z1 * z1) + 1;
final int z1 = -this.z;
val = (this.x * this.x) + (3 * this.x) + (2 * this.x * z1) + z1 + (z1 * z1) + 1;
}
} else {
final int x1 = -x;
if (z >= 0) {
val = -((x1 * x1) + (3 * x1) + (2 * x1 * z) + z + (z * z));
final int x1 = -this.x;
if (this.z >= 0) {
val = -((x1 * x1) + (3 * x1) + (2 * x1 * this.z) + this.z + (this.z * this.z));
} else {
final int z1 = -z;
final int z1 = -this.z;
val = -((x1 * x1) + (3 * x1) + (2 * x1 * z1) + z1 + (z1 * z1) + 1);
}
}
hash = (int) (val % Integer.MAX_VALUE);
this.hash = (int) (val % Integer.MAX_VALUE);
}
return hash;
return this.hash;
}
@Override
@ -41,10 +41,10 @@ public class IntegerPair {
if (this == obj) {
return true;
}
if ((obj == null) || (hashCode() != obj.hashCode()) || (getClass() != obj.getClass())) {
if ((obj == null) || (this.hashCode() != obj.hashCode()) || (this.getClass() != obj.getClass())) {
return false;
}
final IntegerPair other = (IntegerPair) obj;
return ((x == other.x) && (z == other.z));
return ((this.x == other.x) && (this.z == other.z));
}
}

View File

@ -39,7 +39,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
private final HashSet<RegionWrapper> mask;
private final Thread thread;
public ProcessedWEExtent(World world, Thread thread, FawePlayer<?> player, HashSet<RegionWrapper> mask, int max) {
public ProcessedWEExtent(final World world, final Thread thread, final FawePlayer<?> player, final HashSet<RegionWrapper> mask, final int max) {
super(world);
this.user = player;
this.world = world.getName();
@ -48,25 +48,25 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
this.thread = thread;
}
public void setMax(int max) {
public void setMax(final int max) {
this.max = max != -1 ? max : Integer.MAX_VALUE;
}
public void setParent(Extent parent) {
public void setParent(final Extent parent) {
this.parent = parent;
}
@Override
public Entity createEntity(final Location location, final BaseEntity entity) {
if (Eblocked) {
if (this.Eblocked) {
return null;
}
Ecount++;
if (Ecount > Settings.MAX_ENTITIES) {
Eblocked = true;
MainUtil.sendAdmin(BBC.WORLDEDIT_DANGEROUS_WORLDEDIT.format(world + ": " + location.getBlockX() + "," + location.getBlockY() + "," + location.getBlockZ(), user));
this.Ecount++;
if (this.Ecount > Settings.MAX_ENTITIES) {
this.Eblocked = true;
MainUtil.sendAdmin(BBC.WORLDEDIT_DANGEROUS_WORLDEDIT.format(this.world + ": " + location.getBlockX() + "," + location.getBlockY() + "," + location.getBlockZ(), this.user));
}
if (WEManager.IMP.maskContains(mask, location.getBlockX(), location.getBlockZ())) {
if (WEManager.IMP.maskContains(this.mask, location.getBlockX(), location.getBlockZ())) {
TaskManager.IMP.task(new Runnable() {
@Override
public void run() {
@ -78,11 +78,11 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
}
@Override
public BaseBiome getBiome(Vector2D position) {
if (!SetQueue.IMP.isChunkLoaded(world, position.getBlockX() >> 4, position.getBlockZ() >> 4)) {
public BaseBiome getBiome(final Vector2D position) {
if (!SetQueue.IMP.isChunkLoaded(this.world, position.getBlockX() >> 4, position.getBlockZ() >> 4)) {
return EditSession.nullBiome;
}
synchronized (thread) {
synchronized (this.thread) {
return super.getBiome(position);
}
}
@ -91,41 +91,41 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
private BlockVector lastVector;
@Override
public BaseBlock getLazyBlock(Vector position) {
if (lastBlock != null && lastVector.equals(position.toBlockVector())) {
return lastBlock;
public BaseBlock getLazyBlock(final Vector position) {
if ((this.lastBlock != null) && this.lastVector.equals(position.toBlockVector())) {
return this.lastBlock;
}
if (!SetQueue.IMP.isChunkLoaded(world, position.getBlockX() >> 4, position.getBlockZ() >> 4)) {
if (!SetQueue.IMP.isChunkLoaded(this.world, position.getBlockX() >> 4, position.getBlockZ() >> 4)) {
try {
lastVector = position.toBlockVector();
return lastBlock = super.getBlock(position);
} catch (Throwable e) {
this.lastVector = position.toBlockVector();
return this.lastBlock = super.getBlock(position);
} catch (final Throwable e) {
return EditSession.nullBlock;
}
}
synchronized (thread) {
lastVector = position.toBlockVector();
return lastBlock = super.getLazyBlock(position);
synchronized (this.thread) {
this.lastVector = position.toBlockVector();
return this.lastBlock = super.getLazyBlock(position);
}
}
@Override
public List<? extends Entity> getEntities() {
synchronized (thread) {
synchronized (this.thread) {
return super.getEntities();
}
}
@Override
public List<? extends Entity> getEntities(Region region) {
synchronized (thread) {
public List<? extends Entity> getEntities(final Region region) {
synchronized (this.thread) {
return super.getEntities(region);
}
}
@Override
public BaseBlock getBlock(Vector position) {
return getLazyBlock(position);
public BaseBlock getBlock(final Vector position) {
return this.getLazyBlock(position);
}
@Override
@ -168,25 +168,25 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
case 33:
case 151:
case 178: {
if (BSblocked) {
if (this.BSblocked) {
return false;
}
BScount++;
if (BScount > Settings.MAX_BLOCKSTATES) {
BSblocked = true;
MainUtil.sendAdmin(BBC.WORLDEDIT_DANGEROUS_WORLDEDIT.format(world + ": " + location.getBlockX() + "," + location.getBlockY() + "," + location.getBlockZ(), user));
this.BScount++;
if (this.BScount > Settings.MAX_BLOCKSTATES) {
this.BSblocked = true;
MainUtil.sendAdmin(BBC.WORLDEDIT_DANGEROUS_WORLDEDIT.format(this.world + ": " + location.getBlockX() + "," + location.getBlockY() + "," + location.getBlockZ(), this.user));
}
final int x = location.getBlockX();
final int z = location.getBlockZ();
if (WEManager.IMP.maskContains(mask, x, z)) {
if (count++ > max) {
if (parent != null) {
WEManager.IMP.cancelEdit(parent);
parent = null;
if (WEManager.IMP.maskContains(this.mask, x, z)) {
if (this.count++ > this.max) {
if (this.parent != null) {
WEManager.IMP.cancelEdit(this.parent);
this.parent = null;
}
return false;
}
SetQueue.IMP.setBlock(world, x, location.getBlockY(), z, id, (byte) block.getData());
SetQueue.IMP.setBlock(this.world, x, location.getBlockY(), z, id, (byte) block.getData());
}
break;
}
@ -194,10 +194,10 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
final int x = location.getBlockX();
final int y = location.getBlockY();
final int z = location.getBlockZ();
if (WEManager.IMP.maskContains(mask, location.getBlockX(), location.getBlockZ())) {
if (count++ > max) {
WEManager.IMP.cancelEdit(parent);
parent = null;
if (WEManager.IMP.maskContains(this.mask, location.getBlockX(), location.getBlockZ())) {
if (this.count++ > this.max) {
WEManager.IMP.cancelEdit(this.parent);
this.parent = null;
return false;
}
switch (id) {
@ -281,11 +281,11 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
case 190:
case 191:
case 192: {
SetQueue.IMP.setBlock(world, x, y, z, id);
SetQueue.IMP.setBlock(this.world, x, y, z, id);
break;
}
default: {
SetQueue.IMP.setBlock(world, x, y, z, id, (byte) block.getData());
SetQueue.IMP.setBlock(this.world, x, y, z, id, (byte) block.getData());
break;
}
}
@ -299,8 +299,8 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
@Override
public boolean setBiome(final Vector2D position, final BaseBiome biome) {
if (WEManager.IMP.maskContains(mask, position.getBlockX(), position.getBlockZ())) {
SetQueue.IMP.setBiome(world, position.getBlockX(), position.getBlockZ(), biome);
if (WEManager.IMP.maskContains(this.mask, position.getBlockX(), position.getBlockZ())) {
SetQueue.IMP.setBiome(this.world, position.getBlockX(), position.getBlockZ(), biome);
}
return false;
}

View File

@ -7,7 +7,7 @@ public class PseudoRandom {
private long state;
public PseudoRandom() {
state = System.nanoTime();
this.state = System.nanoTime();
}
public PseudoRandom(final long state) {
@ -15,8 +15,8 @@ public class PseudoRandom {
}
public long nextLong() {
final long a = state;
state = xorShift64(a);
final long a = this.state;
this.state = this.xorShift64(a);
return a;
}
@ -31,7 +31,7 @@ public class PseudoRandom {
if (n == 1) {
return 0;
}
final long r = ((nextLong() >>> 32) * n) >> 32;
final long r = ((this.nextLong() >>> 32) * n) >> 32;
return (int) r;
}
}

View File

@ -15,7 +15,7 @@ public class RegionWrapper {
this.minZ = minZ;
}
public RegionWrapper(Vector pos1, Vector pos2) {
public RegionWrapper(final Vector pos1, final Vector pos2) {
this.minX = Math.min(pos1.getBlockX(), pos2.getBlockX());
this.minZ = Math.min(pos1.getBlockZ(), pos2.getBlockZ());
this.maxX = Math.max(pos1.getBlockX(), pos2.getBlockX());
@ -23,19 +23,19 @@ public class RegionWrapper {
}
public boolean isIn(final int x, final int z) {
return ((x >= minX) && (x <= maxX) && (z >= minZ) && (z <= maxZ));
return ((x >= this.minX) && (x <= this.maxX) && (z >= this.minZ) && (z <= this.maxZ));
}
@Override
public String toString() {
return minX + "," + minZ + "->" + maxX + "," + maxZ;
return this.minX + "," + this.minZ + "->" + this.maxX + "," + this.maxZ;
}
public Vector getBottomVector() {
return new Vector(minX, 1, minZ);
return new Vector(this.minX, 1, this.minZ);
}
public Vector getTopVector() {
return new Vector(maxX, 255, maxZ);
return new Vector(this.maxX, 255, this.maxZ);
}
}

View File

@ -6,7 +6,7 @@ import com.boydti.fawe.object.FawePlayer;
public abstract class FaweMaskManager<T> {
private final String key;
public FaweMaskManager(String plugin) {
public FaweMaskManager(final String plugin) {
this.key = plugin.toLowerCase();
}

View File

@ -11,13 +11,13 @@ public abstract class FaweQueue {
public abstract boolean setBiome(final String world, final int x, final int z, final BaseBiome biome);
public abstract FaweChunk<?> getChunk(ChunkLoc wrap);
public abstract FaweChunk<?> getChunk(final ChunkLoc wrap);
public abstract void setChunk(FaweChunk<?> chunk);
public abstract void setChunk(final FaweChunk<?> chunk);
public abstract boolean fixLighting(FaweChunk<?> chunk, boolean fixAll);
public abstract boolean fixLighting(final FaweChunk<?> chunk, final boolean fixAll);
public abstract boolean isChunkLoaded(String world, int x, int z);
public abstract boolean isChunkLoaded(final String world, final int x, final int z);
/**
* Gets the FaweChunk and sets the requested blocks

View File

@ -12,12 +12,12 @@ public enum Perm {
public String cat;
Perm(final String perm, final String cat) {
s = perm;
this.s = perm;
this.cat = cat;
}
public boolean has(final FawePlayer<?> player) {
return hasPermission(player, this);
return this.hasPermission(player, this);
}
public boolean hasPermission(final FawePlayer<?> player, final Perm perm) {

View File

@ -244,7 +244,7 @@ public class ReflectionUtils {
* @return class
*/
public Class<?> getRealClass() {
return clazz;
return this.clazz;
}
/**
@ -255,7 +255,7 @@ public class ReflectionUtils {
* @return true if object is an instance of this class
*/
public boolean isInstance(final Object object) {
return clazz.isInstance(object);
return this.clazz.isInstance(object);
}
/**
@ -282,9 +282,9 @@ public class ReflectionUtils {
}
}
try {
return new RefMethod(clazz.getMethod(name, classes));
return new RefMethod(this.clazz.getMethod(name, classes));
} catch (final NoSuchMethodException ignored) {
return new RefMethod(clazz.getDeclaredMethod(name, classes));
return new RefMethod(this.clazz.getDeclaredMethod(name, classes));
}
} catch (final Exception e) {
throw new RuntimeException(e);
@ -314,9 +314,9 @@ public class ReflectionUtils {
}
}
try {
return new RefConstructor(clazz.getConstructor(classes));
return new RefConstructor(this.clazz.getConstructor(classes));
} catch (final NoSuchMethodException ignored) {
return new RefConstructor(clazz.getDeclaredConstructor(classes));
return new RefConstructor(this.clazz.getDeclaredConstructor(classes));
}
} catch (final Exception e) {
throw new RuntimeException(e);
@ -345,8 +345,8 @@ public class ReflectionUtils {
}
}
final List<Method> methods = new ArrayList<>();
Collections.addAll(methods, clazz.getMethods());
Collections.addAll(methods, clazz.getDeclaredMethods());
Collections.addAll(methods, this.clazz.getMethods());
Collections.addAll(methods, this.clazz.getDeclaredMethods());
findMethod: for (final Method m : methods) {
final Class<?>[] methodTypes = m.getParameterTypes();
if (methodTypes.length != classes.length) {
@ -373,8 +373,8 @@ public class ReflectionUtils {
*/
public RefMethod findMethodByName(final String... names) {
final List<Method> methods = new ArrayList<>();
Collections.addAll(methods, clazz.getMethods());
Collections.addAll(methods, clazz.getDeclaredMethods());
Collections.addAll(methods, this.clazz.getMethods());
Collections.addAll(methods, this.clazz.getDeclaredMethods());
for (final Method m : methods) {
for (final String name : names) {
if (m.getName().equals(name)) {
@ -395,7 +395,7 @@ public class ReflectionUtils {
* @throws RuntimeException if method not found
*/
public RefMethod findMethodByReturnType(final RefClass type) {
return findMethodByReturnType(type.clazz);
return this.findMethodByReturnType(type.clazz);
}
/**
@ -412,8 +412,8 @@ public class ReflectionUtils {
type = void.class;
}
final List<Method> methods = new ArrayList<>();
Collections.addAll(methods, clazz.getMethods());
Collections.addAll(methods, clazz.getDeclaredMethods());
Collections.addAll(methods, this.clazz.getMethods());
Collections.addAll(methods, this.clazz.getDeclaredMethods());
for (final Method m : methods) {
if (type.equals(m.getReturnType())) {
return new RefMethod(m);
@ -433,8 +433,8 @@ public class ReflectionUtils {
*/
public RefConstructor findConstructor(final int number) {
final List<Constructor> constructors = new ArrayList<>();
Collections.addAll(constructors, clazz.getConstructors());
Collections.addAll(constructors, clazz.getDeclaredConstructors());
Collections.addAll(constructors, this.clazz.getConstructors());
Collections.addAll(constructors, this.clazz.getDeclaredConstructors());
for (final Constructor m : constructors) {
if (m.getParameterTypes().length == number) {
return new RefConstructor(m);
@ -455,9 +455,9 @@ public class ReflectionUtils {
public RefField getField(final String name) {
try {
try {
return new RefField(clazz.getField(name));
return new RefField(this.clazz.getField(name));
} catch (final NoSuchFieldException ignored) {
return new RefField(clazz.getDeclaredField(name));
return new RefField(this.clazz.getDeclaredField(name));
}
} catch (final Exception e) {
throw new RuntimeException(e);
@ -474,7 +474,7 @@ public class ReflectionUtils {
* @throws RuntimeException if field not found
*/
public RefField findField(final RefClass type) {
return findField(type.clazz);
return this.findField(type.clazz);
}
/**
@ -491,8 +491,8 @@ public class ReflectionUtils {
type = void.class;
}
final List<Field> fields = new ArrayList<>();
Collections.addAll(fields, clazz.getFields());
Collections.addAll(fields, clazz.getDeclaredFields());
Collections.addAll(fields, this.clazz.getFields());
Collections.addAll(fields, this.clazz.getDeclaredFields());
for (final Field f : fields) {
if (type.equals(f.getType())) {
return new RefField(f);
@ -517,21 +517,21 @@ public class ReflectionUtils {
* @return passed method
*/
public Method getRealMethod() {
return method;
return this.method;
}
/**
* @return owner class of method
*/
public RefClass getRefClass() {
return new RefClass(method.getDeclaringClass());
return new RefClass(this.method.getDeclaringClass());
}
/**
* @return class of method return type
*/
public RefClass getReturnRefClass() {
return new RefClass(method.getReturnType());
return new RefClass(this.method.getReturnType());
}
/**
@ -554,7 +554,7 @@ public class ReflectionUtils {
*/
public Object call(final Object... params) {
try {
return method.invoke(null, params);
return this.method.invoke(null, params);
} catch (final Exception e) {
throw new RuntimeException(e);
}
@ -578,7 +578,7 @@ public class ReflectionUtils {
*/
public Object call(final Object... params) {
try {
return method.invoke(e, params);
return RefMethod.this.method.invoke(this.e, params);
} catch (final Exception e) {
throw new RuntimeException(e);
}
@ -601,14 +601,14 @@ public class ReflectionUtils {
* @return passed constructor
*/
public Constructor getRealConstructor() {
return constructor;
return this.constructor;
}
/**
* @return owner class of method
*/
public RefClass getRefClass() {
return new RefClass(constructor.getDeclaringClass());
return new RefClass(this.constructor.getDeclaringClass());
}
/**
@ -622,7 +622,7 @@ public class ReflectionUtils {
*/
public Object create(final Object... params) {
try {
return constructor.newInstance(params);
return this.constructor.newInstance(params);
} catch (final Exception e) {
throw new RuntimeException(e);
}
@ -641,21 +641,21 @@ public class ReflectionUtils {
* @return passed field
*/
public Field getRealField() {
return field;
return this.field;
}
/**
* @return owner class of field
*/
public RefClass getRefClass() {
return new RefClass(field.getDeclaringClass());
return new RefClass(this.field.getDeclaringClass());
}
/**
* @return type of field
*/
public RefClass getFieldRefClass() {
return new RefClass(field.getType());
return new RefClass(this.field.getType());
}
/**
@ -683,7 +683,7 @@ public class ReflectionUtils {
*/
public void set(final Object param) {
try {
field.set(e, param);
RefField.this.field.set(this.e, param);
} catch (final Exception e) {
throw new RuntimeException(e);
}
@ -696,7 +696,7 @@ public class ReflectionUtils {
*/
public Object get() {
try {
return field.get(e);
return RefField.this.field.get(this.e);
} catch (final Exception e) {
throw new RuntimeException(e);
}

View File

@ -20,10 +20,10 @@ public class SafeExtentWrapper extends AbstractDelegateExtent {
public boolean setBlock(final Vector location, final BaseBlock block) throws WorldEditException {
if (super.setBlock(location, block)) {
if (MemUtil.isMemoryLimited()) {
if (player != null) {
BBC.WORLDEDIT_OOM.send(player);
if (Perm.hasPermission(player, "worldedit.fast")) {
BBC.WORLDEDIT_OOM_ADMIN.send(player);
if (this.player != null) {
BBC.WORLDEDIT_OOM.send(this.player);
if (Perm.hasPermission(this.player, "worldedit.fast")) {
BBC.WORLDEDIT_OOM_ADMIN.send(this.player);
}
}
WEManager.IMP.cancelEdit(this);

View File

@ -26,75 +26,75 @@ public class SetQueue {
if (!MemUtil.isMemoryFree()) {
final int mem = MemUtil.calculateMemory();
if (mem != Integer.MAX_VALUE) {
if (mem <= 1 && Settings.ENABLE_HARD_LIMIT) {
queue.saveMemory();
if ((mem <= 1) && Settings.ENABLE_HARD_LIMIT) {
SetQueue.this.queue.saveMemory();
return;
}
if (forceChunkSet()) {
if (SetQueue.this.forceChunkSet()) {
System.gc();
} else {
time_current.incrementAndGet();
tasks();
SetQueue.this.time_current.incrementAndGet();
SetQueue.this.tasks();
}
return;
}
}
long free = 50 + Math.min(50 + last - (last = System.currentTimeMillis()), last2 - System.currentTimeMillis());
time_current.incrementAndGet();
final long free = 50 + Math.min((50 + SetQueue.this.last) - (SetQueue.this.last = System.currentTimeMillis()), SetQueue.this.last2 - System.currentTimeMillis());
SetQueue.this.time_current.incrementAndGet();
do {
if (isWaiting()) {
if (SetQueue.this.isWaiting()) {
return;
}
final FaweChunk<?> current = queue.next();
final FaweChunk<?> current = SetQueue.this.queue.next();
if (current == null) {
time_waiting.set(Math.max(time_waiting.get(), time_current.get() - 2));
tasks();
SetQueue.this.time_waiting.set(Math.max(SetQueue.this.time_waiting.get(), SetQueue.this.time_current.get() - 2));
SetQueue.this.tasks();
return;
}
} while ((last2 = System.currentTimeMillis()) - last < free);
time_waiting.set(time_current.get() - 1);
} while (((SetQueue.this.last2 = System.currentTimeMillis()) - SetQueue.this.last) < free);
SetQueue.this.time_waiting.set(SetQueue.this.time_current.get() - 1);
}
}, 1);
}
public boolean forceChunkSet() {
final FaweChunk<?> set = queue.next();
final FaweChunk<?> set = this.queue.next();
return set != null;
}
public boolean isWaiting() {
return time_waiting.get() >= time_current.get();
return this.time_waiting.get() >= this.time_current.get();
}
public boolean isDone() {
return (time_waiting.get() + 1) < time_current.get();
return (this.time_waiting.get() + 1) < this.time_current.get();
}
public void setWaiting() {
time_waiting.set(time_current.get() + 1);
this.time_waiting.set(this.time_current.get() + 1);
}
public boolean addTask(final Runnable whenDone) {
if (isDone()) {
if (this.isDone()) {
// Run
tasks();
this.tasks();
if (whenDone != null) {
whenDone.run();
}
return true;
}
if (whenDone != null) {
runnables.add(whenDone);
this.runnables.add(whenDone);
}
return false;
}
public boolean tasks() {
if (runnables.size() == 0) {
if (this.runnables.size() == 0) {
return false;
}
final ArrayDeque<Runnable> tmp = runnables.clone();
runnables.clear();
final ArrayDeque<Runnable> tmp = this.runnables.clone();
this.runnables.clear();
for (final Runnable runnable : tmp) {
runnable.run();
}
@ -112,7 +112,7 @@ public class SetQueue {
*/
public boolean setBlock(final String world, final int x, final int y, final int z, final short id, final byte data) {
SetQueue.IMP.setWaiting();
return queue.setBlock(world, x, y, z, id, data);
return this.queue.setBlock(world, x, y, z, id, data);
}
/**
@ -125,7 +125,7 @@ public class SetQueue {
*/
public boolean setBlock(final String world, final int x, final int y, final int z, final short id) {
SetQueue.IMP.setWaiting();
return queue.setBlock(world, x, y, z, id, (byte) 0);
return this.queue.setBlock(world, x, y, z, id, (byte) 0);
}
/**
@ -137,12 +137,12 @@ public class SetQueue {
* @param data
* @return
*/
public boolean setBiome(final String world, final int x, final int z, BaseBiome biome) {
public boolean setBiome(final String world, final int x, final int z, final BaseBiome biome) {
SetQueue.IMP.setWaiting();
return queue.setBiome(world, x, z, biome);
return this.queue.setBiome(world, x, z, biome);
}
public boolean isChunkLoaded(String world, int x, int z) {
return queue.isChunkLoaded(world, x, z);
public boolean isChunkLoaded(final String world, final int x, final int z) {
return this.queue.isChunkLoaded(world, x, z);
}
}

View File

@ -30,9 +30,9 @@ public class StringMan {
return sb.toString();
}
public static int intersection(Set<String> options, String[] toCheck) {
public static int intersection(final Set<String> options, final String[] toCheck) {
int count = 0;
for (String check : toCheck) {
for (final String check : toCheck) {
if (options.contains(check)) {
count++;
}

View File

@ -45,7 +45,7 @@ public class WEManager {
regions.add(new RegionWrapper(Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE));
return regions;
}
for (final FaweMaskManager manager : managers) {
for (final FaweMaskManager manager : this.managers) {
if (player.hasPermission("fawe." + manager.getKey())) {
final FaweMask mask = manager.getMask(player);
if (mask != null) {
@ -62,7 +62,7 @@ public class WEManager {
public boolean regionContains(final RegionWrapper selection, final HashSet<RegionWrapper> mask) {
for (final RegionWrapper region : mask) {
if (intersects(region, selection)) {
if (this.intersects(region, selection)) {
return true;
}
}
@ -71,7 +71,7 @@ public class WEManager {
public boolean delay(final FawePlayer<?> player, final String command) {
final long start = System.currentTimeMillis();
return delay(player, new Runnable() {
return this.delay(player, new Runnable() {
@Override
public void run() {
try {

View File

@ -7,6 +7,5 @@ import com.sk89q.worldedit.util.eventbus.Subscribe;
public class WESubscriber {
@Subscribe(priority = Priority.VERY_EARLY)
public void onEditSession(final EditSessionEvent event) {
}
public void onEditSession(final EditSessionEvent event) {}
}

File diff suppressed because it is too large Load Diff

View File

@ -20,53 +20,51 @@ 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<CommandMapping> getCommands() {
return parent.getCommands();
return this.parent.getCommands();
}
@Override
public Collection<String> getPrimaryAliases() {
return parent.getPrimaryAliases();
return this.parent.getPrimaryAliases();
}
@Override
public Collection<String> 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();
}
}
@ -76,17 +74,17 @@ public class DispatcherWrapper implements Dispatcher {
@Override
public Description getDescription() {
return parent.getDescription();
return this.parent.getDescription();
}
@Override
public boolean testPermission(CommandLocals locals) {
return parent.testPermission(locals);
public boolean testPermission(final CommandLocals locals) {
return this.parent.testPermission(locals);
}
@Override
public List<String> getSuggestions(String arguments, CommandLocals locals) throws CommandException {
return parent.getSuggestions(arguments, locals);
public List<String> getSuggestions(final String arguments, final CommandLocals locals) throws CommandException {
return this.parent.getSuggestions(arguments, locals);
}
public static void inject() {
@ -95,15 +93,15 @@ public class DispatcherWrapper implements Dispatcher {
@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();
}
}

View File

@ -70,11 +70,12 @@ public class FlattenedClipboardTransform {
* @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,
@ -118,9 +119,9 @@ 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;
}

View File

@ -82,10 +82,10 @@ public class SchematicCommands {
@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 LocalConfiguration config = this.worldEdit.getConfiguration();
final File dir = worldEdit.getWorkingDirectoryFile(config.saveDir);
final File f = worldEdit.getSafeOpenFile(player, dir, filename, "schematic", "schematic");
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!");
@ -141,10 +141,10 @@ public class SchematicCommands {
@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 LocalConfiguration config = this.worldEdit.getConfiguration();
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");
final ClipboardFormat format = ClipboardFormat.findByAlias(formatName);
if (format == null) {
@ -207,11 +207,11 @@ public class SchematicCommands {
@Command(aliases = { "delete", "d" }, usage = "<filename>", 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() {
@ -256,7 +256,7 @@ public class SchematicCommands {
+ " -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) {
@ -292,14 +292,14 @@ public class SchematicCommands {
});
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;
}

View File

@ -67,8 +67,8 @@ public class ScriptingCommands {
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.");
}
@ -104,8 +104,8 @@ public class ScriptingCommands {
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
@ -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.");
}

View File

@ -64,7 +64,7 @@ public abstract class BreadthFirstSearch implements Operation {
protected BreadthFirstSearch(final RegionFunction function) {
checkNotNull(function);
this.function = function;
addAxes();
this.addAxes();
}
/**
@ -80,29 +80,29 @@ public abstract class BreadthFirstSearch implements Operation {
* @return the list of directions
*/
protected Collection<Vector> 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));
}
/**
@ -121,9 +121,9 @@ 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);
}
}
@ -135,10 +135,10 @@ 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);
}
}
}
@ -159,19 +159,19 @@ public abstract class BreadthFirstSearch implements Operation {
* @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;
@ -185,7 +185,7 @@ public abstract class BreadthFirstSearch implements Operation {
}
@Override
public void addStatusMessages(List<String> messages) {
messages.add(getAffected() + " blocks affected");
public void addStatusMessages(final List<String> messages) {
messages.add(this.getAffected() + " blocks affected");
}
}

View File

@ -52,7 +52,7 @@ public class DownwardVisitor extends RecursiveVisitor {
this.baseY = baseY;
final Collection<Vector> directions = getDirections();
final Collection<Vector> directions = this.getDirections();
directions.clear();
directions.add(new Vector(1, 0, 0));
directions.add(new Vector(-1, 0, 0));
@ -64,7 +64,7 @@ public class DownwardVisitor extends RecursiveVisitor {
@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() {

View File

@ -60,13 +60,13 @@ public class EntityVisitor implements Operation {
* @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;
}
@ -75,8 +75,8 @@ public class EntityVisitor implements Operation {
public void cancel() {}
@Override
public void addStatusMessages(List<String> messages) {
messages.add(getAffected() + " blocks affected");
public void addStatusMessages(final List<String> messages) {
messages.add(this.getAffected() + " blocks affected");
}
public static Class<?> inject() {

View File

@ -50,7 +50,7 @@ public class FlatRegionVisitor implements Operation {
checkNotNull(flatRegion);
checkNotNull(function);
this.function = function;
iterator = flatRegion.asFlatRegion();
this.iterator = flatRegion.asFlatRegion();
}
/**
@ -59,13 +59,13 @@ public class FlatRegionVisitor implements Operation {
* @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;
}
@ -74,8 +74,8 @@ public class FlatRegionVisitor implements Operation {
public void cancel() {}
@Override
public void addStatusMessages(List<String> messages) {
messages.add(getAffected() + " columns affected");
public void addStatusMessages(final List<String> messages) {
messages.add(this.getAffected() + " columns affected");
}
public static Class<?> inject() {

View File

@ -66,7 +66,7 @@ public class LayerVisitor implements Operation {
this.minY = minY;
this.maxY = maxY;
this.function = function;
iterator = flatRegion.asFlatRegion();
this.iterator = flatRegion.asFlatRegion();
}
/**
@ -76,7 +76,7 @@ public class LayerVisitor implements Operation {
* @return a 2D mask
*/
public Mask2D getMask() {
return mask;
return this.mask;
}
/**
@ -92,29 +92,29 @@ public class LayerVisitor implements Operation {
@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;
}
}
@ -127,7 +127,7 @@ public class LayerVisitor implements Operation {
public void cancel() {}
@Override
public void addStatusMessages(List<String> messages) {}
public void addStatusMessages(final List<String> messages) {}
public static Class<?> inject() {
return Operations.class;

View File

@ -39,7 +39,7 @@ public class NonRisingVisitor extends RecursiveVisitor {
*/
public NonRisingVisitor(final Mask mask, final RegionFunction function) {
super(mask, function);
final Collection<Vector> directions = getDirections();
final Collection<Vector> directions = this.getDirections();
directions.clear();
directions.add(new Vector(1, 0, 0));
directions.add(new Vector(-1, 0, 0));

View File

@ -48,7 +48,7 @@ public class RecursiveVisitor extends BreadthFirstSearch {
@Override
protected boolean isVisitable(final Vector from, final Vector to) {
return mask.test(to);
return this.mask.test(to);
}
public static Class<?> inject() {

View File

@ -42,7 +42,7 @@ public class RegionVisitor implements Operation {
public RegionVisitor(final Region region, final RegionFunction function) {
this.function = function;
iterator = region.iterator();
this.iterator = region.iterator();
}
@ -52,13 +52,13 @@ public class RegionVisitor implements Operation {
* @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;
}
@ -67,8 +67,8 @@ public class RegionVisitor implements Operation {
public void cancel() {}
@Override
public void addStatusMessages(List<String> messages) {
messages.add(getAffected() + " blocks affected");
public void addStatusMessages(final List<String> messages) {
messages.add(this.getAffected() + " blocks affected");
}
public static Class<?> inject() {