More code quality fixes

This commit is contained in:
MattBDev 2020-01-22 16:56:24 -05:00
parent 88359f0215
commit 2d6957ce1c
115 changed files with 686 additions and 1688 deletions

View File

@ -48,6 +48,7 @@ import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.world.WorldLoadEvent; import org.bukkit.event.world.WorldLoadEvent;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.inventivetalent.mapmanager.MapManagerPlugin;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -56,6 +57,7 @@ public class FaweBukkit implements IFawe, Listener {
private static final Logger log = LoggerFactory.getLogger(FaweBukkit.class); private static final Logger log = LoggerFactory.getLogger(FaweBukkit.class);
private final Plugin plugin; private final Plugin plugin;
private final String separator = System.lineSeparator();
private VaultUtil vault; private VaultUtil vault;
private ItemUtil itemUtil; private ItemUtil itemUtil;
@ -73,11 +75,7 @@ public class FaweBukkit implements IFawe, Listener {
Settings.IMP.TICK_LIMITER.ENABLED = !Bukkit.hasWhitelist(); Settings.IMP.TICK_LIMITER.ENABLED = !Bukkit.hasWhitelist();
Fawe.set(this); Fawe.set(this);
Fawe.setupInjector(); Fawe.setupInjector();
try { plugin.getServer().getPluginManager().registerEvents(this, plugin);
new BrushListener(plugin);
} catch (Throwable e) {
log.debug("Brush Listener Failed", e);
}
if (PaperLib.isPaper() && Settings.IMP.EXPERIMENTAL.DYNAMIC_CHUNK_RENDERING > 1) { if (PaperLib.isPaper() && Settings.IMP.EXPERIMENTAL.DYNAMIC_CHUNK_RENDERING > 1) {
new RenderListener(plugin); new RenderListener(plugin);
} }
@ -142,7 +140,7 @@ public class FaweBukkit implements IFawe, Listener {
fos.write(jarData); fos.write(jarData);
} }
} }
BukkitImageViewer viewer = new BukkitImageViewer(BukkitAdapter.adapt(player)); ImageViewer viewer = new BukkitImageViewer(BukkitAdapter.adapt(player), ((MapManagerPlugin) manager.getPlugin("MapManager")).getMapManager());
if (imageListener == null) { if (imageListener == null) {
this.imageListener = new BukkitImageListener(plugin); this.imageListener = new BukkitImageListener(plugin);
} }
@ -210,11 +208,11 @@ public class FaweBukkit implements IFawe, Listener {
@Override @Override
public String getDebugInfo() { public String getDebugInfo() {
StringBuilder msg = new StringBuilder(); StringBuilder msg = new StringBuilder();
msg.append("Server Version: ").append(Bukkit.getVersion()).append("\n"); msg.append("Server Version: ").append(Bukkit.getVersion()).append(separator);
msg.append("Plugins: \n"); msg.append("Plugins: " + separator);
for (Plugin p : Bukkit.getPluginManager().getPlugins()) { for (Plugin p : Bukkit.getPluginManager().getPlugins()) {
msg.append(" - ").append(p.getName()).append(": ") msg.append(" - ").append(p.getName()).append(": ")
.append(p.getDescription().getVersion()).append("\n"); .append(p.getDescription().getVersion()).append(separator);
} }
return msg.toString(); return msg.toString();
} }

View File

@ -15,7 +15,6 @@ import io.papermc.lib.PaperLib;
import net.jpountz.util.UnsafeUtils; import net.jpountz.util.UnsafeUtils;
import net.minecraft.server.v1_13_R2.Block; import net.minecraft.server.v1_13_R2.Block;
import net.minecraft.server.v1_13_R2.Chunk; import net.minecraft.server.v1_13_R2.Chunk;
import net.minecraft.server.v1_13_R2.ChunkCoordIntPair;
import net.minecraft.server.v1_13_R2.ChunkSection; import net.minecraft.server.v1_13_R2.ChunkSection;
import net.minecraft.server.v1_13_R2.DataBits; import net.minecraft.server.v1_13_R2.DataBits;
import net.minecraft.server.v1_13_R2.DataPalette; import net.minecraft.server.v1_13_R2.DataPalette;
@ -30,7 +29,6 @@ import org.bukkit.craftbukkit.v1_13_R2.CraftWorld;
import sun.misc.Unsafe; import sun.misc.Unsafe;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Arrays; import java.util.Arrays;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.Lock;
@ -210,8 +208,8 @@ public final class BukkitAdapter_1_13 extends NMSAdapter {
} }
final int[] blockToPalette = FaweCache.INSTANCE.getBLOCK_TO_PALETTE().get(); final int[] blockToPalette = FaweCache.INSTANCE.getBLOCK_TO_PALETTE().get();
final int[] paletteToBlock = FaweCache.INSTANCE.getPALETTE_TO_BLOCK().get(); final int[] paletteToBlock = FaweCache.INSTANCE.getPALETTE_TO_BLOCK().get();
final long[] blockStates = FaweCache.INSTANCE.getBLOCK_STATES().get(); final long[] blockStates = FaweCache.INSTANCE.getBlockStates().get();
final int[] blocksCopy = FaweCache.INSTANCE.getSECTION_BLOCKS().get(); final int[] blocksCopy = FaweCache.INSTANCE.getSectionBlocks().get();
try { try {
int[] num_palette_buffer = new int[1]; int[] num_palette_buffer = new int[1];
int air; int air;

View File

@ -30,7 +30,6 @@ import org.bukkit.craftbukkit.v1_14_R1.CraftWorld;
import sun.misc.Unsafe; import sun.misc.Unsafe;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Arrays; import java.util.Arrays;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.Lock;
@ -203,8 +202,8 @@ public final class BukkitAdapter_1_14 extends NMSAdapter {
} }
final int[] blockToPalette = FaweCache.INSTANCE.getBLOCK_TO_PALETTE().get(); final int[] blockToPalette = FaweCache.INSTANCE.getBLOCK_TO_PALETTE().get();
final int[] paletteToBlock = FaweCache.INSTANCE.getPALETTE_TO_BLOCK().get(); final int[] paletteToBlock = FaweCache.INSTANCE.getPALETTE_TO_BLOCK().get();
final long[] blockStates = FaweCache.INSTANCE.getBLOCK_STATES().get(); final long[] blockStates = FaweCache.INSTANCE.getBlockStates().get();
final int[] blocksCopy = FaweCache.INSTANCE.getSECTION_BLOCKS().get(); final int[] blocksCopy = FaweCache.INSTANCE.getSectionBlocks().get();
try { try {
int[] num_palette_buffer = new int[1]; int[] num_palette_buffer = new int[1];
int air; int air;

View File

@ -181,8 +181,8 @@ public final class BukkitAdapter_1_15 extends NMSAdapter {
} }
final int[] blockToPalette = FaweCache.INSTANCE.getBLOCK_TO_PALETTE().get(); final int[] blockToPalette = FaweCache.INSTANCE.getBLOCK_TO_PALETTE().get();
final int[] paletteToBlock = FaweCache.INSTANCE.getPALETTE_TO_BLOCK().get(); final int[] paletteToBlock = FaweCache.INSTANCE.getPALETTE_TO_BLOCK().get();
final long[] blockStates = FaweCache.INSTANCE.getBLOCK_STATES().get(); final long[] blockStates = FaweCache.INSTANCE.getBlockStates().get();
final int[] blocksCopy = FaweCache.INSTANCE.getSECTION_BLOCKS().get(); final int[] blocksCopy = FaweCache.INSTANCE.getSectionBlocks().get();
try { try {
int[] num_palette_buffer = new int[1]; int[] num_palette_buffer = new int[1];
int air; int air;

View File

@ -96,7 +96,7 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks {
BiomeStorage index = getChunk().getBiomeIndex(); BiomeStorage index = getChunk().getBiomeIndex();
BiomeBase base = null; BiomeBase base = null;
if (y == -1) { if (y == -1) {
for (y = 0; y < FaweCache.WORLD_HEIGHT; y++) { for (y = 0; y < FaweCache.worldHeight; y++) {
base = index.getBiome(x, y, z); base = index.getBiome(x, y, z);
if (base != null) break; if (base != null) break;
} }
@ -324,7 +324,7 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks {
if (biome != null) { if (biome != null) {
final Biome craftBiome = BukkitAdapter.adapt(biome); final Biome craftBiome = BukkitAdapter.adapt(biome);
BiomeBase nmsBiome = CraftBlock.biomeToBiomeBase(craftBiome); BiomeBase nmsBiome = CraftBlock.biomeToBiomeBase(craftBiome);
for (int y = 0; y < FaweCache.WORLD_HEIGHT; y++) { for (int y = 0; y < FaweCache.worldHeight; y++) {
currentBiomes.setBiome(x, y, z, nmsBiome); currentBiomes.setBiome(x, y, z, nmsBiome);
} }
} }

View File

@ -20,9 +20,6 @@ import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
public class BrushListener implements Listener { public class BrushListener implements Listener {
public BrushListener(Plugin plugin) {
Bukkit.getPluginManager().registerEvents(this, plugin);
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerItemHoldEvent(final PlayerItemHeldEvent event) { public void onPlayerItemHoldEvent(final PlayerItemHeldEvent event) {
@ -37,7 +34,7 @@ public class BrushListener implements Listener {
final int slot = event.getNewSlot(); final int slot = event.getNewSlot();
final int oldSlot = event.getPreviousSlot(); final int oldSlot = event.getPreviousSlot();
final int ri; final int ri;
if ((((slot - oldSlot) <= 4) && ((slot - oldSlot) > 0)) || (((slot - oldSlot) < -4))) { if (slot - oldSlot <= 4 && slot - oldSlot > 0 || slot - oldSlot < -4) {
ri = 1; ri = 1;
} else { } else {
ri = -1; ri = -1;
@ -53,7 +50,7 @@ public class BrushListener implements Listener {
public void onPlayerMove(PlayerMoveEvent event) { public void onPlayerMove(PlayerMoveEvent event) {
Location from = event.getFrom(); Location from = event.getFrom();
Location to = event.getTo(); Location to = event.getTo();
if ((from.getYaw() != to.getYaw() && from.getPitch() != to.getPitch()) || from.getBlockX() != to.getBlockX() || from.getBlockZ() != to.getBlockZ() || from.getBlockY() != to.getBlockY()) { if (from.getYaw() != to.getYaw() && from.getPitch() != to.getPitch() || from.getBlockX() != to.getBlockX() || from.getBlockZ() != to.getBlockZ() || from.getBlockY() != to.getBlockY()) {
Player bukkitPlayer = event.getPlayer(); Player bukkitPlayer = event.getPlayer();
com.sk89q.worldedit.entity.Player player = BukkitAdapter.adapt(bukkitPlayer); com.sk89q.worldedit.entity.Player player = BukkitAdapter.adapt(bukkitPlayer);
LocalSession session = player.getSession(); LocalSession session = player.getSession();

View File

@ -286,7 +286,7 @@ public class BukkitImageListener implements Listener {
EditSession es = new EditSessionBuilder(bukkitPlayer.getWorld()).player(bukkitPlayer) EditSession es = new EditSessionBuilder(bukkitPlayer.getWorld()).player(bukkitPlayer)
.combineStages(false).autoQueue(false).blockBag(null).limitUnlimited() .combineStages(false).autoQueue(false).blockBag(null).limitUnlimited()
.build(); .build();
ExtentTraverser last = new ExtentTraverser(es.getExtent()).last(); ExtentTraverser<Extent> last = new ExtentTraverser<>(es.getExtent()).last();
Extent extent = last.get(); Extent extent = last.get();
if (extent instanceof IQueueExtent) { if (extent instanceof IQueueExtent) {
last = last.previous(); last = last.previous();

View File

@ -54,6 +54,7 @@ public abstract class ChunkListener implements Listener {
public ChunkListener() { public ChunkListener() {
if (Settings.IMP.TICK_LIMITER.ENABLED) { if (Settings.IMP.TICK_LIMITER.ENABLED) {
PluginManager plm = Bukkit.getPluginManager(); PluginManager plm = Bukkit.getPluginManager();
assert Fawe.<FaweBukkit>imp() != null;
Plugin plugin = Fawe.<FaweBukkit>imp().getPlugin(); Plugin plugin = Fawe.<FaweBukkit>imp().getPlugin();
plm.registerEvents(this, plugin); plm.registerEvents(this, plugin);
try { try {
@ -293,8 +294,8 @@ public abstract class ChunkListener implements Listener {
if (elem != null) { if (elem != null) {
String methodName = elem.getMethodName(); String methodName = elem.getMethodName();
// setAir | setTypeAndData (hacky, but this needs to be efficient) // setAir | setTypeAndData (hacky, but this needs to be efficient)
if (methodName.charAt(0) == 's' && methodName.length() == 6 if (methodName.charAt(0) == 's' && (methodName.length() == 6
|| methodName.length() == 14) { || methodName.length() == 14)) {
return true; return true;
} }
} }

View File

@ -9,7 +9,6 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockPhysicsEvent; import org.bukkit.event.block.BlockPhysicsEvent;
//
public class ChunkListener_9 extends ChunkListener { public class ChunkListener_9 extends ChunkListener {
private Exception exception; private Exception exception;
@ -88,4 +87,4 @@ public class ChunkListener_9 extends ChunkListener {
StackTraceElement[] elems = getElements(ex); StackTraceElement[] elems = getElements(ex);
return elems.length > i ? elems[i] : null; return elems.length > i ? elems[i] : null;
} }
} }

View File

@ -9,6 +9,7 @@ import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@ -99,7 +100,7 @@ public class RenderListener implements Listener {
player.setViewDistance(value); player.setViewDistance(value);
} }
private int getViewDistance(Player player) { private int getViewDistance(Entity player) {
int[] value = views.get(player.getUniqueId()); int[] value = views.get(player.getUniqueId());
return value == null ? Settings.IMP.EXPERIMENTAL.DYNAMIC_CHUNK_RENDERING : value[0]; return value == null ? Settings.IMP.EXPERIMENTAL.DYNAMIC_CHUNK_RENDERING : value[0];
} }

View File

@ -2,6 +2,7 @@ package com.boydti.fawe.bukkit.regions;
import com.boydti.fawe.regions.FaweMaskManager; import com.boydti.fawe.regions.FaweMaskManager;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.permissions.Permissible;
public abstract class BukkitMaskManager extends FaweMaskManager { public abstract class BukkitMaskManager extends FaweMaskManager {
@ -9,7 +10,7 @@ public abstract class BukkitMaskManager extends FaweMaskManager {
super(plugin); super(plugin);
} }
public boolean hasMemberPermission(Player player) { public boolean hasMemberPermission(Permissible player) {
return player.hasPermission("fawe." + getKey() + ".member"); return player.hasPermission("fawe." + getKey() + ".member");
} }
} }

View File

@ -30,7 +30,7 @@ public class BukkitReflectionUtils {
try { try {
final Method getHandle = bukkitServerClass.getDeclaredMethod("getHandle"); final Method getHandle = bukkitServerClass.getDeclaredMethod("getHandle");
final Object handle = getHandle.invoke(server); final Object handle = getHandle.invoke(server);
final Class handleServerClass = handle.getClass(); final Class<?> handleServerClass = handle.getClass();
pas = handleServerClass.getName().split("\\."); pas = handleServerClass.getName().split("\\.");
if (pas.length == 5) { if (pas.length == 5) {
final String verM = pas[3]; final String verM = pas[3];

View File

@ -26,7 +26,7 @@ public class ItemUtil {
private final Field fieldHandle; private final Field fieldHandle;
private final BukkitImplAdapter adapter; private final BukkitImplAdapter adapter;
private SoftReference<Int2ObjectOpenHashMap<WeakReference<Tag>>> hashToNMSTag = new SoftReference(new Int2ObjectOpenHashMap<>()); private SoftReference<Int2ObjectOpenHashMap<WeakReference<Tag>>> hashToNMSTag = new SoftReference<>(new Int2ObjectOpenHashMap<>());
public ItemUtil() throws Exception { public ItemUtil() throws Exception {
this.adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); this.adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();

View File

@ -15,6 +15,7 @@ import org.bukkit.Rotation;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.ItemFrame; import org.bukkit.entity.ItemFrame;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -32,12 +33,12 @@ public class BukkitImageViewer implements ImageViewer {
private ItemFrame[][] frames; private ItemFrame[][] frames;
private boolean reverse; private boolean reverse;
public BukkitImageViewer(Player player) { public BukkitImageViewer(Player player, MapManager mapManager) {
mapManager = ((MapManagerPlugin) Bukkit.getPluginManager().getPlugin("MapManager")).getMapManager(); this.mapManager = mapManager;
this.player = player; this.player = player;
} }
public void selectFrame(ItemFrame start) { public void selectFrame(Entity start) {
Location pos1 = start.getLocation().clone(); Location pos1 = start.getLocation().clone();
Location pos2 = start.getLocation().clone(); Location pos2 = start.getLocation().clone();
@ -108,7 +109,7 @@ public class BukkitImageViewer implements ImageViewer {
Collection<Entity> entities = world.getNearbyEntities(pos, 0.1, 0.1, 0.1); Collection<Entity> entities = world.getNearbyEntities(pos, 0.1, 0.1, 0.1);
boolean contains = false; boolean contains = false;
for (Entity ent : entities) { for (Entity ent : entities) {
if (ent instanceof ItemFrame && ((ItemFrame) ent).getFacing() == facing) { if (ent instanceof ItemFrame && ent.getFacing() == facing) {
ItemFrame itemFrame = (ItemFrame) ent; ItemFrame itemFrame = (ItemFrame) ent;
itemFrame.setRotation(Rotation.NONE); itemFrame.setRotation(Rotation.NONE);
contains = true; contains = true;
@ -137,7 +138,7 @@ public class BukkitImageViewer implements ImageViewer {
boolean initializing = last == null; boolean initializing = last == null;
if (this.frames != null) { if (this.frames != null) {
if (image == null && drawable != null) image = drawable.draw(); if (image == null) image = drawable.draw();
last = image; last = image;
int width = frames.length; int width = frames.length;
int height = frames[0].length; int height = frames[0].length;
@ -158,7 +159,7 @@ public class BukkitImageViewer implements ImageViewer {
} else if (player.getInventory().getHeldItemSlot() != slot) { } else if (player.getInventory().getHeldItemSlot() != slot) {
player.getInventory().setHeldItemSlot(slot); player.getInventory().setHeldItemSlot(slot);
} }
if (image == null && drawable != null) image = drawable.draw(); if (image == null) image = drawable.draw();
last = image; last = image;
BufferedImage scaled = ImageUtil.getScaledInstance(image, 128, 128, RenderingHints.VALUE_INTERPOLATION_BILINEAR, false); BufferedImage scaled = ImageUtil.getScaledInstance(image, 128, 128, RenderingHints.VALUE_INTERPOLATION_BILINEAR, false);
MapWrapper mapWrapper = mapManager.wrapImage(scaled); MapWrapper mapWrapper = mapManager.wrapImage(scaled);
@ -169,7 +170,7 @@ public class BukkitImageViewer implements ImageViewer {
} }
} }
private int getMapSlot(Player player) { private int getMapSlot(HumanEntity player) {
PlayerInventory inventory = player.getInventory(); PlayerInventory inventory = player.getInventory();
for (int i = 0; i < 9; i++) { for (int i = 0; i < 9; i++) {
ItemStack item = inventory.getItem(i); ItemStack item = inventory.getItem(i);
@ -188,4 +189,4 @@ public class BukkitImageViewer implements ImageViewer {
public void close() throws IOException { public void close() throws IOException {
last = null; last = null;
} }
} }

View File

@ -376,7 +376,7 @@ public enum BukkitAdapter {
* @param block The WorldEdit BlockStateHolder * @param block The WorldEdit BlockStateHolder
* @return The Bukkit BlockData * @return The Bukkit BlockData
*/ */
public static BlockData adapt(@NotNull BlockStateHolder block) { public static <T extends BlockStateHolder<T>> BlockData adapt(@NotNull T block) {
return getAdapter().adapt(block); return getAdapter().adapt(block);
} }
@ -409,4 +409,4 @@ public enum BukkitAdapter {
public static ItemStack adapt(BaseItemStack item) { public static ItemStack adapt(BaseItemStack item) {
return getAdapter().adapt(item); return getAdapter().adapt(item);
} }
} }

View File

@ -70,6 +70,9 @@ public class BukkitServerInterface implements MultiUserPlatform {
dynamicCommands = new CommandRegistration(plugin); dynamicCommands = new CommandRegistration(plugin);
} }
CommandRegistration getDynamicCommands() {
return dynamicCommands;
}
boolean isHookingEvents() { boolean isHookingEvents() {
return hookingEvents; return hookingEvents;
} }

View File

@ -87,6 +87,7 @@ import org.bukkit.event.Listener;
import org.bukkit.event.world.WorldInitEvent; import org.bukkit.event.world.WorldInitEvent;
import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.metadata.MetadataValue; import org.bukkit.metadata.MetadataValue;
import org.bukkit.metadata.Metadatable;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
@ -575,7 +576,7 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
return wePlayer; return wePlayer;
} }
public BukkitPlayer getCachedPlayer(Player player) { public BukkitPlayer getCachedPlayer(Metadatable player) {
List<MetadataValue> meta = player.getMetadata("WE"); List<MetadataValue> meta = player.getMetadata("WE");
if (meta == null || meta.isEmpty()) { if (meta == null || meta.isEmpty()) {
return null; return null;
@ -648,15 +649,24 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
String buffer = event.getBuffer(); String buffer = event.getBuffer();
int firstSpace = buffer.indexOf(' '); int firstSpace = buffer.indexOf(' ');
if (firstSpace < 0) return; if (firstSpace < 0) return;
final String label = buffer.substring(0, firstSpace); String label = buffer.substring(1, firstSpace);
Plugin owner = server.getDynamicCommands().getCommandOwner(label);
if (owner != WorldEditPlugin.this) {
return;
}
int plSep = label.indexOf(":");
if (plSep >= 0 && plSep < label.length() + 1) {
label = label.substring(plSep + 1);
buffer = "/" + buffer.substring(plSep + 2);
}
final Optional<org.enginehub.piston.Command> command final Optional<org.enginehub.piston.Command> command
= WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().getCommandManager().getCommand(label); = WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().getCommandManager().getCommand(label);
if (!command.isPresent()) return; if (!command.isPresent()) return;
CommandSuggestionEvent suggestEvent = new CommandSuggestionEvent(wrapCommandSender(event.getSender()), event.getBuffer()); CommandSuggestionEvent suggestEvent = new CommandSuggestionEvent(wrapCommandSender(event.getSender()), buffer);
getWorldEdit().getEventBus().post(suggestEvent); getWorldEdit().getEventBus().post(suggestEvent);
event.setCompletions(CommandUtil.fixSuggestions(event.getBuffer(), suggestEvent.getSuggestions())); event.setCompletions(CommandUtil.fixSuggestions(buffer, suggestEvent.getSuggestions()));
event.setHandled(true); event.setHandled(true);
} }
} }

View File

@ -79,7 +79,7 @@ public abstract class CachedBukkitAdapter implements IBukkitAdapter {
Material material = blockData.getMaterial(); Material material = blockData.getMaterial();
BlockType type = BlockTypes.getFromStateId(blockTypes[material.ordinal()]); BlockType type = BlockTypes.getFromStateId(blockTypes[material.ordinal()]);
List<? extends Property> propList = type.getProperties(); List<? extends Property> propList = type.getProperties();
if (propList.size() == 0) return type.getDefaultState(); if (propList.isEmpty()) return type.getDefaultState();
String properties = blockData.getAsString(); String properties = blockData.getAsString();
return BlockState.get(type, properties, type.getDefaultState()); return BlockState.get(type, properties, type.getDefaultState());
} catch (NullPointerException e) { } catch (NullPointerException e) {

View File

@ -28,10 +28,15 @@ import java.lang.management.ManagementFactory;
import java.lang.management.MemoryMXBean; import java.lang.management.MemoryMXBean;
import java.lang.management.MemoryPoolMXBean; import java.lang.management.MemoryPoolMXBean;
import java.lang.management.MemoryUsage; import java.lang.management.MemoryUsage;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.ZoneId;
import java.util.Date; import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Objects; import java.util.Objects;
import java.util.TimeZone;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import javax.management.InstanceAlreadyExistsException; import javax.management.InstanceAlreadyExistsException;
@ -157,7 +162,7 @@ public class Fawe {
* The platform specific implementation * The platform specific implementation
*/ */
private final IFawe IMP; private final IFawe IMP;
private Thread thread; private final Thread thread;
private Fawe(final IFawe implementation) { private Fawe(final IFawe implementation) {
INSTANCE = this; INSTANCE = this;
@ -289,7 +294,11 @@ public class Fawe {
String dateString = br.readLine(); String dateString = br.readLine();
br.close(); br.close();
this.version = FaweVersion.tryParse(versionString, commitString, dateString); this.version = FaweVersion.tryParse(versionString, commitString, dateString);
Settings.IMP.DATE = new Date(100 + version.year, version.month, version.day).toGMTString(); //noinspection MagicConstant
GregorianCalendar gregorianCalendar = new GregorianCalendar(2000 + version.year,
version.month - 1, version.day);
gregorianCalendar.setTimeZone(TimeZone.getTimeZone("GMT"));
Settings.IMP.DATE = DateFormat.getDateInstance().format(gregorianCalendar.getTime());
Settings.IMP.BUILD = "https://ci.athion.net/job/FastAsyncWorldEdit-1.15/" + version.build; Settings.IMP.BUILD = "https://ci.athion.net/job/FastAsyncWorldEdit-1.15/" + version.build;
Settings.IMP.COMMIT = "https://github.com/IntellectualSites/FastAsyncWorldEdit-1.13/commit/" + Integer.toHexString(version.hash); Settings.IMP.COMMIT = "https://github.com/IntellectualSites/FastAsyncWorldEdit-1.13/commit/" + Integer.toHexString(version.hash);
} catch (Throwable ignore) {} } catch (Throwable ignore) {}
@ -412,12 +421,4 @@ public class Fawe {
return INSTANCE == null || INSTANCE.thread == Thread.currentThread(); return INSTANCE == null || INSTANCE.thread == Thread.currentThread();
} }
/**
* Sets the main thread to the current thread
*
* @return
*/
public Thread setMainThread() {
return this.thread = Thread.currentThread();
}
} }

View File

@ -31,9 +31,9 @@ import java.util.function.Supplier
object FaweCache : Trimable { object FaweCache : Trimable {
const val BLOCKS_PER_LAYER = 4096 const val BLOCKS_PER_LAYER = 4096
const val CHUNK_LAYERS = 16 const val chunkLayers = 16
const val WORLD_HEIGHT = CHUNK_LAYERS shl 4 const val worldHeight = chunkLayers shl 4
const val WORLD_MAX_Y = WORLD_HEIGHT - 1 const val worldMaxY = 255
val EMPTY_CHAR_4096 = CharArray(4096) val EMPTY_CHAR_4096 = CharArray(4096)
@ -57,7 +57,7 @@ object FaweCache : Trimable {
result result
} }
val SECTION_BITS_TO_CHAR = CleanableThreadLocal { CharArray(4096) } val sectionBitsToChar = CleanableThreadLocal { CharArray(4096) }
val PALETTE_TO_BLOCK = CleanableThreadLocal { IntArray(Character.MAX_VALUE.toInt() + 1) } val PALETTE_TO_BLOCK = CleanableThreadLocal { IntArray(Character.MAX_VALUE.toInt() + 1) }
@ -67,23 +67,23 @@ object FaweCache : Trimable {
}, fun(a: CharArray): Unit = Arrays.fill(a, Char.MAX_VALUE) }, fun(a: CharArray): Unit = Arrays.fill(a, Char.MAX_VALUE)
) )
val BLOCK_STATES = CleanableThreadLocal { LongArray(2048) } val blockStates = CleanableThreadLocal { LongArray(2048) }
val SECTION_BLOCKS = CleanableThreadLocal { IntArray(4096) } val sectionBlocks = CleanableThreadLocal { IntArray(4096) }
val INDEX_STORE = CleanableThreadLocal { IntArray(256) } val indexStore = CleanableThreadLocal { IntArray(256) }
val HEIGHT_STORE = CleanableThreadLocal { IntArray(256) } val heightStore = CleanableThreadLocal { IntArray(256) }
private val PALETTE_CACHE = CleanableThreadLocal(Supplier { Palette() }) private val paletteCache = CleanableThreadLocal(Supplier { Palette() })
/* /*
* Vector cache * Vector cache
*/ */
var MUTABLE_BLOCKVECTOR3 = CleanableThreadLocal(Supplier { MutableBlockVector3() }) var mutableBlockVector3 = CleanableThreadLocal(Supplier { MutableBlockVector3() })
var MUTABLE_VECTOR3: CleanableThreadLocal<MutableVector3> = object : CleanableThreadLocal<MutableVector3>(Supplier { MutableVector3() }) { var mutableVector3: CleanableThreadLocal<MutableVector3> = object : CleanableThreadLocal<MutableVector3>(Supplier { MutableVector3() }) {
override fun init(): MutableVector3 { override fun init(): MutableVector3 {
return MutableVector3() return MutableVector3()
} }
@ -102,15 +102,15 @@ object FaweCache : Trimable {
BYTE_BUFFER_8192.clean() BYTE_BUFFER_8192.clean()
BLOCK_TO_PALETTE.clean() BLOCK_TO_PALETTE.clean()
PALETTE_TO_BLOCK.clean() PALETTE_TO_BLOCK.clean()
BLOCK_STATES.clean() blockStates.clean()
SECTION_BLOCKS.clean() sectionBlocks.clean()
PALETTE_CACHE.clean() paletteCache.clean()
PALETTE_TO_BLOCK_CHAR.clean() PALETTE_TO_BLOCK_CHAR.clean()
INDEX_STORE.clean() indexStore.clean()
MUTABLE_VECTOR3.clean() mutableVector3.clean()
MUTABLE_BLOCKVECTOR3.clean() mutableBlockVector3.clean()
SECTION_BITS_TO_CHAR.clean() sectionBitsToChar.clean()
for ((_, value) in REGISTERED_SINGLETONS) { for ((_, value) in REGISTERED_SINGLETONS) {
value.clean() value.clean()
} }
@ -239,8 +239,8 @@ object FaweCache : Trimable {
private fun toPalette(layerOffset: Int, blocksInts: IntArray?, blocksChars: CharArray?): Palette { private fun toPalette(layerOffset: Int, blocksInts: IntArray?, blocksChars: CharArray?): Palette {
val blockToPalette = BLOCK_TO_PALETTE.get() val blockToPalette = BLOCK_TO_PALETTE.get()
val paletteToBlock = PALETTE_TO_BLOCK.get() val paletteToBlock = PALETTE_TO_BLOCK.get()
val blockStates = BLOCK_STATES.get() val blockStates = blockStates.get()
val blocksCopy = SECTION_BLOCKS.get() val blocksCopy = sectionBlocks.get()
val blockIndexStart = layerOffset shl 12 val blockIndexStart = layerOffset shl 12
val blockIndexEnd = blockIndexStart + 4096 val blockIndexEnd = blockIndexStart + 4096
@ -305,7 +305,7 @@ object FaweCache : Trimable {
} }
// Construct palette // Construct palette
val palette = PALETTE_CACHE.get() val palette = paletteCache.get()
palette.bitsPerEntry = bitsPerEntry palette.bitsPerEntry = bitsPerEntry
palette.paletteToBlockLength = num_palette palette.paletteToBlockLength = num_palette
palette.paletteToBlock = paletteToBlock palette.paletteToBlock = paletteToBlock
@ -419,7 +419,7 @@ object FaweCache : Trimable {
return asTag((if (value) 1 else 0).toByte()) return asTag((if (value) 1 else 0).toByte())
} else if (value == null) { } else if (value == null) {
println("Invalid nbt: " + value!!) println("Invalid nbt: " + value!!)
return null return value
} else { } else {
val clazz = value.javaClass val clazz = value.javaClass
if (clazz.name.startsWith("com.intellectualcrafters.jnbt")) { if (clazz.name.startsWith("com.intellectualcrafters.jnbt")) {
@ -507,15 +507,15 @@ object FaweCache : Trimable {
} }
} }
val CHUNK = FaweChunkLoadException() val chunk = FaweChunkLoadException()
val BLOCK_BAG = FaweBlockBagException() val blockBag = FaweBlockBagException()
val MANUAL = FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.manual")) val manual = FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.manual"))
val NO_REGION = FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.no.region")) val noRegion = FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.no.region"))
val OUTSIDE_REGION = FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.outside.region")) val outsideRegion = FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.outside.region"))
val MAX_CHECKS = FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.max.checks")) val maxChecks = FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.max.checks"))
val MAX_CHANGES = FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.max.changes")) val maxChanges = FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.max.changes"))
val LOW_MEMORY = FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.low.memory")) val lowMemory = FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.low.memory"))
val MAX_ENTITIES = FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.max.entities")) val maxEntities = FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.max.entities"))
val MAX_TILES = FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.max.tiles")) val maxTiles = FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.max.tiles"))
val MAX_ITERATIONS = FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.max.iterations")) val maxIterations = FaweException(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.max.iterations"))
} }

View File

@ -1,13 +1,10 @@
package com.boydti.fawe.beta; package com.boydti.fawe.beta;
import com.boydti.fawe.FaweCache; import com.boydti.fawe.FaweCache;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import java.util.HashMap; import java.util.HashMap;
@ -34,7 +31,7 @@ public class CombinedBlocks implements IBlocks {
@Override @Override
public int getBitMask() { public int getBitMask() {
int bitMask = addMask; int bitMask = addMask;
for (int layer = 0; layer < FaweCache.CHUNK_LAYERS; layer++) { for (int layer = 0; layer < FaweCache.chunkLayers; layer++) {
if (primary.hasSection(layer)) { if (primary.hasSection(layer)) {
bitMask |= (1 << layer); bitMask |= (1 << layer);
} }

View File

@ -56,7 +56,7 @@ public interface IBatchProcessor {
} }
} }
int maxLayer = (maxY + 1) >> 4; int maxLayer = (maxY + 1) >> 4;
for (int layer = maxLayer; layer < FaweCache.CHUNK_LAYERS; layer++) { for (int layer = maxLayer; layer < FaweCache.chunkLayers; layer++) {
if (set.hasSection(layer)) { if (set.hasSection(layer)) {
if (layer == minLayer) { if (layer == minLayer) {
char[] arr = set.load(layer); char[] arr = set.load(layer);

View File

@ -36,7 +36,7 @@ public interface IBlocks extends Trimable {
BiomeType getBiomeType(int x, int y, int z); BiomeType getBiomeType(int x, int y, int z);
default int getBitMask() { default int getBitMask() {
return IntStream.range(0, FaweCache.CHUNK_LAYERS).filter(this::hasSection) return IntStream.range(0, FaweCache.chunkLayers).filter(this::hasSection)
.map(layer -> (1 << layer)).sum(); .map(layer -> (1 << layer)).sum();
} }
@ -56,7 +56,7 @@ public interface IBlocks extends Trimable {
FaweOutputStream sectionWriter = new FaweOutputStream(sectionByteArray); FaweOutputStream sectionWriter = new FaweOutputStream(sectionByteArray);
try { try {
for (int layer = 0; layer < FaweCache.CHUNK_LAYERS; layer++) { for (int layer = 0; layer < FaweCache.chunkLayers; layer++) {
if (!this.hasSection(layer) || (bitMask & (1 << layer)) == 0) continue; if (!this.hasSection(layer) || (bitMask & (1 << layer)) == 0) continue;
char[] ids = this.load(layer); char[] ids = this.load(layer);

View File

@ -78,7 +78,7 @@ public interface IQueueExtent<T extends IChunk> extends Flushable, Trimable, ICh
@Override @Override
default BlockVector3 getMaximumPoint() { default BlockVector3 getMaximumPoint() {
return BlockVector3.at(30000000, FaweCache.WORLD_MAX_Y, 30000000); return BlockVector3.at(30000000, FaweCache.worldMaxY, 30000000);
} }
/** /**

View File

@ -84,7 +84,7 @@ public class BitSetBlocks implements IChunkSet {
@Override @Override
public char[] load(int layer) { public char[] load(int layer) {
char[] arr = FaweCache.INSTANCE.getSECTION_BITS_TO_CHAR().get(); char[] arr = FaweCache.INSTANCE.getSectionBitsToChar().get();
MemBlockSet.IRow nullRowY = row.getRow(layer); MemBlockSet.IRow nullRowY = row.getRow(layer);
if (nullRowY instanceof MemBlockSet.RowY) { if (nullRowY instanceof MemBlockSet.RowY) {
char value = blockState.getOrdinalChar(); char value = blockState.getOrdinalChar();

View File

@ -142,7 +142,7 @@ public class FallbackChunkGet implements IChunkGet {
@Override @Override
public char[] load(int layer) { public char[] load(int layer) {
char[] arr = FaweCache.INSTANCE.getSECTION_BITS_TO_CHAR().get(); char[] arr = FaweCache.INSTANCE.getSectionBitsToChar().get();
int by = layer << 4; int by = layer << 4;
for (int y = 0, i = 0; y < 16; y++) { for (int y = 0, i = 0; y < 16; y++) {
for (int z = 0; z < 16; z++) { for (int z = 0; z < 16; z++) {

View File

@ -23,6 +23,7 @@ import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import org.jetbrains.annotations.Range;
/** /**
* An abstract {@link IChunk} class that implements basic get/set blocks * An abstract {@link IChunk} class that implements basic get/set blocks
@ -39,7 +40,9 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
private IChunkSet chunkSet; // The blocks to be set to the chunkExisting private IChunkSet chunkSet; // The blocks to be set to the chunkExisting
private IBlockDelegate delegate; // delegate handles the abstraction of the chunk layers private IBlockDelegate delegate; // delegate handles the abstraction of the chunk layers
private IQueueExtent extent; // the parent queue extent which has this chunk private IQueueExtent extent; // the parent queue extent which has this chunk
@Range(from = 0, to = 15)
private int chunkX; private int chunkX;
@Range(from = 0, to = 15)
private int chunkZ; private int chunkZ;
public ChunkHolder() { public ChunkHolder() {

View File

@ -29,22 +29,21 @@ import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import javax.annotation.Nullable;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import javax.annotation.Nullable;
public class LimitExtent extends PassthroughExtent { public class LimitExtent extends PassthroughExtent {
private final FaweLimit limit; private final FaweLimit limit;
/** /**
* Create a new instance. * Create a new instance.
* *
* @param extent the extent * @param extent the extent
*/ */
public LimitExtent(Extent extent, FaweLimit limit) { public LimitExtent(Extent extent, FaweLimit limit) {
super(extent); super(extent);
this.limit = limit; this.limit = limit;
@ -119,7 +118,7 @@ public class LimitExtent extends PassthroughExtent {
@Override @Override
public int getHighestTerrainBlock(int x, int z, int minY, int maxY) { public int getHighestTerrainBlock(int x, int z, int minY, int maxY) {
limit.THROW_MAX_CHECKS(FaweCache.WORLD_HEIGHT); limit.THROW_MAX_CHECKS(FaweCache.worldHeight);
try { try {
return getExtent().getHighestTerrainBlock(x, z, minY, maxY); return getExtent().getHighestTerrainBlock(x, z, minY, maxY);
} catch (FaweException e) { } catch (FaweException e) {
@ -132,7 +131,7 @@ public class LimitExtent extends PassthroughExtent {
@Override @Override
public int getHighestTerrainBlock(int x, int z, int minY, int maxY, Mask filter) { public int getHighestTerrainBlock(int x, int z, int minY, int maxY, Mask filter) {
limit.THROW_MAX_CHECKS(FaweCache.WORLD_HEIGHT); limit.THROW_MAX_CHECKS(FaweCache.worldHeight);
try { try {
return getExtent().getHighestTerrainBlock(x, z, minY, maxY, filter); return getExtent().getHighestTerrainBlock(x, z, minY, maxY, filter);
} catch (FaweException e) { } catch (FaweException e) {
@ -145,7 +144,7 @@ public class LimitExtent extends PassthroughExtent {
@Override @Override
public int getNearestSurfaceLayer(int x, int z, int y, int minY, int maxY) { public int getNearestSurfaceLayer(int x, int z, int y, int minY, int maxY) {
limit.THROW_MAX_CHECKS(FaweCache.WORLD_HEIGHT); limit.THROW_MAX_CHECKS(FaweCache.worldHeight);
try { try {
return getExtent().getNearestSurfaceLayer(x, z, y, minY, maxY); return getExtent().getNearestSurfaceLayer(x, z, y, minY, maxY);
} catch (FaweException e) { } catch (FaweException e) {
@ -158,7 +157,7 @@ public class LimitExtent extends PassthroughExtent {
@Override @Override
public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, boolean ignoreAir) { public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, boolean ignoreAir) {
limit.THROW_MAX_CHECKS(FaweCache.WORLD_HEIGHT); limit.THROW_MAX_CHECKS(FaweCache.worldHeight);
try { try {
return getExtent().getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, ignoreAir); return getExtent().getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, ignoreAir);
} catch (FaweException e) { } catch (FaweException e) {
@ -171,7 +170,7 @@ public class LimitExtent extends PassthroughExtent {
@Override @Override
public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY) { public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY) {
limit.THROW_MAX_CHECKS(FaweCache.WORLD_HEIGHT); limit.THROW_MAX_CHECKS(FaweCache.worldHeight);
try { try {
return getExtent().getNearestSurfaceTerrainBlock(x, z, y, minY, maxY); return getExtent().getNearestSurfaceTerrainBlock(x, z, y, minY, maxY);
} catch (FaweException e) { } catch (FaweException e) {
@ -184,7 +183,7 @@ public class LimitExtent extends PassthroughExtent {
@Override @Override
public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, int failedMin, int failedMax) { public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, int failedMin, int failedMax) {
limit.THROW_MAX_CHECKS(FaweCache.WORLD_HEIGHT); limit.THROW_MAX_CHECKS(FaweCache.worldHeight);
try { try {
return getExtent().getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax); return getExtent().getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax);
} catch (FaweException e) { } catch (FaweException e) {
@ -197,7 +196,7 @@ public class LimitExtent extends PassthroughExtent {
@Override @Override
public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, int failedMin, int failedMax, Mask mask) { public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, int failedMin, int failedMax, Mask mask) {
limit.THROW_MAX_CHECKS(FaweCache.WORLD_HEIGHT); limit.THROW_MAX_CHECKS(FaweCache.worldHeight);
try { try {
return getExtent().getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax, mask); return getExtent().getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax, mask);
} catch (FaweException e) { } catch (FaweException e) {
@ -210,7 +209,7 @@ public class LimitExtent extends PassthroughExtent {
@Override @Override
public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, int failedMin, int failedMax, boolean ignoreAir) { public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, int failedMin, int failedMax, boolean ignoreAir) {
limit.THROW_MAX_CHECKS(FaweCache.WORLD_HEIGHT); limit.THROW_MAX_CHECKS(FaweCache.worldHeight);
try { try {
return getExtent().getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax, ignoreAir); return getExtent().getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax, ignoreAir);
} catch (FaweException e) { } catch (FaweException e) {

View File

@ -58,7 +58,7 @@ public class ParallelQueueExtent extends PassthroughExtent implements IQueueWrap
@Override @Override
public boolean cancel() { public boolean cancel() {
if (super.cancel()) { if (super.cancel()) {
processor.setProcessor(new NullExtent(this, FaweCache.INSTANCE.getMANUAL())); processor.setProcessor(new NullExtent(this, FaweCache.INSTANCE.getManual()));
return true; return true;
} }
return false; return false;

View File

@ -1,312 +0,0 @@
package com.boydti.fawe.jnbt;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.clipboard.CPUOptimizedClipboard;
import com.boydti.fawe.object.clipboard.DiskOptimizedClipboard;
import com.boydti.fawe.object.clipboard.LinearClipboard;
import com.boydti.fawe.object.clipboard.MemoryOptimizedClipboard;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.math.BlockVector3;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.zip.GZIPInputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CorruptSchematicStreamer {
private final Logger log = LoggerFactory.getLogger(CorruptSchematicStreamer.class);
private final InputStream stream;
private final UUID uuid;
private LinearClipboard fc;
final AtomicInteger volume = new AtomicInteger();
final AtomicInteger width = new AtomicInteger();
final AtomicInteger height = new AtomicInteger();
final AtomicInteger length = new AtomicInteger();
final AtomicInteger offsetX = new AtomicInteger();
final AtomicInteger offsetY = new AtomicInteger();
final AtomicInteger offsetZ = new AtomicInteger();
final AtomicInteger originX = new AtomicInteger();
final AtomicInteger originY = new AtomicInteger();
final AtomicInteger originZ = new AtomicInteger();
public CorruptSchematicStreamer(InputStream rootStream, UUID uuid) {
this.stream = rootStream;
this.uuid = uuid;
}
public void match(String matchTag, CorruptReader reader) {
try {
stream.reset();
stream.mark(Integer.MAX_VALUE);
DataInputStream dataInput = new DataInputStream(new BufferedInputStream(new GZIPInputStream(stream)));
byte[] match = matchTag.getBytes();
int[] matchValue = new int[match.length];
int matchIndex = 0;
int read;
while ((read = dataInput.read()) != -1) {
int expected = match[matchIndex];
if (expected == -1) {
if (++matchIndex == match.length) {
break;
}
} else if (read == expected) {
if (++matchIndex == match.length) {
reader.run(dataInput);
break;
}
} else {
if (matchIndex == 2)
matchIndex = 0;
}
}
log.debug(" - Recover " + matchTag + " = success");
} catch (Throwable e) {
log.error(" - Recover " + matchTag + " = partial failure", e);
}
}
public LinearClipboard setupClipboard() {
if (fc != null) {
return fc;
}
BlockVector3 dimensions = guessDimensions(volume.get(), width.get(), height.get(), length.get());
if (width.get() == 0 || height.get() == 0 || length.get() == 0) {
log.debug("No dimensions found! Estimating based on factors:" + dimensions);
}
if (Settings.IMP.CLIPBOARD.USE_DISK) {
fc = new DiskOptimizedClipboard(dimensions, uuid);
} else if (Settings.IMP.CLIPBOARD.COMPRESSION_LEVEL == 0) {
fc = new CPUOptimizedClipboard(dimensions);
} else {
fc = new MemoryOptimizedClipboard(dimensions);
}
return fc;
}
public Clipboard recover() {
// TODO FIXME
throw new UnsupportedOperationException("TODO FIXME");
// try {
// if (stream == null || !stream.markSupported()) {
// throw new IllegalArgumentException("Can only recover from a marked and resettable stream!");
// }
// match("Width", new CorruptSchematicStreamer.CorruptReader() {
// @Override
// public void run(DataInputStream in) throws IOException {
// width.set(in.readShort());
// }
// });
// match("Height", new CorruptSchematicStreamer.CorruptReader() {
// @Override
// public void run(DataInputStream in) throws IOException {
// height.set(in.readShort());
// }
// });
// match("Length", new CorruptSchematicStreamer.CorruptReader() {
// @Override
// public void run(DataInputStream in) throws IOException {
// length.set(in.readShort());
// }
// });
// match("WEOffsetX", new CorruptSchematicStreamer.CorruptReader() {
// @Override
// public void run(DataInputStream in) throws IOException {
// offsetX.set(in.readInt());
// }
// });
// match("WEOffsetY", new CorruptSchematicStreamer.CorruptReader() {
// @Override
// public void run(DataInputStream in) throws IOException {
// offsetY.set(in.readInt());
// }
// });
// match("WEOffsetZ", new CorruptSchematicStreamer.CorruptReader() {
// @Override
// public void run(DataInputStream in) throws IOException {
// offsetZ.set(in.readInt());
// }
// });
// match("WEOriginX", new CorruptSchematicStreamer.CorruptReader() {
// @Override
// public void run(DataInputStream in) throws IOException {
// originX.set(in.readInt());
// }
// });
// match("WEOriginY", new CorruptSchematicStreamer.CorruptReader() {
// @Override
// public void run(DataInputStream in) throws IOException {
// originY.set(in.readInt());
// }
// });
// match("WEOriginZ", new CorruptSchematicStreamer.CorruptReader() {
// @Override
// public void run(DataInputStream in) throws IOException {
// originZ.set(in.readInt());
// }
// });
// match("Blocks", new CorruptSchematicStreamer.CorruptReader() {
// @Override
// public void run(DataInputStream in) throws IOException {
// int length = in.readInt();
// volume.set(length);
// setupClipboard();
// for (int i = 0; i < length; i++) {
// fc.setId(i, in.read());
// }
// }
// });
// match("Data", new CorruptSchematicStreamer.CorruptReader() {
// @Override
// public void run(DataInputStream in) throws IOException {
// int length = in.readInt();
// volume.set(length);
// setupClipboard();
// for (int i = 0; i < length; i++) {
// fc.setData(i, in.read());
// }
// }
// });
// match("AddBlocks", new CorruptSchematicStreamer.CorruptReader() {
// @Override
// public void run(DataInputStream in) throws IOException {
// int length = in.readInt();
// int expected = volume.get();
// if (expected == 0) {
// expected = length * 2;
// volume.set(expected);
// }
// setupClipboard();
// if (expected == length * 2) {
// for (int i = 0; i < length; i++) {
// int value = in.read();
// int first = value & 0x0F;
// int second = (value & 0xF0) >> 4;
// int gIndex = i << 1;
// if (first != 0) fc.setAdd(gIndex, first);
// if (second != 0) fc.setAdd(gIndex + 1, second);
// }
// } else {
// for (int i = 0; i < length; i++) {
// int value = in.read();
// if (value != 0) fc.setAdd(i, value);
// }
// }
// }
// });
// match("Biomes", new CorruptSchematicStreamer.CorruptReader() {
// @Override
// public void run(DataInputStream in) throws IOException {
// int length = in.readInt();
// for (int i = 0; i < length; i++) {
// fc.setBiome(i, in.read());
// }
// }
// });
// Vector dimensions = guessDimensions(volume.get(), width.get(), height.get(), length.get());
// Vector min = new Vector(originX.get(), originY.get(), originZ.get());
// Vector offset = new Vector(offsetX.get(), offsetY.get(), offsetZ.get());
// Vector origin = min.subtract(offset);
// CuboidRegion region = new CuboidRegion(min, min.add(dimensions.getBlockX(), dimensions.getBlockY(), dimensions.getBlockZ()).subtract(Vector.ONE));
// fc.setOrigin(offset);
// final BlockArrayClipboard clipboard = new BlockArrayClipboard(region, fc);
// match("TileEntities", new CorruptSchematicStreamer.CorruptReader() {
// @Override
// public void run(DataInputStream in) throws IOException {
// int childType = in.readByte();
// int length = in.readInt();
// NBTInputStream nis = new NBTInputStream(in);
// for (int i = 0; i < length; ++i) {
// CompoundTag tag = (CompoundTag) nis.readTagPayload(childType, 1);
// int x = tag.getInt("x");
// int y = tag.getInt("y");
// int z = tag.getInt("z");
// fc.setTile(x, y, z, tag);
// }
// }
// });
// match("Entities", new CorruptSchematicStreamer.CorruptReader() {
// @Override
// public void run(DataInputStream in) throws IOException {
// int childType = in.readByte();
// int length = in.readInt();
// NBTInputStream nis = new NBTInputStream(in);
// for (int i = 0; i < length; ++i) {
// CompoundTag tag = (CompoundTag) nis.readTagPayload(childType, 1);
// int x = tag.getInt("x");
// int y = tag.getInt("y");
// int z = tag.getInt("z");
// String id = tag.getString("id");
// if (id.isEmpty()) {
// return;
// }
// ListTag positionTag = tag.getListTag("Pos");
// ListTag directionTag = tag.getListTag("Rotation");
// BaseEntity state = new BaseEntity(id, tag);
// fc.createEntity(clipboard, positionTag.asDouble(0), positionTag.asDouble(1), positionTag.asDouble(2), (float) directionTag.asDouble(0), (float) directionTag.asDouble(1), state);
// }
// }
// });
// return clipboard;
// } catch (Throwable e) {
// if (fc != null) fc.close();
// throw e;
// }
}
private BlockVector3 guessDimensions(int volume, int width, int height, int length) {
if (volume == 0) {
return BlockVector3.at(width, height, length);
}
if (volume == width * height * length) {
return BlockVector3.at(width, height, length);
}
if (width == 0 && height != 0 && length != 0 && volume % (height * length) == 0 && height * length <= volume) {
return BlockVector3.at(volume / (height * length), height, length);
}
if (height == 0 && width != 0 && length != 0 && volume % (width * length) == 0 && width * length <= volume) {
return BlockVector3.at(width, volume / (width * length), length);
}
if (length == 0 && height != 0 && width != 0 && volume % (height * width) == 0 && height * width <= volume) {
return BlockVector3.at(width, height, volume / (width * height));
}
List<Integer> factors = new ArrayList<>();
for (int i = (int) Math.sqrt(volume); i > 0; i--) {
if (volume % i == 0) {
factors.add(i);
factors.add(volume / i);
}
}
int min = Integer.MAX_VALUE;
int vx = 0, vy = 0, vz = 0;
for (int x = 0; x < factors.size(); x++) {
int xValue = factors.get(x);
for (int yValue : factors) {
long area = xValue * yValue;
if (volume % area == 0) {
int z = (int) (volume / area);
int max = Math.max(Math.max(xValue, yValue), z);
if (max < min) {
min = max;
vx = xValue;
vz = z;
vy = yValue;
}
}
}
}
return BlockVector3.at(vx, vz, vy);
}
public interface CorruptReader {
void run(DataInputStream in) throws IOException;
}
}

View File

@ -47,7 +47,7 @@ public class MCAChunk implements IChunk {
public final boolean[] hasSections = new boolean[16]; public final boolean[] hasSections = new boolean[16];
public boolean hasBiomes = false; public boolean hasBiomes = false;
public final BiomeType[] biomes = new BiomeType[256]; public final BiomeType[] biomes = new BiomeType[1024];
public final char[] blocks = new char[65536]; public final char[] blocks = new char[65536];
@ -72,7 +72,7 @@ public class MCAChunk implements IChunk {
int bitsPerEntry = MathMan.log2nlz(section.palette.length - 1); int bitsPerEntry = MathMan.log2nlz(section.palette.length - 1);
BitArray4096 bitArray = new BitArray4096(section.blocks, bitsPerEntry); BitArray4096 bitArray = new BitArray4096(section.blocks, bitsPerEntry);
char[] buffer = FaweCache.INSTANCE.getSECTION_BITS_TO_CHAR().get(); char[] buffer = FaweCache.INSTANCE.getSectionBitsToChar().get();
bitArray.toRaw(buffer); bitArray.toRaw(buffer);
int offset = section.layer << 12; int offset = section.layer << 12;
for (int i = 0; i < buffer.length; i++) { for (int i = 0; i < buffer.length; i++) {
@ -220,8 +220,8 @@ public class MCAChunk implements IChunk {
public void write(NBTOutputStream nbtOut) throws IOException { public void write(NBTOutputStream nbtOut) throws IOException {
int[] blockToPalette = FaweCache.INSTANCE.getBLOCK_TO_PALETTE().get(); int[] blockToPalette = FaweCache.INSTANCE.getBLOCK_TO_PALETTE().get();
int[] paletteToBlock = FaweCache.INSTANCE.getPALETTE_TO_BLOCK().get(); int[] paletteToBlock = FaweCache.INSTANCE.getPALETTE_TO_BLOCK().get();
long[] blockstates = FaweCache.INSTANCE.getBLOCK_STATES().get(); long[] blockstates = FaweCache.INSTANCE.getBlockStates().get();
int[] blocksCopy = FaweCache.INSTANCE.getSECTION_BLOCKS().get(); int[] blocksCopy = FaweCache.INSTANCE.getSectionBlocks().get();
nbtOut.writeNamedTagName("", NBTConstants.TYPE_COMPOUND); nbtOut.writeNamedTagName("", NBTConstants.TYPE_COMPOUND);
nbtOut.writeNamedTag("DataVersion", 1631); nbtOut.writeNamedTag("DataVersion", 1631);
@ -243,7 +243,7 @@ public class MCAChunk implements IChunk {
out.writeNamedTag("InhabitedTime", inhabitedTime); out.writeNamedTag("InhabitedTime", inhabitedTime);
out.writeNamedTag("LastUpdate", lastUpdate); out.writeNamedTag("LastUpdate", lastUpdate);
if (hasBiomes) { if (hasBiomes) {
int type = NBTConstants.TYPE_BYTE_ARRAY; int type = NBTConstants.TYPE_INT_ARRAY;
out.writeNamedTagName("Biomes", type); out.writeNamedTagName("Biomes", type);
out.writeInt(biomes.length); out.writeInt(biomes.length);
for (BiomeType biome : biomes) { for (BiomeType biome : biomes) {
@ -524,7 +524,7 @@ public class MCAChunk implements IChunk {
@Override @Override
public char[] load(int layer) { public char[] load(int layer) {
char[] tmp = FaweCache.INSTANCE.getSECTION_BITS_TO_CHAR().get(); char[] tmp = FaweCache.INSTANCE.getSectionBitsToChar().get();
int offset = layer << 12; int offset = layer << 12;
System.arraycopy(blocks, offset, tmp, 0, 4096); System.arraycopy(blocks, offset, tmp, 0, 4096);
return tmp; return tmp;

View File

@ -138,7 +138,7 @@ public class MCAFile extends ExtentBatchProcessorHolder implements Trimable, ICh
@Override @Override
public BlockVector3 getMaximumPoint() { public BlockVector3 getMaximumPoint() {
return BlockVector3.at((this.X << 9) + 511, FaweCache.WORLD_MAX_Y, (this.Z << 9) + 511); return BlockVector3.at((this.X << 9) + 511, FaweCache.worldMaxY, (this.Z << 9) + 511);
} }
@Override @Override

View File

@ -1,42 +0,0 @@
package com.boydti.fawe.object;
import com.boydti.fawe.util.MathMan;
public class BytePair {
public short pair;
public BytePair(final byte x, final byte z) {
this.pair = MathMan.pairByte(x, z);
}
public int get0x() {
return MathMan.unpair16x((byte) get0());
}
public int get0y() {
return MathMan.unpair16y((byte) get0());
}
public int get0() {
return MathMan.unpairShortX(pair);
}
public int get1() {
return MathMan.unpairShortY(pair);
}
@Override
public int hashCode() {
return pair;
}
@Override
public String toString() {
return pair + "";
}
@Override
public boolean equals(final Object obj) {
return obj.hashCode() == pair;
}
}

View File

@ -136,51 +136,51 @@ public class FaweLimit {
} }
public void THROW_MAX_CHANGES() { public void THROW_MAX_CHANGES() {
if (MAX_CHANGES-- <= 0) throw FaweCache.INSTANCE.getMAX_CHANGES(); if (MAX_CHANGES-- <= 0) throw FaweCache.INSTANCE.getMaxChanges();
} }
public void THROW_MAX_FAILS() { public void THROW_MAX_FAILS() {
if (MAX_FAILS-- <= 0) throw FaweCache.INSTANCE.getMAX_CHECKS(); if (MAX_FAILS-- <= 0) throw FaweCache.INSTANCE.getMaxChecks();
} }
public void THROW_MAX_CHECKS() { public void THROW_MAX_CHECKS() {
if (MAX_CHECKS-- <= 0) throw FaweCache.INSTANCE.getMAX_CHECKS(); if (MAX_CHECKS-- <= 0) throw FaweCache.INSTANCE.getMaxChecks();
} }
public void THROW_MAX_ITERATIONS() { public void THROW_MAX_ITERATIONS() {
if (MAX_ITERATIONS-- <= 0) throw FaweCache.INSTANCE.getMAX_ITERATIONS(); if (MAX_ITERATIONS-- <= 0) throw FaweCache.INSTANCE.getMaxIterations();
} }
public void THROW_MAX_BLOCKSTATES() { public void THROW_MAX_BLOCKSTATES() {
if (MAX_BLOCKSTATES-- <= 0) throw FaweCache.INSTANCE.getMAX_TILES(); if (MAX_BLOCKSTATES-- <= 0) throw FaweCache.INSTANCE.getMaxTiles();
} }
public void THROW_MAX_ENTITIES() { public void THROW_MAX_ENTITIES() {
if (MAX_ENTITIES-- <= 0) throw FaweCache.INSTANCE.getMAX_ENTITIES(); if (MAX_ENTITIES-- <= 0) throw FaweCache.INSTANCE.getMaxEntities();
} }
public void THROW_MAX_CHANGES(int amt) { public void THROW_MAX_CHANGES(int amt) {
if ((MAX_CHANGES -= amt) <= 0) throw FaweCache.INSTANCE.getMAX_CHANGES(); if ((MAX_CHANGES -= amt) <= 0) throw FaweCache.INSTANCE.getMaxChanges();
} }
public void THROW_MAX_FAILS(int amt) { public void THROW_MAX_FAILS(int amt) {
if ((MAX_FAILS -= amt) <= 0) throw FaweCache.INSTANCE.getMAX_CHECKS(); if ((MAX_FAILS -= amt) <= 0) throw FaweCache.INSTANCE.getMaxChecks();
} }
public void THROW_MAX_CHECKS(int amt) { public void THROW_MAX_CHECKS(int amt) {
if ((MAX_CHECKS -= amt) <= 0) throw FaweCache.INSTANCE.getMAX_CHECKS(); if ((MAX_CHECKS -= amt) <= 0) throw FaweCache.INSTANCE.getMaxChecks();
} }
public void THROW_MAX_ITERATIONS(int amt) { public void THROW_MAX_ITERATIONS(int amt) {
if ((MAX_ITERATIONS -= amt) <= 0) throw FaweCache.INSTANCE.getMAX_ITERATIONS(); if ((MAX_ITERATIONS -= amt) <= 0) throw FaweCache.INSTANCE.getMaxIterations();
} }
public void THROW_MAX_BLOCKSTATES(int amt) { public void THROW_MAX_BLOCKSTATES(int amt) {
if ((MAX_BLOCKSTATES -= amt) <= 0) throw FaweCache.INSTANCE.getMAX_TILES(); if ((MAX_BLOCKSTATES -= amt) <= 0) throw FaweCache.INSTANCE.getMaxTiles();
} }
public void THROW_MAX_ENTITIES(int amt) { public void THROW_MAX_ENTITIES(int amt) {
if ((MAX_ENTITIES -= amt) <= 0) throw FaweCache.INSTANCE.getMAX_ENTITIES(); if ((MAX_ENTITIES -= amt) <= 0) throw FaweCache.INSTANCE.getMaxEntities();
} }
public boolean isUnlimited() { public boolean isUnlimited() {

View File

@ -1,33 +0,0 @@
package com.boydti.fawe.object;
public class IntegerPair {
public int x;
public int z;
public IntegerPair(final int x, final int z) {
this.x = x;
this.z = z;
}
@Override
public int hashCode() {
return (x << 16) | (z & 0xFFFF);
}
@Override
public String toString() {
return x + "," + z;
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if ((obj == null) || (this.getClass() != obj.getClass())) {
return false;
}
final IntegerPair other = (IntegerPair) obj;
return ((this.x == other.x) && (this.z == other.z));
}
}

View File

@ -1,60 +0,0 @@
package com.boydti.fawe.object;
public class IntegerTrio {
public int x, y, z;
public IntegerTrio(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
}
public IntegerTrio(IntegerTrio node) {
this.x = node.x;
this.y = node.y;
this.z = node.z;
}
public IntegerTrio() {
}
public final void set(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
}
public final void set(IntegerTrio node) {
this.x = node.x;
this.y = node.y;
this.z = node.z;
}
@Override
public final int hashCode() {
return (x ^ (z << 12)) ^ (y << 24);
}
public final int getX() {
return x;
}
public final int getY() {
return y;
}
public final int getZ() {
return z;
}
@Override
public String toString() {
return x + "," + y + "," + z;
}
@Override
public boolean equals(Object obj) {
IntegerTrio other = (IntegerTrio) obj;
return other.x == x && other.z == z && other.y == y;
}
}

View File

@ -7,6 +7,7 @@ import com.sk89q.worldedit.history.change.Change;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeType;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
public class NullChangeSet extends AbstractChangeSet { public class NullChangeSet extends AbstractChangeSet {
@ -58,7 +59,7 @@ public class NullChangeSet extends AbstractChangeSet {
@Override @Override
public final Iterator<Change> getIterator(boolean undo) { public final Iterator<Change> getIterator(boolean undo) {
return new ArrayList<Change>().iterator(); return Collections.emptyIterator();
} }
@Override @Override

View File

@ -1,20 +0,0 @@
package com.boydti.fawe.object.brush;
import com.sk89q.worldedit.command.tool.BrushTool;
import com.sk89q.worldedit.command.tool.brush.Brush;
public abstract class AbstractBrush implements Brush {
private BrushTool tool;
public AbstractBrush(BrushTool tool) {
this.tool = tool;
}
public void setTool(BrushTool tool) {
this.tool = tool;
}
public BrushTool getTool() {
return tool;
}
}

View File

@ -1,10 +1,5 @@
package com.boydti.fawe.object.brush; package com.boydti.fawe.object.brush;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3;
public class RaiseBrush extends ErodeBrush { public class RaiseBrush extends ErodeBrush {
public RaiseBrush() { public RaiseBrush() {
this(6, 0, 1, 1); this(6, 0, 1, 1);

View File

@ -37,7 +37,7 @@ public class ShatterBrush extends ScatterBrush {
LocalBlockVectorSet set = new LocalBlockVectorSet(); LocalBlockVectorSet set = new LocalBlockVectorSet();
set.add(pos); set.add(pos);
frontiers[i] = set; frontiers[i] = set;
frontiersVisited[i] = set.clone(); frontiersVisited[i] = new LocalBlockVectorSet(set);
i++; i++;
} }
// Mask // Mask

View File

@ -1,7 +1,6 @@
package com.boydti.fawe.object.brush; package com.boydti.fawe.object.brush;
import com.boydti.fawe.FaweCache; import com.boydti.fawe.FaweCache;
import com.sk89q.worldedit.function.mask.DelegateExtentMask;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.object.brush.visualization.VisualExtent; import com.boydti.fawe.object.brush.visualization.VisualExtent;
import com.boydti.fawe.object.mask.IdMask; import com.boydti.fawe.object.mask.IdMask;
@ -63,7 +62,7 @@ public class SplineBrush implements Brush, ResettableTool {
this.position = position; this.position = position;
if (newPos) { if (newPos) {
if (positionSets.size() >= MAX_POINTS) { if (positionSets.size() >= MAX_POINTS) {
throw FaweCache.INSTANCE.getMAX_CHECKS(); throw FaweCache.INSTANCE.getMaxChecks();
} }
final ArrayList<BlockVector3> points = new ArrayList<>(); final ArrayList<BlockVector3> points = new ArrayList<>();
if (size > 0) { if (size > 0) {

View File

@ -1,6 +1,5 @@
package com.boydti.fawe.object.brush.heightmap; package com.boydti.fawe.object.brush.heightmap;
import com.boydti.fawe.object.IntegerPair;
import com.boydti.fawe.util.MainUtil; import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.MathMan; import com.boydti.fawe.util.MathMan;
import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard;
@ -12,6 +11,7 @@ import java.awt.image.Raster;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.HashSet; import java.util.HashSet;
import kotlin.Pair;
public class ScalableHeightMap implements HeightMap { public class ScalableHeightMap implements HeightMap {
public int size2; public int size2;
@ -65,9 +65,9 @@ public class ScalableHeightMap implements HeightMap {
int minY = clipboard.getMinimumPoint().getBlockY(); int minY = clipboard.getMinimumPoint().getBlockY();
int maxY = clipboard.getMaximumPoint().getBlockY(); int maxY = clipboard.getMaximumPoint().getBlockY();
int clipHeight = maxY - minY + 1; int clipHeight = maxY - minY + 1;
HashSet<IntegerPair> visited = new HashSet<>(); HashSet<Pair<Integer, Integer>> visited = new HashSet<>();
for (BlockVector3 pos : clipboard.getRegion()) { for (BlockVector3 pos : clipboard.getRegion()) {
IntegerPair pair = new IntegerPair(pos.getBlockX(), pos.getBlockZ()); Pair<Integer, Integer> pair = new Pair<>(pos.getBlockX(), pos.getBlockZ());
if (visited.contains(pair)) { if (visited.contains(pair)) {
continue; continue;
} }

View File

@ -7,13 +7,9 @@ import com.boydti.fawe.FaweCache;
import com.boydti.fawe.beta.IBlocks; import com.boydti.fawe.beta.IBlocks;
import com.boydti.fawe.beta.IChunkGet; import com.boydti.fawe.beta.IChunkGet;
import com.boydti.fawe.beta.IChunkSet; import com.boydti.fawe.beta.IChunkSet;
import com.boydti.fawe.beta.implementation.filter.block.AbstractFilterBlock;
import com.boydti.fawe.beta.implementation.filter.block.ArrayFilterBlock; import com.boydti.fawe.beta.implementation.filter.block.ArrayFilterBlock;
import com.boydti.fawe.beta.implementation.filter.block.MultiFilterBlock;
import com.boydti.fawe.beta.implementation.filter.block.SingleFilterBlock;
import com.boydti.fawe.beta.implementation.packet.ChunkPacket; import com.boydti.fawe.beta.implementation.packet.ChunkPacket;
import com.boydti.fawe.beta.implementation.blocks.FallbackChunkGet; import com.boydti.fawe.beta.implementation.blocks.FallbackChunkGet;
import com.boydti.fawe.beta.implementation.packet.ChunkPacket;
import com.boydti.fawe.jnbt.anvil.MCAChunk; import com.boydti.fawe.jnbt.anvil.MCAChunk;
import com.boydti.fawe.object.FaweInputStream; import com.boydti.fawe.object.FaweInputStream;
import com.boydti.fawe.object.FaweOutputStream; import com.boydti.fawe.object.FaweOutputStream;
@ -39,7 +35,6 @@ import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.Operation;
@ -59,7 +54,6 @@ import com.sk89q.worldedit.util.TreeGenerator;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.biome.BiomeTypes; import com.sk89q.worldedit.world.biome.BiomeTypes;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockID; import com.sk89q.worldedit.world.block.BlockID;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
@ -1563,12 +1557,12 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
char[] floor = this.floor.get(); char[] floor = this.floor.get();
char[] overlay = this.overlay != null ? this.overlay.get() : null; char[] overlay = this.overlay != null ? this.overlay.get() : null;
try { try {
int[] indexes = FaweCache.INSTANCE.getINDEX_STORE().get(); int[] indexes = FaweCache.INSTANCE.getIndexStore().get();
int index; int index;
int maxY = 0; int maxY = 0;
int minY = Integer.MAX_VALUE; int minY = Integer.MAX_VALUE;
int[] heightMap = FaweCache.INSTANCE.getHEIGHT_STORE().get(); int[] heightMap = FaweCache.INSTANCE.getHeightStore().get();
int globalIndex; int globalIndex;
for (int z = csz; z <= cez; z++) { for (int z = csz; z <= cez; z++) {
globalIndex = z * getWidth() + csx; globalIndex = z * getWidth() + csx;

View File

@ -8,7 +8,7 @@ import com.sk89q.worldedit.world.biome.BiomeTypes;
public class MutableBiomeChange implements Change { public class MutableBiomeChange implements Change {
private MutableBlockVector2 mutable = new MutableBlockVector2(); private final MutableBlockVector2 mutable = new MutableBlockVector2();
private int from; private int from;
private int to; private int to;

View File

@ -87,10 +87,10 @@ public class BlockBagChangeSet extends AbstractDelegateChangeSet {
try { try {
blockBag.fetchPlacedBlock(typeTo.getDefaultState()); blockBag.fetchPlacedBlock(typeTo.getDefaultState());
} catch (UnplaceableBlockException e) { } catch (UnplaceableBlockException e) {
throw FaweCache.INSTANCE.getBLOCK_BAG(); throw FaweCache.INSTANCE.getBlockBag();
} catch (BlockBagException e) { } catch (BlockBagException e) {
missingBlocks[typeTo.getInternalId()]++; missingBlocks[typeTo.getInternalId()]++;
throw FaweCache.INSTANCE.getBLOCK_BAG(); throw FaweCache.INSTANCE.getBlockBag();
} }
} }
if (mine) { if (mine) {

View File

@ -6,8 +6,6 @@ import com.boydti.fawe.database.DBHandler;
import com.boydti.fawe.database.RollbackDatabase; import com.boydti.fawe.database.RollbackDatabase;
import com.boydti.fawe.object.FaweInputStream; import com.boydti.fawe.object.FaweInputStream;
import com.boydti.fawe.object.FaweOutputStream; import com.boydti.fawe.object.FaweOutputStream;
import com.boydti.fawe.object.IntegerPair;
import com.boydti.fawe.object.change.MutableFullBlockChange;
import com.boydti.fawe.util.MainUtil; import com.boydti.fawe.util.MainUtil;
import com.sk89q.jnbt.NBTInputStream; import com.sk89q.jnbt.NBTInputStream;
import com.sk89q.jnbt.NBTOutputStream; import com.sk89q.jnbt.NBTOutputStream;
@ -16,12 +14,13 @@ import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import java.io.EOFException;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.util.UUID; import java.util.UUID;
import kotlin.Pair;
/** /**
* Store the change on disk * Store the change on disk
@ -403,25 +402,23 @@ public class DiskStorageHistory extends FaweStreamChangeSet {
return null; return null;
} }
public IntegerPair readHeader() { public Pair<Integer, Integer> readHeader() {
int ox = getOriginX(); int ox = getOriginX();
int oz = getOriginZ(); int oz = getOriginZ();
if (ox == 0 && oz == 0 && bdFile.exists()) { if (ox == 0 && oz == 0 && bdFile.exists()) {
try (FileInputStream fis = new FileInputStream(bdFile)) { try (FileInputStream fis = new FileInputStream(bdFile); FaweInputStream gis = MainUtil
final FaweInputStream gis = MainUtil.getCompressedIS(fis); .getCompressedIS(fis)) {
// skip mode // skip mode
gis.skipFully(1); gis.skipFully(1);
// origin // origin
ox = ((gis.read() << 24) + (gis.read() << 16) + (gis.read() << 8) + gis.read()); ox = ((gis.read() << 24) + (gis.read() << 16) + (gis.read() << 8) + gis.read());
oz = ((gis.read() << 24) + (gis.read() << 16) + (gis.read() << 8) + gis.read()); oz = ((gis.read() << 24) + (gis.read() << 16) + (gis.read() << 8) + gis.read());
setOrigin(ox, oz); setOrigin(ox, oz);
fis.close();
gis.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
return new IntegerPair(ox, oz); return new Pair<>(ox, oz);
} }
@Override @Override

View File

@ -456,7 +456,7 @@ public abstract class FaweStreamChangeSet extends AbstractChangeSet {
public Iterator<MutableBiomeChange> getBiomeIterator(final boolean dir) throws IOException { public Iterator<MutableBiomeChange> getBiomeIterator(final boolean dir) throws IOException {
final FaweInputStream is = getBiomeIS(); final FaweInputStream is = getBiomeIS();
if (is == null) { if (is == null) {
return new ArrayList<MutableBiomeChange>().iterator(); return Collections.emptyIterator();
} }
final MutableBiomeChange change = new MutableBiomeChange(); final MutableBiomeChange change = new MutableBiomeChange();
return new Iterator<MutableBiomeChange>() { return new Iterator<MutableBiomeChange>() {
@ -570,7 +570,7 @@ public abstract class FaweStreamChangeSet extends AbstractChangeSet {
public Iterator<MutableEntityChange> getEntityIterator(final NBTInputStream is, final boolean create) { public Iterator<MutableEntityChange> getEntityIterator(final NBTInputStream is, final boolean create) {
if (is == null) { if (is == null) {
return new ArrayList<MutableEntityChange>().iterator(); return Collections.emptyIterator();
} }
final MutableEntityChange change = new MutableEntityChange(null, create); final MutableEntityChange change = new MutableEntityChange(null, create);
try { try {
@ -619,7 +619,7 @@ public abstract class FaweStreamChangeSet extends AbstractChangeSet {
public Iterator<MutableTileChange> getTileIterator(final NBTInputStream is, final boolean create) { public Iterator<MutableTileChange> getTileIterator(final NBTInputStream is, final boolean create) {
if (is == null) { if (is == null) {
return new ArrayList<MutableTileChange>().iterator(); return Collections.emptyIterator();
} }
final MutableTileChange change = new MutableTileChange(null, create); final MutableTileChange change = new MutableTileChange(null, create);
try { try {

View File

@ -1,7 +1,6 @@
package com.boydti.fawe.object.clipboard; package com.boydti.fawe.object.clipboard;
import com.boydti.fawe.jnbt.streamer.IntValueReader; import com.boydti.fawe.jnbt.streamer.IntValueReader;
import com.boydti.fawe.object.IntegerTrio;
import com.boydti.fawe.util.ReflectionUtils; import com.boydti.fawe.util.ReflectionUtils;
import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.IntTag; import com.sk89q.jnbt.IntTag;
@ -16,23 +15,24 @@ import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
import java.util.Map.Entry;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import kotlin.Triple;
public class CPUOptimizedClipboard extends LinearClipboard { public class CPUOptimizedClipboard extends LinearClipboard {
private BiomeType[] biomes = null; private BiomeType[] biomes = null;
private char[] states; private char[] states;
private final HashMap<IntegerTrio, CompoundTag> nbtMapLoc; private final HashMap<Triple<Integer,Integer,Integer>, CompoundTag> nbtMapLoc;
private final HashMap<Integer, CompoundTag> nbtMapIndex; private final HashMap<Integer, CompoundTag> nbtMapIndex;
@ -95,9 +95,9 @@ public class CPUOptimizedClipboard extends LinearClipboard {
if (nbtMapLoc.isEmpty()) { if (nbtMapLoc.isEmpty()) {
return; return;
} }
for (Map.Entry<IntegerTrio, CompoundTag> entry : nbtMapLoc.entrySet()) { for (Entry<Triple<Integer, Integer, Integer>, CompoundTag> entry : nbtMapLoc.entrySet()) {
IntegerTrio key = entry.getKey(); Triple<Integer, Integer, Integer> key = entry.getKey();
setTile(getIndex(key.x, key.y, key.z), entry.getValue()); setTile(getIndex(key.getFirst(), key.getSecond(), key.getThird()), entry.getValue());
} }
nbtMapLoc.clear(); nbtMapLoc.clear();
} }
@ -168,7 +168,7 @@ public class CPUOptimizedClipboard extends LinearClipboard {
@Override @Override
public boolean setTile(int x, int y, int z, CompoundTag tag) { public boolean setTile(int x, int y, int z, CompoundTag tag) {
nbtMapLoc.put(new IntegerTrio(x, y, z), tag); nbtMapLoc.put(new Triple<>(x, y, z), tag);
return true; return true;
} }

View File

@ -3,7 +3,6 @@ package com.boydti.fawe.object.clipboard;
import com.boydti.fawe.Fawe; import com.boydti.fawe.Fawe;
import com.boydti.fawe.config.Settings; import com.boydti.fawe.config.Settings;
import com.boydti.fawe.jnbt.streamer.IntValueReader; import com.boydti.fawe.jnbt.streamer.IntValueReader;
import com.boydti.fawe.object.IntegerTrio;
import com.boydti.fawe.util.MainUtil; import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.ReflectionUtils; import com.boydti.fawe.util.ReflectionUtils;
import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTag;
@ -39,8 +38,10 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID; import java.util.UUID;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import kotlin.Triple;
/** /**
* A clipboard with disk backed storage. (lower memory + loads on crash) * A clipboard with disk backed storage. (lower memory + loads on crash)
@ -51,7 +52,7 @@ public class DiskOptimizedClipboard extends LinearClipboard implements Closeable
private static int HEADER_SIZE = 14; private static int HEADER_SIZE = 14;
private final HashMap<IntegerTrio, CompoundTag> nbtMap; private final HashMap<Triple<Integer,Integer,Integer>, CompoundTag> nbtMap;
private final File file; private final File file;
private RandomAccessFile braf; private RandomAccessFile braf;
@ -60,45 +61,41 @@ public class DiskOptimizedClipboard extends LinearClipboard implements Closeable
private FileChannel fileChannel; private FileChannel fileChannel;
private boolean hasBiomes; private boolean hasBiomes;
public DiskOptimizedClipboard(BlockVector3 dimensions, UUID uuid) { public DiskOptimizedClipboard(BlockVector3 dimensions, UUID uuid) throws IOException {
this(dimensions, MainUtil.getFile(Fawe.get() != null ? Fawe.imp().getDirectory() : new File("."), Settings.IMP.PATHS.CLIPBOARD + File.separator + uuid + ".bd")); this(dimensions, MainUtil.getFile(Fawe.get() != null ? Fawe.imp().getDirectory() : new File("."), Settings.IMP.PATHS.CLIPBOARD + File.separator + uuid + ".bd"));
} }
public DiskOptimizedClipboard(BlockVector3 dimensions) { public DiskOptimizedClipboard(BlockVector3 dimensions) throws IOException {
this(dimensions, MainUtil.getFile(Fawe.imp() != null ? Fawe.imp().getDirectory() : new File("."), Settings.IMP.PATHS.CLIPBOARD + File.separator + UUID.randomUUID() + ".bd")); this(dimensions, MainUtil.getFile(Fawe.imp() != null ? Fawe.imp().getDirectory() : new File("."), Settings.IMP.PATHS.CLIPBOARD + File.separator + UUID.randomUUID() + ".bd"));
} }
public DiskOptimizedClipboard(BlockVector3 dimensions, File file) { public DiskOptimizedClipboard(BlockVector3 dimensions, File file) throws IOException {
super(dimensions); super(dimensions);
if (getWidth() > Character.MAX_VALUE || getHeight() > Character.MAX_VALUE || getLength() > Character.MAX_VALUE) { if (getWidth() > Character.MAX_VALUE || getHeight() > Character.MAX_VALUE || getLength() > Character.MAX_VALUE) {
throw new IllegalArgumentException("Too large"); throw new IllegalArgumentException("Too large");
} }
nbtMap = new HashMap<>(); nbtMap = new HashMap<>();
this.file = file;
try { try {
this.file = file; if (!file.exists()) {
try { File parent = file.getParentFile();
if (!file.exists()) { if (parent != null) {
File parent = file.getParentFile(); file.getParentFile().mkdirs();
if (parent != null) {
file.getParentFile().mkdirs();
}
file.createNewFile();
} }
} catch (Exception e) { file.createNewFile();
e.printStackTrace();
} }
this.braf = new RandomAccessFile(file, "rw"); } catch (Exception e) {
long fileLength = (long) getVolume() * 2L + (long) HEADER_SIZE; e.printStackTrace();
braf.setLength(0);
braf.setLength(fileLength);
init();
// write getLength() etc
byteBuffer.putChar(2, (char) getWidth());
byteBuffer.putChar(4, (char) getHeight());
byteBuffer.putChar(6, (char) getLength());
} catch (IOException e) {
throw new RuntimeException(e);
} }
this.braf = new RandomAccessFile(file, "rw");
long fileLength = (long) getVolume() * 2L + (long) HEADER_SIZE;
braf.setLength(0);
braf.setLength(fileLength);
init();
// write getLength() etc
byteBuffer.putChar(2, (char) getWidth());
byteBuffer.putChar(4, (char) getHeight());
byteBuffer.putChar(6, (char) getLength());
} }
@Override @Override
@ -310,9 +307,9 @@ public class DiskOptimizedClipboard extends LinearClipboard implements Closeable
CompoundTag nbt; CompoundTag nbt;
if (nbtMap.size() < 4) { if (nbtMap.size() < 4) {
nbt = null; nbt = null;
for (Map.Entry<IntegerTrio, CompoundTag> entry : nbtMap.entrySet()) { for (Entry<Triple<Integer, Integer, Integer>, CompoundTag> entry : nbtMap.entrySet()) {
IntegerTrio key = entry.getKey(); Triple<Integer, Integer, Integer> key = entry.getKey();
int index = getIndex(key.x, key.y, key.z); int index = getIndex(key.getFirst(), key.getSecond(), key.getThird());
if (index == i) { if (index == i) {
nbt = entry.getValue(); nbt = entry.getValue();
break; break;
@ -323,7 +320,7 @@ public class DiskOptimizedClipboard extends LinearClipboard implements Closeable
int newI = i - y * getArea(); int newI = i - y * getArea();
int z = newI / getWidth(); int z = newI / getWidth();
int x = newI - z * getWidth(); int x = newI - z * getWidth();
nbt = nbtMap.get(new IntegerTrio(x, y, z)); nbt = nbtMap.get(new Triple<>(x, y, z));
} }
return state.toBaseBlock(nbt); return state.toBaseBlock(nbt);
} }
@ -332,7 +329,7 @@ public class DiskOptimizedClipboard extends LinearClipboard implements Closeable
private BaseBlock toBaseBlock(BlockState state, int x, int y, int z) { private BaseBlock toBaseBlock(BlockState state, int x, int y, int z) {
if (state.getMaterial().hasContainer() && !nbtMap.isEmpty()) { if (state.getMaterial().hasContainer() && !nbtMap.isEmpty()) {
CompoundTag nbt = nbtMap.get(new IntegerTrio(x, y, z)); CompoundTag nbt = nbtMap.get(new Triple<>(x, y, z));
return state.toBaseBlock(nbt); return state.toBaseBlock(nbt);
} }
return state.toBaseBlock(); return state.toBaseBlock();
@ -363,7 +360,7 @@ public class DiskOptimizedClipboard extends LinearClipboard implements Closeable
@Override @Override
public boolean setTile(int x, int y, int z, CompoundTag tag) { public boolean setTile(int x, int y, int z, CompoundTag tag) {
nbtMap.put(new IntegerTrio(x, y, z), tag); nbtMap.put(new Triple<>(x, y, z), tag);
Map<String, Tag> values = ReflectionUtils.getMap(tag.getValue()); Map<String, Tag> values = ReflectionUtils.getMap(tag.getValue());
values.put("x", new IntTag(x)); values.put("x", new IntTag(x));
values.put("y", new IntTag(y)); values.put("y", new IntTag(y));
@ -427,16 +424,4 @@ public class DiskOptimizedClipboard extends LinearClipboard implements Closeable
this.entities.remove(entity); this.entities.remove(entity);
} }
@Override
public void removeEntity(int x, int y, int z, UUID uuid) {
Iterator<BlockArrayClipboard.ClipboardEntity> iter = this.entities.iterator();
while (iter.hasNext()) {
BlockArrayClipboard.ClipboardEntity entity = iter.next();
UUID entUUID = entity.getState().getNbtData().getUUID();
if (uuid.equals(entUUID)) {
iter.remove();
return;
}
}
}
} }

View File

@ -2,7 +2,6 @@ package com.boydti.fawe.object.clipboard;
import com.boydti.fawe.config.Settings; import com.boydti.fawe.config.Settings;
import com.boydti.fawe.jnbt.streamer.IntValueReader; import com.boydti.fawe.jnbt.streamer.IntValueReader;
import com.boydti.fawe.object.IntegerTrio;
import com.boydti.fawe.util.MainUtil; import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.ReflectionUtils; import com.boydti.fawe.util.ReflectionUtils;
import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTag;
@ -20,17 +19,15 @@ import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import javax.annotation.Nullable;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.Map.Entry;
import javax.annotation.Nullable;
import kotlin.Triple;
public class MemoryOptimizedClipboard extends LinearClipboard { public class MemoryOptimizedClipboard extends LinearClipboard {
@ -43,7 +40,7 @@ public class MemoryOptimizedClipboard extends LinearClipboard {
private byte[] buffer = new byte[MainUtil.getMaxCompressedLength(BLOCK_SIZE)]; private byte[] buffer = new byte[MainUtil.getMaxCompressedLength(BLOCK_SIZE)];
private byte[] biomes = null; private byte[] biomes = null;
private final HashMap<IntegerTrio, CompoundTag> nbtMapLoc; private final HashMap<Triple<Integer,Integer,Integer>, CompoundTag> nbtMapLoc;
private final HashMap<Integer, CompoundTag> nbtMapIndex; private final HashMap<Integer, CompoundTag> nbtMapIndex;
@ -71,9 +68,9 @@ public class MemoryOptimizedClipboard extends LinearClipboard {
if (nbtMapLoc.isEmpty()) { if (nbtMapLoc.isEmpty()) {
return; return;
} }
for (Map.Entry<IntegerTrio, CompoundTag> entry : nbtMapLoc.entrySet()) { for (Entry<Triple<Integer, Integer, Integer>, CompoundTag> entry : nbtMapLoc.entrySet()) {
IntegerTrio key = entry.getKey(); Triple<Integer, Integer, Integer> key = entry.getKey();
setTile(getIndex(key.x, key.y, key.z), entry.getValue()); setTile(getIndex(key.getFirst(), key.getSecond(), key.getThird()), entry.getValue());
} }
nbtMapLoc.clear(); nbtMapLoc.clear();
} }
@ -266,7 +263,7 @@ public class MemoryOptimizedClipboard extends LinearClipboard {
@Override @Override
public boolean setTile(int x, int y, int z, CompoundTag tag) { public boolean setTile(int x, int y, int z, CompoundTag tag) {
nbtMapLoc.put(new IntegerTrio(x, y, z), tag); nbtMapLoc.put(new Triple<>(x, y, z), tag);
return true; return true;
} }

View File

@ -15,6 +15,7 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
import java.util.List; import java.util.List;
import java.util.function.Supplier; import java.util.function.Supplier;
import org.jetbrains.annotations.NotNull;
public abstract class ReadOnlyClipboard extends SimpleClipboard { public abstract class ReadOnlyClipboard extends SimpleClipboard {
public final Region region; public final Region region;
@ -68,6 +69,8 @@ public abstract class ReadOnlyClipboard extends SimpleClipboard {
}; };
} }
@NotNull
@Override
public Region getRegion() { public Region getRegion() {
return region; return region;
} }
@ -81,7 +84,7 @@ public abstract class ReadOnlyClipboard extends SimpleClipboard {
public abstract List<? extends Entity> getEntities(); public abstract List<? extends Entity> getEntities();
@Override @Override
public boolean setBlock(int x, int y, int z, BlockStateHolder block) { public <B extends BlockStateHolder<B>> boolean setBlock(int x, int y, int z, B block) {
throw new UnsupportedOperationException("Clipboard is immutable"); throw new UnsupportedOperationException("Clipboard is immutable");
} }

View File

@ -6,6 +6,7 @@ import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import java.io.Closeable; import java.io.Closeable;
import org.jetbrains.annotations.NotNull;
public abstract class SimpleClipboard implements Clipboard, Closeable { public abstract class SimpleClipboard implements Clipboard, Closeable {
private final BlockVector3 size; private final BlockVector3 size;
@ -44,6 +45,7 @@ public abstract class SimpleClipboard implements Clipboard, Closeable {
return size.subtract(BlockVector3.ONE); return size.subtract(BlockVector3.ONE);
} }
@NotNull
@Override @Override
public Region getRegion() { public Region getRegion() {
return new CuboidRegion(BlockVector3.at(0, 0, 0), BlockVector3.at(getWidth() - 1, getHeight() - 1, getLength() - 1)); return new CuboidRegion(BlockVector3.at(0, 0, 0), BlockVector3.at(getWidth() - 1, getHeight() - 1, getLength() - 1));

View File

@ -1,55 +0,0 @@
package com.boydti.fawe.object.clipboard;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockTypes;
import java.io.Closeable;
import java.io.IOException;
import java.util.function.Supplier;
public class WorldCutClipboard extends WorldCopyClipboard {
public WorldCutClipboard(Supplier<Extent> supplier, Region region) {
super(supplier, region);
}
public WorldCutClipboard(Supplier<Extent> supplier, Region region, boolean hasEntities, boolean hasBiomes) {
super(supplier, region, hasEntities, hasBiomes);
}
@Override
public BaseBlock getFullBlock(int x, int y, int z) {
Extent extent = getExtent();
BaseBlock block = extent.getFullBlock(x, y, z);
extent.setBlock(x, y, z, BlockTypes.AIR.getDefaultState());
return block;
}
@Override
public BlockState getBlock(int x, int y, int z) {
Extent extent = getExtent();
BlockState block = extent.getBlock(x, y, z);
extent.setBlock(x, y, z, BlockTypes.AIR.getDefaultState());
return block;
}
@Override
public void close() {
Extent extent = getExtent();
if (extent instanceof EditSession) {
((EditSession) extent).flushQueue();
} else if (extent instanceof Closeable) {
try {
((Closeable) extent).close();
} catch (IOException e) {
e.printStackTrace();
}
} else {
extent.commit();
}
}
}

View File

@ -1,5 +1,6 @@
package com.boydti.fawe.object.collection; package com.boydti.fawe.object.collection;
import com.google.common.base.Functions;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.Collections; import java.util.Collections;
@ -15,7 +16,7 @@ public class AdaptedMap<K, V, K2, V2> implements IAdaptedMap<K, V, K2, V2> {
private final Function<V, V2> value; private final Function<V, V2> value;
private final Function<K, K2> key; private final Function<K, K2> key;
private static final Function SAME = o -> o; private static final Function SAME = Functions.identity();
private static final Function IMMUTABLE = o -> { throw new UnsupportedOperationException("Immutable"); }; private static final Function IMMUTABLE = o -> { throw new UnsupportedOperationException("Immutable"); };

View File

@ -6,6 +6,7 @@ import com.sk89q.worldedit.regions.AbstractRegion;
import com.sk89q.worldedit.regions.RegionOperationException; import com.sk89q.worldedit.regions.RegionOperationException;
import java.util.Iterator; import java.util.Iterator;
import java.util.Set; import java.util.Set;
import org.jetbrains.annotations.NotNull;
public abstract class BlockSet extends AbstractRegion { public abstract class BlockSet extends AbstractRegion {
private final int chunkOffsetX; private final int chunkOffsetX;
@ -92,6 +93,7 @@ public abstract class BlockSet extends AbstractRegion {
public abstract void set(int x, int y, int z); public abstract void set(int x, int y, int z);
public abstract void clear(int x, int y, int z); public abstract void clear(int x, int y, int z);
public abstract boolean remove(int x, int y, int z); public abstract boolean remove(int x, int y, int z);
@NotNull
@Override @Override
public abstract Iterator<BlockVector3> iterator(); public abstract Iterator<BlockVector3> iterator();
@Override @Override

View File

@ -180,7 +180,7 @@ public class BlockVectorSet extends AbstractCollection<BlockVector3> implements
public boolean retainAll(@NotNull Collection<?> c) { public boolean retainAll(@NotNull Collection<?> c) {
Objects.requireNonNull(c); Objects.requireNonNull(c);
boolean modified = false; boolean modified = false;
Iterator it = iterator(); Iterator<BlockVector3> it = iterator();
while (it.hasNext()) { while (it.hasNext()) {
if (!c.contains(it.next())) { if (!c.contains(it.next())) {
it.remove(); it.remove();
@ -192,11 +192,7 @@ public class BlockVectorSet extends AbstractCollection<BlockVector3> implements
@Override @Override
public boolean removeAll(Collection<?> c) { public boolean removeAll(Collection<?> c) {
boolean result = false; return c.stream().map(this::remove).reduce(false, (a, b) -> a || b);
for (Object o : c) {
result |= remove(o);
}
return result;
} }

View File

@ -87,7 +87,7 @@ public class CleanableThreadLocal<T> extends ThreadLocal<T> implements Closeable
return list; return list;
} }
public static void iterate(ThreadLocal instance, Consumer<Object> withMap) { public static <R> void iterate(ThreadLocal<R> instance, Consumer<Object> withMap) {
try { try {
Thread[] threads = MainUtil.getThreads(); Thread[] threads = MainUtil.getThreads();
Field tl = Thread.class.getDeclaredField("threadLocals"); Field tl = Thread.class.getDeclaredField("threadLocals");
@ -105,7 +105,7 @@ public class CleanableThreadLocal<T> extends ThreadLocal<T> implements Closeable
} }
} }
public static void clean(ThreadLocal instance) { public static <R> void clean(ThreadLocal<R> instance) {
iterate(instance, new Consumer<Object>() { iterate(instance, new Consumer<Object>() {
Method methodRemove; Method methodRemove;
@Override @Override

View File

@ -35,7 +35,7 @@ public final class DifferentialArray<T> implements DifferentialCollection<T> {
public DifferentialArray(T array) { public DifferentialArray(T array) {
checkNotNull(array); checkNotNull(array);
Class<? extends Object> clazz = array.getClass(); Class<?> clazz = array.getClass();
checkArgument(clazz.isArray(), "Data must be an array"); checkArgument(clazz.isArray(), "Data must be an array");
checkArgument(clazz.getComponentType().isPrimitive(), "Data must be a primitive array"); checkArgument(clazz.getComponentType().isPrimitive(), "Data must be a primitive array");
this.data = array; this.data = array;

View File

@ -148,7 +148,7 @@ public final class DifferentialBlockBuffer implements DifferentialCollection<cha
if (changes == null) { if (changes == null) {
changes = new char[t1][][][][]; changes = new char[t1][][][][];
} else if (changes != null && changes.length != 0) { } else if (changes.length != 0) {
initialChange(changes, chunkX, chunkZ, localX, localZ, y, (char) -combined); initialChange(changes, chunkX, chunkZ, localX, localZ, y, (char) -combined);
} }

View File

@ -22,6 +22,11 @@ public class LocalBlockVectorSet implements Set<BlockVector3> {
offsetX = offsetZ = Integer.MAX_VALUE; offsetX = offsetZ = Integer.MAX_VALUE;
this.set = new SparseBitSet(); this.set = new SparseBitSet();
} }
public LocalBlockVectorSet(LocalBlockVectorSet copy) {
this.offsetX = copy.offsetX;
this.offsetZ = copy.offsetZ;
this.set = copy.set.clone();
}
public LocalBlockVectorSet(int x, int z, SparseBitSet set) { public LocalBlockVectorSet(int x, int z, SparseBitSet set) {
this.offsetX = x; this.offsetX = x;
@ -55,12 +60,7 @@ public class LocalBlockVectorSet implements Set<BlockVector3> {
} }
return false; return false;
} }
@Override
public LocalBlockVectorSet clone() {
return new LocalBlockVectorSet(offsetX, offsetZ, set.clone());
}
public boolean containsRadius(int x, int y, int z, int radius) { public boolean containsRadius(int x, int y, int z, int radius) {
if (radius <= 0) { if (radius <= 0) {
return contains(x, y, z); return contains(x, y, z);

View File

@ -60,11 +60,11 @@ public class LongHashSet {
public void add(long key) { public void add(long key) {
int mainIdx = (int) (key & 255); int mainIdx = (int) (key & 255);
long outer[][] = this.values[mainIdx]; long[][] outer = this.values[mainIdx];
if (outer == null) this.values[mainIdx] = outer = new long[256][]; if (outer == null) this.values[mainIdx] = outer = new long[256][];
int outerIdx = (int) ((key >> 32) & 255); int outerIdx = (int) ((key >> 32) & 255);
long inner[] = outer[outerIdx]; long[] inner = outer[outerIdx];
if (inner == null) { if (inner == null) {
synchronized (this) { synchronized (this) {

View File

@ -73,10 +73,12 @@ public final class MemBlockSet extends BlockSet {
return rows[x >> 4].remove(this.rows, x, y, z - getBlockOffsetZ()); return rows[x >> 4].remove(this.rows, x, y, z - getBlockOffsetZ());
} }
@Override
public BlockVector3 getMinimumPoint() { public BlockVector3 getMinimumPoint() {
return BlockVector3.at(getMinX(), getMinimumY(), getMinZ()); return BlockVector3.at(getMinX(), getMinimumY(), getMinZ());
} }
@Override
public BlockVector3 getMaximumPoint() { public BlockVector3 getMaximumPoint() {
return BlockVector3.at(getMaxX(), getMaximumY(), getMaxZ()); return BlockVector3.at(getMaxX(), getMaximumY(), getMaxZ());
} }
@ -173,8 +175,10 @@ public final class MemBlockSet extends BlockSet {
}; };
} }
@Override
public Set<BlockVector3> getChunkCubes() { public Set<BlockVector3> getChunkCubes() {
return new AbstractSet<BlockVector3>() { return new AbstractSet<BlockVector3>() {
@NotNull
@Override @Override
public Iterator<BlockVector3> iterator() { public Iterator<BlockVector3> iterator() {
return new Iterator<BlockVector3>() { return new Iterator<BlockVector3>() {
@ -279,7 +283,6 @@ public final class MemBlockSet extends BlockSet {
}; };
} }
@Override
public int getMinimumY() { public int getMinimumY() {
int maxY = 15; int maxY = 15;
int maxy = 16; int maxy = 16;
@ -324,7 +327,6 @@ public final class MemBlockSet extends BlockSet {
return by; return by;
} }
@Override
public int getMaximumY() { public int getMaximumY() {
int maxY = 0; int maxY = 0;
int maxy = 0; int maxy = 0;
@ -357,8 +359,8 @@ public final class MemBlockSet extends BlockSet {
maxy = y + 1; maxy = y + 1;
} }
by = (Y << 4) + y; by = (Y << 4) + y;
if (by == FaweCache.WORLD_MAX_Y) if (by == FaweCache.worldMaxY)
return FaweCache.WORLD_MAX_Y; return FaweCache.worldMaxY;
break outer; break outer;
} }
} }
@ -739,6 +741,7 @@ public final class MemBlockSet extends BlockSet {
return total; return total;
} }
@Override
public void clear() { public void clear() {
Arrays.fill(rows, NULL_ROW_X); Arrays.fill(rows, NULL_ROW_X);
} }
@ -827,7 +830,7 @@ public final class MemBlockSet extends BlockSet {
public final IRow[] rows; public final IRow[] rows;
public RowZ() { public RowZ() {
this.rows = new IRow[FaweCache.CHUNK_LAYERS]; this.rows = new IRow[FaweCache.chunkLayers];
reset(); reset();
} }
@ -861,12 +864,7 @@ public final class MemBlockSet extends BlockSet {
} }
public boolean isEmpty() { public boolean isEmpty() {
for (IRow row :rows) { return Arrays.stream(rows).noneMatch(row -> row instanceof RowY);
if (row instanceof RowY) {
return false;
}
}
return true;
} }
public void reset(int layer) { public void reset(int layer) {
@ -874,7 +872,7 @@ public final class MemBlockSet extends BlockSet {
} }
public void reset() { public void reset() {
for (int i = 0; i < FaweCache.CHUNK_LAYERS; i++) rows[i] = NULL_ROW_Y; for (int i = 0; i < FaweCache.chunkLayers; i++) rows[i] = NULL_ROW_Y;
} }
} }

View File

@ -1,338 +0,0 @@
package com.boydti.fawe.object.collection;
import java.lang.reflect.Array;
import java.util.AbstractList;
public class PrimitiveList<T> extends AbstractList<T> {
private final Class<?> primitive;
private final Type type;
private int length;
private int totalLength;
private Object arr;
private enum Type {
Byte,
Boolean,
Short,
Character,
Integer,
Float,
Long,
Double
}
public PrimitiveList(Class<T> type) {
try {
Class<T> boxed;
if (type.isPrimitive()) {
this.primitive = type;
boxed = (Class<T>) Array.get(Array.newInstance(primitive, 1), 0).getClass();
} else {
this.primitive = (Class<?>) type.getField("TYPE").get(null);
boxed = type;
}
this.type = Type.valueOf(boxed.getSimpleName());
} catch (Throwable e) {
throw new RuntimeException(e);
}
length = 0;
totalLength = 0;
arr = Array.newInstance(primitive, 0);
}
public PrimitiveList(T[] arr) {
try {
Class<T> boxed = (Class<T>) arr.getClass().getComponentType();
this.primitive = (Class<?>) boxed.getField("TYPE").get(null);
this.type = Type.valueOf(boxed.getSimpleName());
} catch (Throwable e) {
throw new RuntimeException(e);
}
this.arr = Array.newInstance(primitive, arr.length);
for (int i = 0; i < arr.length; i++) {
T val = arr[i];
if (val != null) setFast(i, val);
}
this.length = arr.length;
this.totalLength = length;
}
public PrimitiveList(Object arr) {
if (!arr.getClass().isArray()) {
throw new IllegalArgumentException("Argument must be an array!");
}
this.primitive = arr.getClass().getComponentType();
Class<T> boxed = (Class<T>) Array.get(Array.newInstance(primitive, 1), 0).getClass();
this.type = Type.valueOf(boxed.getSimpleName());
this.arr = arr;
this.length = Array.getLength(arr);
this.totalLength = length;
}
public Object getArray() {
return arr;
}
@Override
public T get(int index) {
return (T) getFast(index);
}
public byte getByte(int index) {
return type == Type.Double ? ((byte[]) arr)[index] : (byte) getFast(index);
}
public boolean getBoolean(int index) {
return type == Type.Boolean ? ((boolean[]) arr)[index] : (boolean) getFast(index);
}
public short getShort(int index) {
return type == Type.Short ? ((short[]) arr)[index] : (short) getFast(index);
}
public char getCharacter(int index) {
return type == Type.Character ? ((char[]) arr)[index] : (char) getFast(index);
}
public int getInt(int index) {
return type == Type.Integer ? ((int[]) arr)[index] : (int) getFast(index);
}
public float getFloat(int index) {
return type == Type.Float ? ((float[]) arr)[index] : (float) getFast(index);
}
public long getLong(int index) {
return type == Type.Long ? ((long[]) arr)[index] : (long) getFast(index);
}
public double getDouble(int index) {
return type == Type.Double ? ((double[]) arr)[index] : (double) getFast(index);
}
private final Object getFast(int index) {
switch (type) {
case Byte:
return ((byte[]) arr)[index];
case Boolean:
return ((boolean[]) arr)[index];
case Short:
return ((short[]) arr)[index];
case Character:
return ((char[]) arr)[index];
case Integer:
return ((int[]) arr)[index];
case Float:
return ((float[]) arr)[index];
case Long:
return ((long[]) arr)[index];
case Double:
return ((double[]) arr)[index];
}
return null;
}
@Override
public T set(int index, T element) {
T value = get(index);
setFast(index, element);
return value;
}
public void set(int index, char value) {
switch (type) {
case Character:
((char[]) arr)[index] = value;
return;
default:
setFast(index, value);
return;
}
}
public void set(int index, byte value) {
switch (type) {
case Byte:
((byte[]) arr)[index] = value;
return;
default:
setFast(index, value);
return;
}
}
public void set(int index, int value) {
switch (type) {
case Integer:
((int[]) arr)[index] = value;
return;
case Long:
((long[]) arr)[index] = (long) value;
return;
case Double:
((double[]) arr)[index] = (double) value;
return;
default:
setFast(index, value);
return;
}
}
public void set(int index, long value) {
switch (type) {
case Integer:
((int[]) arr)[index] = (int) value;
return;
case Long:
((long[]) arr)[index] = value;
return;
case Double:
((double[]) arr)[index] = (double) value;
return;
default:
setFast(index, value);
return;
}
}
public void set(int index, double value) {
switch (type) {
case Float:
((float[]) arr)[index] = (float) value;
return;
case Long:
((long[]) arr)[index] = (long) value;
return;
case Double:
((double[]) arr)[index] = value;
return;
default:
setFast(index, value);
return;
}
}
public final void setFast(int index, Object element) {
switch (type) {
case Byte:
((byte[]) arr)[index] = (byte) element;
return;
case Boolean:
((boolean[]) arr)[index] = (boolean) element;
return;
case Short:
((short[]) arr)[index] = (short) element;
return;
case Character:
((char[]) arr)[index] = (char) element;
return;
case Integer:
((int[]) arr)[index] = (int) element;
return;
case Float:
((float[]) arr)[index] = (float) element;
return;
case Long:
((long[]) arr)[index] = (long) element;
return;
case Double:
((double[]) arr)[index] = (double) element;
return;
}
}
@Override
public void add(int index, T element) {
if (index == length) {
if (totalLength == length) {
Object tmp = arr;
totalLength = (length << 1) + 16;
arr = Array.newInstance(primitive, totalLength);
System.arraycopy(tmp, 0, arr, 0, length);
}
setFast(length, element);
length++;
} else {
if (totalLength == length) {
Object tmp = arr;
totalLength = (length << 1) + 16;
arr = Array.newInstance(primitive, totalLength);
System.arraycopy(tmp, 0, arr, 0, index);
}
System.arraycopy(arr, index, arr, index + 1, length - index);
set(index, element);
length++;
}
}
private void ensureAddCapacity() {
if (totalLength == length) {
Object tmp = arr;
totalLength = (length << 1) + 16;
arr = Array.newInstance(primitive, totalLength);
System.arraycopy(tmp, 0, arr, 0, length);
}
}
@Override
public boolean add(T element) {
ensureAddCapacity();
setFast(length++, element);
return true;
}
public boolean add(int element) {
ensureAddCapacity();
set(length++, element);
return true;
}
public boolean add(long element) {
ensureAddCapacity();
set(length++, element);
return true;
}
public boolean add(double element) {
ensureAddCapacity();
set(length++, element);
return true;
}
public boolean add(byte element) {
ensureAddCapacity();
set(length++, element);
return true;
}
public boolean add(char element) {
ensureAddCapacity();
set(length++, element);
return true;
}
@Override
public T remove(int index) {
if (index < 0 || index > length) throw new IndexOutOfBoundsException(index + " not in [0, " + length + "]");
T value = get(index);
if (index != length) {
System.arraycopy(arr, index + 1, arr, index, length - index - 1);
}
length--;
return value;
}
@Override
public int size() {
return length;
}
@Override
public void clear() {
if (length != 0) {
this.arr = Array.newInstance(primitive, 0);
}
length = 0;
}
}

View File

@ -1,47 +1,48 @@
// CHECKSTYLE:OFF // CHECKSTYLE:OFF
package com.boydti.fawe.object.collection; package com.boydti.fawe.object.collection;
/*- This software is the work of Paladin Software International, Incorporated, /* This software is the work of Paladin Software International, Incorporated,
* based upon previous work done for and by Sun Microsystems, Inc. */ * based upon previous work done for and by Sun Microsystems, Inc. */
import java.io.IOException; import java.io.IOException;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
import java.io.ObjectOutputStream; import java.io.ObjectOutputStream;
import java.io.Serializable; import java.io.Serializable;
import java.util.Arrays;
/** /**
* This class implements a set of bits that grows as needed. Each bit of the * This class implements a set of bits that grows as needed. Each bit of the
* bit set represents a <code>boolean</code> value. The values of a * bit set represents a {@code boolean} value. The values of a
* <code>SparseBitSet</code> are indexed by non-negative integers. * {@code SparseBitSet} are indexed by non-negative integers.
* Individual indexed values may be examined, set, cleared, or modified by * Individual indexed values may be examined, set, cleared, or modified by
* logical operations. One <code>SparseBitSet</code> or logical value may be * logical operations. One {@code SparseBitSet} or logical value may be
* used to modify the contents of (another) <code>SparseBitSet</code> through * used to modify the contents of (another) {@code SparseBitSet} through
* logical <b>AND</b>, logical <b>inclusive OR</b>, logical <b>exclusive * logical <b>AND</b>, logical <b>inclusive OR</b>, logical <b>exclusive
* OR</b>, and <b>And NOT</b> operations over all or part of the bit sets. * OR</b>, and <b>And NOT</b> operations over all or part of the bit sets.
* <p> * <p>
* All values in a bit set initially have the value <code>false</code>. * All values in a bit set initially have the value {@code false}.
* <p> * <p>
* Every bit set has a current size, which is the number of bits of space * Every bit set has a current size, which is the number of bits of space
* <i>nominally</i> in use by the bit set from the first set bit to just after * <i>nominally</i> in use by the bit set from the first set bit to just after
* the last set bit. The length of the bit set effectively tells the position * the last set bit. The length of the bit set effectively tells the position
* available after the last bit of the SparseBitSet. * available after the last bit of the SparseBitSet.
* <p> * <p>
* The maximum cardinality of a <code>SparseBitSet</code> is * The maximum cardinality of a {@code SparseBitSet} is
* <code>Integer.MAX_VALUE</code>, which means the bits of a * {@link Integer#MAX_VALUE}, which means the bits of a
* <code>SparseBitSet</code> are labelled <code> * {@code SparseBitSet} are labelled {@code 0}&nbsp;..&nbsp;
* 0</code>&nbsp;..&nbsp;<code>Integer.MAX_VALUE&nbsp;&minus;&nbsp;1</code>. * {@code Integer.MAX_VALUE&nbsp;&minus;&nbsp;1}.
* After the last set bit of a <code>SparseBitSet</code>, any attempt to find * After the last set bit of a {@code SparseBitSet}, any attempt to find
* a subsequent bit (<i>nextSetBit</i>()), will return an value of &minus;1. * a subsequent bit (<i>nextSetBit</i>()), will return an value of &minus;1.
* If an attempt is made to use <i>nextClearBit</i>(), and all the bits are * If an attempt is made to use <i>nextClearBit</i>(), and all the bits are
* set from the starting position of the search to the bit labelled * set from the starting position of the search to the bit labelled
* <code>Integer.MAX_VALUE&nbsp;&minus;&nbsp;1</code>, then similarly &minus;1 * {@code Integer.MAX_VALUE&nbsp;&minus;&nbsp;1}, then similarly &minus;1
* will be returned. * will be returned.
* <p> * <p>
* Unless otherwise noted, passing a null parameter to any of the methods in * Unless otherwise noted, passing a null parameter to any of the methods in
* a <code>SparseBitSet</code> will result in a * a {@code SparseBitSet} will result in a
* <code>NullPointerException</code>. * {@link NullPointerException}.
* <p> * <p>
* A <code>SparseBitSet</code> is not safe for multi-threaded use without * A {@code SparseBitSet} is not safe for multi-threaded use without
* external synchronization. * external synchronization.
* *
* @author Bruce K. Haddon * @author Bruce K. Haddon
@ -51,7 +52,6 @@ import java.io.Serializable;
* @version 1.0, 2009-03-17 * @version 1.0, 2009-03-17
* @since 1.6 * @since 1.6
*/ */
@SuppressWarnings("ALL")
public class SparseBitSet implements Cloneable, Serializable public class SparseBitSet implements Cloneable, Serializable
{ {
/* My apologies for listing all the additional authors, but concepts, code, /* My apologies for listing all the additional authors, but concepts, code,
@ -123,7 +123,7 @@ public class SparseBitSet implements Cloneable, Serializable
/** /**
* The storage for this SparseBitSet. The <i>i</i>th bit is stored in a word * The storage for this SparseBitSet. The <i>i</i>th bit is stored in a word
* represented by a long value, and is at bit position <code>i % 64</code> * represented by a long value, and is at bit position {@code i % 64}
* within that word (where bit position 0 refers to the least significant bit * within that word (where bit position 0 refers to the least significant bit
* and 63 refers to the most significant bit). * and 63 refers to the most significant bit).
* <p> * <p>
@ -334,7 +334,7 @@ public class SparseBitSet implements Cloneable, Serializable
/** /**
* Constructor for a new (sparse) bit set. All bits initially are effectively * Constructor for a new (sparse) bit set. All bits initially are effectively
* <code>false</code>. This is a internal constructor that collects all the * {@code false}. This is a internal constructor that collects all the
* needed actions to initialise the bit set. * needed actions to initialise the bit set.
* <p> * <p>
* The capacity is taken to be a <i>suggestion</i> for a size of the bit set, * The capacity is taken to be a <i>suggestion</i> for a size of the bit set,
@ -365,7 +365,7 @@ public class SparseBitSet implements Cloneable, Serializable
/** /**
* Constructs an empty bit set with the default initial size. * Constructs an empty bit set with the default initial size.
* Initially all bits are effectively <code>false</code>. * Initially all bits are effectively {@code false}.
* *
* @since 1.6 * @since 1.6
*/ */
@ -377,9 +377,9 @@ public class SparseBitSet implements Cloneable, Serializable
/** /**
* Creates a bit set whose initial size is large enough to efficiently * Creates a bit set whose initial size is large enough to efficiently
* represent bits with indices in the range <code>0</code> through * represent bits with indices in the range {@code 0} through
* at least <code>nbits-1</code>. Initially all bits are effectively * at least {@code nbits-1}. Initially all bits are effectively
* <code>false</code>. * {@code false}.
* <p> * <p>
* No guarantees are given for how large or small the actual object will be. * No guarantees are given for how large or small the actual object will be.
* The setting of bits above the given range is permitted (and will perhaps * The setting of bits above the given range is permitted (and will perhaps
@ -399,8 +399,8 @@ public class SparseBitSet implements Cloneable, Serializable
/** /**
* Performs a logical <b>AND</b> of the addressed target bit with the argument * Performs a logical <b>AND</b> of the addressed target bit with the argument
* value. This bit set is modified so that the addressed bit has the value * value. This bit set is modified so that the addressed bit has the value
* <code>true</code> if and only if it both initially had the value * {@code true} if and only if it both initially had the value
* <code>true</code> and the argument value is also <code>true</code>. * {@code true} and the argument value is also {@code true}.
* *
* @param i a bit index * @param i a bit index
* @param value a boolean value to <b>AND</b> with that bit * @param value a boolean value to <b>AND</b> with that bit
@ -419,17 +419,17 @@ public class SparseBitSet implements Cloneable, Serializable
/** /**
* Performs a logical <b>AND</b> of this target bit set with the argument bit * Performs a logical <b>AND</b> of this target bit set with the argument bit
* set within the given range of bits. Within the range, this bit set is * set within the given range of bits. Within the range, this bit set is
* modified so that each bit in it has the value <code>true</code> if and only * modified so that each bit in it has the value {@code true} if and only
* if it both initially had the value <code>true</code> and the corresponding * if it both initially had the value {@code true} and the corresponding
* bit in the bit set argument also had the value <code>true</code>. Outside * bit in the bit set argument also had the value {@code true}. Outside
* the range, this set is not changed. * the range, this set is not changed.
* *
* @param i index of the first bit to be included in the operation * @param i index of the first bit to be included in the operation
* @param j index after the last bit to included in the operation * @param j index after the last bit to included in the operation
* @param b a SparseBitSet * @param b a SparseBitSet
* @exception IndexOutOfBoundsException if <code>i</code> is negative or * @exception IndexOutOfBoundsException if {@code i} is negative or
* equal to Integer.MAX_VALUE, or <code>j</code> is negative, * equal to Integer.MAX_VALUE, or {@code j} is negative,
* or <code>i</code> is larger than <code>j</code> * or {@code i} is larger than {@code j}
* @since 1.6 * @since 1.6
*/ */
public void and(int i, int j, SparseBitSet b) throws IndexOutOfBoundsException public void and(int i, int j, SparseBitSet b) throws IndexOutOfBoundsException
@ -440,9 +440,9 @@ public class SparseBitSet implements Cloneable, Serializable
/** /**
* Performs a logical <b>AND</b> of this target bit set with the argument bit * Performs a logical <b>AND</b> of this target bit set with the argument bit
* set. This bit set is modified so that each bit in it has the value * set. This bit set is modified so that each bit in it has the value
* <code>true</code> if and only if it both initially had the value * {@code true} if and only if it both initially had the value
* <code>true</code> and the corresponding bit in the bit set argument also * {@code true} and the corresponding bit in the bit set argument also
* had the value <code>true</code>. * had the value {@code true}.
* *
* @param b a SparseBitSet * @param b a SparseBitSet
* @since 1.6 * @since 1.6
@ -454,11 +454,11 @@ public class SparseBitSet implements Cloneable, Serializable
} }
/** /**
* Performs a logical <b>AND</b> of the two given <code>SparseBitSet</code>s. * Performs a logical <b>AND</b> of the two given {@code SparseBitSet}s.
* The returned <code>SparseBitSet</code> is created so that each bit in it * The returned {@code SparseBitSet} is created so that each bit in it
* has the value <code>true</code> if and only if both the given sets * has the value {@code true} if and only if both the given sets
* initially had the corresponding bits <code>true</code>, otherwise * initially had the corresponding bits {@code true}, otherwise
* <code>false</code>. * {@code false}.
* *
* @param a a SparseBitSet * @param a a SparseBitSet
* @param b another SparseBitSet * @param b another SparseBitSet
@ -475,8 +475,8 @@ public class SparseBitSet implements Cloneable, Serializable
/** /**
* Performs a logical <b>AndNOT</b> of the addressed target bit with the * Performs a logical <b>AndNOT</b> of the addressed target bit with the
* argument value. This bit set is modified so that the addressed bit has the * argument value. This bit set is modified so that the addressed bit has the
* value <code>true</code> if and only if it both initially had the value * value {@code true} if and only if it both initially had the value
* <code>true</code> and the argument value is <code>false</code>. * {@code true} and the argument value is {@code false}.
* *
* @param i a bit index * @param i a bit index
* @param value a boolean value to AndNOT with that bit * @param value a boolean value to AndNOT with that bit
@ -495,17 +495,17 @@ public class SparseBitSet implements Cloneable, Serializable
/** /**
* Performs a logical <b>AndNOT</b> of this target bit set with the argument * Performs a logical <b>AndNOT</b> of this target bit set with the argument
* bit set within the given range of bits. Within the range, this bit set is * bit set within the given range of bits. Within the range, this bit set is
* modified so that each bit in it has the value <code>true</code> if and only * modified so that each bit in it has the value {@code true} if and only
* if it both initially had the value <code>true</code> and the corresponding * if it both initially had the value {@code true} and the corresponding
* bit in the bit set argument has the value <code>false</code>. Outside * bit in the bit set argument has the value {@code false}. Outside
* the range, this set is not changed. * the range, this set is not changed.
* *
* @param i index of the first bit to be included in the operation * @param i index of the first bit to be included in the operation
* @param j index after the last bit to included in the operation * @param j index after the last bit to included in the operation
* @param b the SparseBitSet with which to mask this SparseBitSet * @param b the SparseBitSet with which to mask this SparseBitSet
* @exception IndexOutOfBoundsException if <code>i</code> is negative or * @exception IndexOutOfBoundsException if {@code i} is negative or
* equal to Integer.MAX_VALUE, or <code>j</code> is negative, * equal to Integer.MAX_VALUE, or {@code j} is negative,
* or <code>i</code> is larger than <code>j</code> * or {@code i} is larger than {@code j}
* @since 1.6 * @since 1.6
*/ */
public void andNot(int i, int j, SparseBitSet b) public void andNot(int i, int j, SparseBitSet b)
@ -517,9 +517,9 @@ public class SparseBitSet implements Cloneable, Serializable
/** /**
* Performs a logical <b>AndNOT</b> of this target bit set with the argument * Performs a logical <b>AndNOT</b> of this target bit set with the argument
* bit set. This bit set is modified so that each bit in it has the value * bit set. This bit set is modified so that each bit in it has the value
* <code>true</code> if and only if it both initially had the value * {@code true} if and only if it both initially had the value
* <code>true</code> and the corresponding bit in the bit set argument has * {@code true} and the corresponding bit in the bit set argument has
* the value <code>false</code>. * the value {@code false}.
* *
* @param b the SparseBitSet with which to mask this SparseBitSet * @param b the SparseBitSet with which to mask this SparseBitSet
* @since 1.6 * @since 1.6
@ -530,12 +530,12 @@ public class SparseBitSet implements Cloneable, Serializable
} }
/** /**
* Creates a bit set from thie first <code>SparseBitSet</code> whose * Creates a bit set from thie first {@code SparseBitSet} whose
* corresponding bits are cleared by the set bits of the second * corresponding bits are cleared by the set bits of the second
* <code>SparseBitSet</code>. The resulting bit set is created so that a bit * {@code SparseBitSet}. The resulting bit set is created so that a bit
* in it has the value <code>true</code> if and only if the corresponding bit * in it has the value {@code true} if and only if the corresponding bit
* in the <code>SparseBitSet</code> of the first is set, and that same * in the {@code SparseBitSet} of the first is set, and that same
* corresponding bit is not set in the <code>SparseBitSet</code> of the second * corresponding bit is not set in the {@code SparseBitSet} of the second
* argument. * argument.
* *
* @param a a SparseBitSet * @param a a SparseBitSet
@ -552,8 +552,8 @@ public class SparseBitSet implements Cloneable, Serializable
} }
/** /**
* Returns the number of bits set to <code>true</code> in this * Returns the number of bits set to {@code true} in this
* <code>SparseBitSet</code>. * {@code SparseBitSet}.
* *
* @return the number of bits set to true in this SparseBitSet * @return the number of bits set to true in this SparseBitSet
* @since 1.6 * @since 1.6
@ -565,7 +565,7 @@ public class SparseBitSet implements Cloneable, Serializable
} }
/** /**
* Sets the bit at the specified index to <code>false</code>. * Sets the bit at the specified index to {@code false}.
* *
* @param i a bit index. * @param i a bit index.
* @exception IndexOutOfBoundsException if the specified index is negative * @exception IndexOutOfBoundsException if the specified index is negative
@ -593,14 +593,14 @@ public class SparseBitSet implements Cloneable, Serializable
} }
/** /**
* Sets the bits from the specified <code>i</code> (inclusive) to the * Sets the bits from the specified {@code i} (inclusive) to the
* specified <code>j</code> (exclusive) to <code>false</code>. * specified {@code j} (exclusive) to {@code false}.
* *
* @param i index of the first bit to be cleared * @param i index of the first bit to be cleared
* @param j index after the last bit to be cleared * @param j index after the last bit to be cleared
* @exception IndexOutOfBoundsException if <code>i</code> is negative or * @exception IndexOutOfBoundsException if {@code i} is negative or
* equal to Integer.MAX_VALUE, or <code>j</code> is negative, * equal to Integer.MAX_VALUE, or {@code j} is negative,
* or <code>i</code> is larger than <code>j</code> * or {@code i} is larger than {@code j}
* @since 1.6 * @since 1.6
*/ */
public void clear(int i, int j) throws IndexOutOfBoundsException public void clear(int i, int j) throws IndexOutOfBoundsException
@ -609,8 +609,8 @@ public class SparseBitSet implements Cloneable, Serializable
} }
/** /**
* Sets all of the bits in this <code>SparseBitSet</code> to * Sets all of the bits in this {@code SparseBitSet} to
* <code>false</code>. * {@code false}.
* *
* @since 1.6 * @since 1.6
*/ */
@ -621,15 +621,15 @@ public class SparseBitSet implements Cloneable, Serializable
} }
/** /**
* Cloning this <code>SparseBitSet</code> produces a new * Cloning this {@code SparseBitSet} produces a new
* <code>SparseBitSet</code> that is <i>equal</i>() to it. The clone of the * {@code SparseBitSet} that is <i>equal</i>() to it. The clone of the
* bit set is another bit set that has exactly the same bits set to * bit set is another bit set that has exactly the same bits set to
* <code>true</code> as this bit set. * {@code true} as this bit set.
* <p> * <p>
* Note: the actual space allocated to the clone tries to minimise the actual * Note: the actual space allocated to the clone tries to minimise the actual
* amount of storage allocated to hold the bits, while still trying to * amount of storage allocated to hold the bits, while still trying to
* keep access to the bits being a rapid as possible. Since the space * keep access to the bits being a rapid as possible. Since the space
* allocated to a <code>SparseBitSet</code> is not normally decreased, * allocated to a {@code SparseBitSet} is not normally decreased,
* replacing a bit set by its clone may be a way of both managing memory * replacing a bit set by its clone may be a way of both managing memory
* consumption and improving the rapidity of access. * consumption and improving the rapidity of access.
* *
@ -667,16 +667,16 @@ public class SparseBitSet implements Cloneable, Serializable
/** /**
* Compares this object against the specified object. The result is * Compares this object against the specified object. The result is
* <code>true</code> if and only if the argument is not <code>null</code> * {@code true} if and only if the argument is not {@code null}
* and is a <code>SparseBitSet</code> object that has exactly the same bits * and is a {@code SparseBitSet} object that has exactly the same bits
* set to <code>true</code> as this bit set. That is, for every nonnegative * set to {@code true} as this bit set. That is, for every nonnegative
* <code>i</code> indexing a bit in the set, * {@code i} indexing a bit in the set,
* <pre>((SparseBitSet)obj).get(i) == this.get(i)</pre> * <pre>((SparseBitSet)obj).get(i) == this.get(i)</pre>
* must be true. * must be true.
* *
* @param obj the Object with which to compare * @param obj the Object with which to compare
* @return <code>true</code> if the objects are equivalent; * @return {@code true} if the objects are equivalent;
* <code>false</code> otherwise. * {@code false} otherwise.
* @since 1.6 * @since 1.6
*/ */
@Override @Override
@ -726,15 +726,15 @@ public class SparseBitSet implements Cloneable, Serializable
} }
/** /**
* Sets each bit from the specified <code>i</code> (inclusive) to the * Sets each bit from the specified {@code i} (inclusive) to the
* specified <code>j</code> (exclusive) to the complement of its current * specified {@code j} (exclusive) to the complement of its current
* value. * value.
* *
* @param i index of the first bit to flip * @param i index of the first bit to flip
* @param j index after the last bit to flip * @param j index after the last bit to flip
* @exception IndexOutOfBoundsException if <code>i</code> is negative or is * @exception IndexOutOfBoundsException if {@code i} is negative or is
* equal to Integer.MAX_VALUE, or <code>j</code> is negative, or * equal to Integer.MAX_VALUE, or {@code j} is negative, or
* <code>i</code> is larger than <code>j</code> * {@code i} is larger than {@code j}
* @since 1.6 * @since 1.6
*/ */
public void flip(int i, int j) throws IndexOutOfBoundsException public void flip(int i, int j) throws IndexOutOfBoundsException
@ -744,9 +744,9 @@ public class SparseBitSet implements Cloneable, Serializable
/** /**
* Returns the value of the bit with the specified index. The value is * Returns the value of the bit with the specified index. The value is
* <code>true</code> if the bit with the index <code>i</code> is currently set * {@code true} if the bit with the index {@code i} is currently set
* in this <code>SparseBitSet</code>; otherwise, the result is * in this {@code SparseBitSet}; otherwise, the result is
* <code>false</code>. * {@code false}.
* *
* @param i the bit index * @param i the bit index
* @return the boolean value of the bit with the specified index. * @return the boolean value of the bit with the specified index.
@ -768,16 +768,16 @@ public class SparseBitSet implements Cloneable, Serializable
} }
/** /**
* Returns a new <code>SparseBitSet</code> composed of bits from this * Returns a new {@code SparseBitSet} composed of bits from this
* <code>SparseBitSet</code> from <code>i</code> (inclusive) to <code>j</code> * {@code SparseBitSet} from {@code i} (inclusive) to {@code j}
* (exclusive). * (exclusive).
* *
* @param i index of the first bit to include * @param i index of the first bit to include
* @param j index after the last bit to include * @param j index after the last bit to include
* @return a new SparseBitSet from a range of this SparseBitSet * @return a new SparseBitSet from a range of this SparseBitSet
* @exception IndexOutOfBoundsException if <code>i</code> is negative or is * @exception IndexOutOfBoundsException if {@code i} is negative or is
* equal to Integer.MAX_VALUE, or <code>j</code> is negative, or * equal to Integer.MAX_VALUE, or {@code j} is negative, or
* <code>i</code> is larger than <code>j</code> * {@code i} is larger than {@code j}
* @since 1.6 * @since 1.6
*/ */
public SparseBitSet get(int i, int j) throws IndexOutOfBoundsException public SparseBitSet get(int i, int j) throws IndexOutOfBoundsException
@ -789,17 +789,17 @@ public class SparseBitSet implements Cloneable, Serializable
/** /**
* Returns a hash code value for this bit set. The hash code depends only on * Returns a hash code value for this bit set. The hash code depends only on
* which bits have been set within this <code>SparseBitSet</code>. The * which bits have been set within this {@code SparseBitSet}. The
* algorithm used to compute it may be described as follows. * algorithm used to compute it may be described as follows.
* <p> * <p>
* Suppose the bits in the <code>SparseBitSet</code> were to be stored in an * Suppose the bits in the {@code SparseBitSet} were to be stored in an
* array of <code>long</code> integers called, say, <code>bits</code>, in such * array of {@code long} integers called, say, {@code bits}, in such
* a manner that bit <code>i</code> is set in the <code>SparseBitSet</code> * a manner that bit {@code i} is set in the {@code SparseBitSet}
* (for nonnegative values of <code>i</code>) if and only if the expression * (for nonnegative values of {@code i}) if and only if the expression
* <pre> * <pre>
* ((i&gt;&gt;6) &lt; bits.length) &amp;&amp; ((bits[i&gt;&gt;6] &amp; (1L &lt;&lt; (bit &amp; 0x3F))) != 0) * ((i&gt;&gt;6) &lt; bits.length) &amp;&amp; ((bits[i&gt;&gt;6] &amp; (1L &lt;&lt; (bit &amp; 0x3F))) != 0)
* </pre> * </pre>
* is true. Then the following definition of the <code>hashCode</code> method * is true. Then the following definition of the {@code hashCode} method
* would be a correct implementation of the actual algorithm: * would be a correct implementation of the actual algorithm:
* <pre> * <pre>
* public int hashCode() * public int hashCode()
@ -824,19 +824,19 @@ public class SparseBitSet implements Cloneable, Serializable
} }
/** /**
* Returns true if the specified <code>SparseBitSet</code> has any bits * Returns true if the specified {@code SparseBitSet} has any bits
* within the given range <code>i</code> (inclusive) to <code>j</code> * within the given range {@code i} (inclusive) to {@code j}
* (exclusive) set to <code>true</code> that are also set to <code>true</code> * (exclusive) set to {@code true} that are also set to {@code true}
* in the same range of this <code>SparseBitSet</code>. * in the same range of this {@code SparseBitSet}.
* *
* @param i index of the first bit to include * @param i index of the first bit to include
* @param j index after the last bit to include * @param j index after the last bit to include
* @param b the SparseBitSet with which to intersect * @param b the SparseBitSet with which to intersect
* @return the boolean indicating whether this SparseBitSet intersects the * @return the boolean indicating whether this SparseBitSet intersects the
* specified SparseBitSet * specified SparseBitSet
* @exception IndexOutOfBoundsException if <code>i</code> is negative or * @exception IndexOutOfBoundsException if {@code i} is negative or
* equal to Integer.MAX_VALUE, or <code>j</code> is negative, * equal to Integer.MAX_VALUE, or {@code j} is negative,
* or <code>i</code> is larger than <code>j</code> * or {@code i} is larger than {@code j}
* @since 1.6 * @since 1.6
*/ */
public boolean intersects(int i, int j, SparseBitSet b) public boolean intersects(int i, int j, SparseBitSet b)
@ -847,9 +847,9 @@ public class SparseBitSet implements Cloneable, Serializable
} }
/** /**
* Returns true if the specified <code>SparseBitSet</code> has any bits set to * Returns true if the specified {@code SparseBitSet} has any bits set to
* <code>true</code> that are also set to <code>true</code> in this * {@code true} that are also set to {@code true} in this
* <code>SparseBitSet</code>. * {@code SparseBitSet}.
* *
* @param b a SparseBitSet with which to intersect * @param b a SparseBitSet with which to intersect
* @return boolean indicating whether this SparseBitSet intersects the * @return boolean indicating whether this SparseBitSet intersects the
@ -863,8 +863,8 @@ public class SparseBitSet implements Cloneable, Serializable
} }
/** /**
* Returns true if this <code>SparseBitSet</code> contains no bits that are * Returns true if this {@code SparseBitSet} contains no bits that are
* set to <code>true</code>. * set to {@code true}.
* *
* @return the boolean indicating whether this SparseBitSet is empty * @return the boolean indicating whether this SparseBitSet is empty
* @since 1.6 * @since 1.6
@ -876,9 +876,9 @@ public class SparseBitSet implements Cloneable, Serializable
} }
/** /**
* Returns the "logical length" of this <code>SparseBitSet</code>: the index * Returns the "logical length" of this {@code SparseBitSet}: the index
* of the highest set bit in the <code>SparseBitSet</code> plus one. Returns * of the highest set bit in the {@code SparseBitSet} plus one. Returns
* zero if the <code>SparseBitSet</code> contains no set bits. * zero if the {@code SparseBitSet} contains no set bits.
* *
* @return the logical length of this SparseBitSet * @return the logical length of this SparseBitSet
* @since 1.6 * @since 1.6
@ -890,7 +890,7 @@ public class SparseBitSet implements Cloneable, Serializable
} }
/** /**
* Returns the index of the first bit that is set to <code>false</code> that * Returns the index of the first bit that is set to {@code false} that
* occurs on or after the specified starting index. * occurs on or after the specified starting index.
* *
* @param i the index to start checking from (inclusive) * @param i the index to start checking from (inclusive)
@ -957,12 +957,12 @@ public class SparseBitSet implements Cloneable, Serializable
} }
/** /**
* Returns the index of the first bit that is set to <code>true</code> that * Returns the index of the first bit that is set to {@code true} that
* occurs on or after the specified starting index. If no such it exists then * occurs on or after the specified starting index. If no such it exists then
* -1 is returned. * -1 is returned.
* <p> * <p>
* To iterate over the <code>true</code> bits in a <code>SparseBitSet * To iterate over the {@code true} bits in a {@code SparseBitSet
* sbs</code>, use the following loop: * sbs}, use the following loop:
* *
* <pre> * <pre>
* for( int i = sbbits.nextSetBit(0); i &gt;= 0; i = sbbits.nextSetBit(i+1) ) * for( int i = sbbits.nextSetBit(0); i &gt;= 0; i = sbbits.nextSetBit(i+1) )
@ -1168,8 +1168,8 @@ public class SparseBitSet implements Cloneable, Serializable
/** /**
* Performs a logical <b>OR</b> of the addressed target bit with the * Performs a logical <b>OR</b> of the addressed target bit with the
* argument value. This bit set is modified so that the addressed bit has the * argument value. This bit set is modified so that the addressed bit has the
* value <code>true</code> if and only if it both initially had the value * value {@code true} if and only if it both initially had the value
* <code>true</code> or the argument value is <code>true</code>. * {@code true} or the argument value is {@code true}.
* *
* @param i a bit index * @param i a bit index
* @param value a boolean value to OR with that bit * @param value a boolean value to OR with that bit
@ -1188,18 +1188,18 @@ public class SparseBitSet implements Cloneable, Serializable
/** /**
* Performs a logical <b>OR</b> of the addressed target bit with the * Performs a logical <b>OR</b> of the addressed target bit with the
* argument value within the given range. This bit set is modified so that * argument value within the given range. This bit set is modified so that
* within the range a bit in it has the value <code>true</code> if and only if * within the range a bit in it has the value {@code true} if and only if
* it either already had the value <code>true</code> or the corresponding bit * it either already had the value {@code true} or the corresponding bit
* in the bit set argument has the value <code>true</code>. Outside the range * in the bit set argument has the value {@code true}. Outside the range
* this set is not changed. * this set is not changed.
* *
* @param i index of the first bit to be included in the operation * @param i index of the first bit to be included in the operation
* @param j index after the last bit to included in the operation * @param j index after the last bit to included in the operation
* @param b the SparseBitSet with which to perform the <b>OR</b> * @param b the SparseBitSet with which to perform the <b>OR</b>
* operation with this SparseBitSet * operation with this SparseBitSet
* @exception IndexOutOfBoundsException if <code>i</code> is negative or * @exception IndexOutOfBoundsException if {@code i} is negative or
* equal to Integer.MAX_VALUE, or <code>j</code> is negative, * equal to Integer.MAX_VALUE, or {@code j} is negative,
* or <code>i</code> is larger than <code>j</code> * or {@code i} is larger than {@code j}
* @since 1.6 * @since 1.6
*/ */
public void or(int i, int j, SparseBitSet b) throws IndexOutOfBoundsException public void or(int i, int j, SparseBitSet b) throws IndexOutOfBoundsException
@ -1209,9 +1209,9 @@ public class SparseBitSet implements Cloneable, Serializable
/** /**
* Performs a logical <b>OR</b> of this bit set with the bit set argument. * Performs a logical <b>OR</b> of this bit set with the bit set argument.
* This bit set is modified so that a bit in it has the value <code>true</code> * This bit set is modified so that a bit in it has the value {@code true}
* if and only if it either already had the value <code>true</code> or the * if and only if it either already had the value {@code true} or the
* corresponding bit in the bit set argument has the value <code>true</code>. * corresponding bit in the bit set argument has the value {@code true}.
* *
* @param b the SparseBitSet with which to perform the <b>OR</b> * @param b the SparseBitSet with which to perform the <b>OR</b>
* operation with this SparseBitSet * operation with this SparseBitSet
@ -1223,11 +1223,11 @@ public class SparseBitSet implements Cloneable, Serializable
} }
/** /**
* Performs a logical <b>OR</b> of the two given <code>SparseBitSet</code>s. * Performs a logical <b>OR</b> of the two given {@code SparseBitSet}s.
* The returned <code>SparseBitSet</code> is created so that a bit in it has * The returned {@code SparseBitSet} is created so that a bit in it has
* the value <code>true</code> if and only if it either had the value * the value {@code true} if and only if it either had the value
* <code>true</code> in the set given by the first arguemetn or had the value * {@code true} in the set given by the first arguemetn or had the value
* <code>true</code> in the second argument, otherwise <code>false</code>. * {@code true} in the second argument, otherwise {@code false}.
* *
* @param a a SparseBitSet * @param a a SparseBitSet
* @param b another SparseBitSet * @param b another SparseBitSet
@ -1287,14 +1287,14 @@ public class SparseBitSet implements Cloneable, Serializable
} }
/** /**
* Sets the bits from the specified <code>i</code> (inclusive) to the specified * Sets the bits from the specified {@code i} (inclusive) to the specified
* <code>j</code> (exclusive) to <code>true</code>. * {@code j} (exclusive) to {@code true}.
* *
* @param i index of the first bit to be set * @param i index of the first bit to be set
* @param j index after the last bit to be se * @param j index after the last bit to be se
* @exception IndexOutOfBoundsException if <code>i</code> is negative or is * @exception IndexOutOfBoundsException if {@code i} is negative or is
* equal to Integer.MAX_INT, or <code>j</code> is negative, or * equal to Integer.MAX_INT, or {@code j} is negative, or
* <code>i</code> is larger than <code>j</code>. * {@code i} is larger than {@code j}.
* @since 1.6 * @since 1.6
*/ */
public void set(int i, int j) throws IndexOutOfBoundsException public void set(int i, int j) throws IndexOutOfBoundsException
@ -1303,15 +1303,15 @@ public class SparseBitSet implements Cloneable, Serializable
} }
/** /**
* Sets the bits from the specified <code>i</code> (inclusive) to the specified * Sets the bits from the specified {@code i} (inclusive) to the specified
* <code>j</code> (exclusive) to the specified value. * {@code j} (exclusive) to the specified value.
* *
* @param i index of the first bit to be set * @param i index of the first bit to be set
* @param j index after the last bit to be set * @param j index after the last bit to be set
* @param value to which to set the selected bits * @param value to which to set the selected bits
* @exception IndexOutOfBoundsException if <code>i</code> is negative or is * @exception IndexOutOfBoundsException if {@code i} is negative or is
* equal to Integer.MAX_VALUE, or <code>j</code> is negative, or * equal to Integer.MAX_VALUE, or {@code j} is negative, or
* <code>i</code> is larger than <code>j</code> * {@code i} is larger than {@code j}
* @since 1.6 * @since 1.6
*/ */
public void set(int i, int j, boolean value) public void set(int i, int j, boolean value)
@ -1324,7 +1324,7 @@ public class SparseBitSet implements Cloneable, Serializable
/** /**
* Returns the number of bits of space nominally in use by this * Returns the number of bits of space nominally in use by this
* <code>SparseBitSet</code> to represent bit values. The count of bits in * {@code SparseBitSet} to represent bit values. The count of bits in
* the set is the (label of the last set bit) + 1 - (the label of the first * the set is the (label of the last set bit) + 1 - (the label of the first
* set bit). * set bit).
* *
@ -1360,7 +1360,7 @@ public class SparseBitSet implements Cloneable, Serializable
* <p> * <p>
* This method is intended for diagnostic use (as it is relatively expensive * This method is intended for diagnostic use (as it is relatively expensive
* in time), but can be useful in understanding an application's use of a * in time), but can be useful in understanding an application's use of a
* <code>SparseBitSet</code>. * {@code SparseBitSet}.
* *
* @param values an array for the individual results (if not null) * @param values an array for the individual results (if not null)
* @return a String detailing the statistics of the bit set * @return a String detailing the statistics of the bit set
@ -1423,7 +1423,7 @@ public class SparseBitSet implements Cloneable, Serializable
/** /**
* Returns a string representation of this bit set. For every index for which * Returns a string representation of this bit set. For every index for which
* this <code>SparseBitSet</code> contains a bit in the set state, the decimal * this {@code SparseBitSet} contains a bit in the set state, the decimal
* representation of that index is included in the result. Such indices are * representation of that index is included in the result. Such indices are
* listed in order from lowest to highest. If there is a subsequence of set * listed in order from lowest to highest. If there is a subsequence of set
* bits longer than the value given by toStringCompaction, the subsequence * bits longer than the value given by toStringCompaction, the subsequence
@ -1437,22 +1437,22 @@ public class SparseBitSet implements Cloneable, Serializable
* <pre> * <pre>
* SparseBitSet drPepper = new SparseBitSet(); * SparseBitSet drPepper = new SparseBitSet();
* </pre> * </pre>
* Now <code>drPepper.toString()</code> returns "<code>{}</code>". * Now {@code drPepper.toString()} returns "{@code {}}".
* <br> * <br>
* <pre> * <pre>
* drPepper.set(2); * drPepper.set(2);
* </pre> * </pre>
* Now <code>drPepper.toString()</code> returns "<code>{2}</code>". * Now {@code drPepper.toString()} returns "{@code {2}}".
* <br> * <br>
* <pre> * <pre>
* drPepper.set(3, 4); * drPepper.set(3, 4);
* drPepper.set(10); * drPepper.set(10);
* </pre> * </pre>
* Now <code>drPepper.toString()</code> returns "<code>{2..4, 10}</code>". * Now {@code drPepper.toString()} returns "{@code {2..4, 10}}".
* <br> * <br>
* This method is intended for diagnostic use (as it is relatively expensive * This method is intended for diagnostic use (as it is relatively expensive
* in time), but can be useful in interpreting problems in an application's use * in time), but can be useful in interpreting problems in an application's use
* of a <code>SparseBitSet</code>. * of a {@code SparseBitSet}.
* *
* @return a String representation of this SparseBitSet * @return a String representation of this SparseBitSet
* @see #toStringCompaction(int length) * @see #toStringCompaction(int length)
@ -1504,18 +1504,18 @@ public class SparseBitSet implements Cloneable, Serializable
} }
/** Sequences of set bits longer than this value are shown by /** Sequences of set bits longer than this value are shown by
* {@link #toString()} as a "sub-sequence," in the form <code>a..b</code>. * {@link #toString()} as a "sub-sequence," in the form {@code a..b}.
* Setting this value to zero causes each set bit to be listed individually. * Setting this value to zero causes each set bit to be listed individually.
* The default default value is 2 (which means sequences of three or more * The default default value is 2 (which means sequences of three or more
* bits set are shown as a subsequence, and all other set bits are listed * bits set are shown as a subsequence, and all other set bits are listed
* individually). * individually).
* <p> * <p>
* Note: this value will be passed to <code>SparseBitSet</code>s that * Note: this value will be passed to {@code SparseBitSet}s that
* may be created within or as a result of the operations on this bit set, * may be created within or as a result of the operations on this bit set,
* or, for static methods, from the value belonging to the first parameter. * or, for static methods, from the value belonging to the first parameter.
* *
* @param count the maximum count of a run of bits that are shown as * @param count the maximum count of a run of bits that are shown as
* individual entries in a <code>toString</code>() conversion. * individual entries in a {@code toString}() conversion.
* If 0, all bits are shown individually. * If 0, all bits are shown individually.
* @since 1.6 * @since 1.6
* @see #toString() * @see #toString()
@ -1526,9 +1526,9 @@ public class SparseBitSet implements Cloneable, Serializable
} }
/** /**
* If <i>change</i> is <code>true</code>, the current value of the * If <i>change</i> is {@code true}, the current value of the
* <i>toStringCompaction</i>() value is made the default value for all * <i>toStringCompaction</i>() value is made the default value for all
* <code>SparseBitSet</code>s created from this point onward in this JVM. * {@code SparseBitSet}s created from this point onward in this JVM.
* *
* @param change if true, change the default value * @param change if true, change the default value
* @since 1.6 * @since 1.6
@ -1546,17 +1546,17 @@ public class SparseBitSet implements Cloneable, Serializable
/** /**
* Performs a logical <b>XOR</b> of the addressed target bit with the * Performs a logical <b>XOR</b> of the addressed target bit with the
* argument value. This bit set is modified so that the addressed bit has the * argument value. This bit set is modified so that the addressed bit has the
* value <code>true</code> if and only one of the following statements holds: * value {@code true} if and only one of the following statements holds:
* <ul> * <ul>
* <li>The addressed bit initially had the value <code>true</code>, and the * <li>The addressed bit initially had the value {@code true}, and the
* value of the argument is <code>false</code>. * value of the argument is {@code false}.
* <li>The bit initially had the value <code>false</code>, and the * <li>The bit initially had the value {@code false}, and the
* value of the argument is <code>true</code>. * value of the argument is {@code true}.
* </ul> * </ul>
* *
* @param i a bit index * @param i a bit index
* @param value a boolean value to <b>XOR</b> with that bit * @param value a boolean value to <b>XOR</b> with that bit
* @exception java.lang.IndexOutOfBoundsException if the specified index * @exception IndexOutOfBoundsException if the specified index
* is negative * is negative
* or equal to Integer.MAX_VALUE * or equal to Integer.MAX_VALUE
* @since 1.6 * @since 1.6
@ -1572,13 +1572,13 @@ public class SparseBitSet implements Cloneable, Serializable
/** /**
* Performs a logical <b>XOR</b> of this bit set with the bit set argument * Performs a logical <b>XOR</b> of this bit set with the bit set argument
* within the given range. This resulting bit set is computed so that a bit * within the given range. This resulting bit set is computed so that a bit
* within the range in it has the value <code>true</code> if and only if one * within the range in it has the value {@code true} if and only if one
* of the following statements holds: * of the following statements holds:
* <ul> * <ul>
* <li>The bit initially had the value <code>true</code>, and the * <li>The bit initially had the value {@code true}, and the
* corresponding bit in the argument set has the value <code>false</code>. * corresponding bit in the argument set has the value {@code false}.
* <li>The bit initially had the value <code>false</code>, and the * <li>The bit initially had the value {@code false}, and the
* corresponding bit in the argument set has the value <code>true</code>. * corresponding bit in the argument set has the value {@code true}.
* </ul> * </ul>
* Outside the range this set is not changed. * Outside the range this set is not changed.
* *
@ -1586,9 +1586,9 @@ public class SparseBitSet implements Cloneable, Serializable
* @param j index after the last bit to included in the operation * @param j index after the last bit to included in the operation
* @param b the SparseBitSet with which to perform the <b>XOR</b> * @param b the SparseBitSet with which to perform the <b>XOR</b>
* operation with this SparseBitSet * operation with this SparseBitSet
* @exception IndexOutOfBoundsException if <code>i</code> is negative or * @exception IndexOutOfBoundsException if {@code i} is negative or
* equal to Integer.MAX_VALUE, or <code>j</code> is negative, * equal to Integer.MAX_VALUE, or {@code j} is negative,
* or <code>i</code> is larger than <code>j</code> * or {@code i} is larger than {@code j}
* @since 1.6 * @since 1.6
*/ */
public void xor(int i, int j, SparseBitSet b) throws IndexOutOfBoundsException public void xor(int i, int j, SparseBitSet b) throws IndexOutOfBoundsException
@ -1599,12 +1599,12 @@ public class SparseBitSet implements Cloneable, Serializable
/** /**
* Performs a logical <b>XOR</b> of this bit set with the bit set argument. * Performs a logical <b>XOR</b> of this bit set with the bit set argument.
* This resulting bit set is computed so that a bit in it has the value * This resulting bit set is computed so that a bit in it has the value
* <code>true</code> if and only if one of the following statements holds: * {@code true} if and only if one of the following statements holds:
* <ul> * <ul>
* <li>The bit initially had the value <code>true</code>, and the * <li>The bit initially had the value {@code true}, and the
* corresponding bit in the argument set has the value <code>false</code>. * corresponding bit in the argument set has the value {@code false}.
* <li>The bit initially had the value <code>false</code>, and the * <li>The bit initially had the value {@code false}, and the
* corresponding bit in the argument set has the value <code>true</code>. * corresponding bit in the argument set has the value {@code true}.
* </ul> * </ul>
* *
* @param b the SparseBitSet with which to perform the <b>XOR</b> * @param b the SparseBitSet with which to perform the <b>XOR</b>
@ -1617,16 +1617,16 @@ public class SparseBitSet implements Cloneable, Serializable
} }
/** /**
* Performs a logical <b>XOR</b> of the two given <code>SparseBitSet</code>s. * Performs a logical <b>XOR</b> of the two given {@code SparseBitSet}s.
* The resulting bit set is created so that a bit in it has the value * The resulting bit set is created so that a bit in it has the value
* <code>true</code> if and only if one of the following statements holds: * {@code true} if and only if one of the following statements holds:
* <ul> * <ul>
* <li>A bit in the first argument has the value <code>true</code>, and the * <li>A bit in the first argument has the value {@code true}, and the
* corresponding bit in the second argument has the value * corresponding bit in the second argument has the value
* <code>false</code>.</li> * {@code false}.</li>
* <li>A bit in the first argument has the value <code>false</code>, and the * <li>A bit in the first argument has the value {@code false}, and the
* corresponding bit in the second argument has the value * corresponding bit in the second argument has the value
* <code>true</code>.</li></ul> * {@code true}.</li></ul>
* *
* @param a a SparseBitSet * @param a a SparseBitSet
* @param b another SparseBitSet * @param b another SparseBitSet
@ -1645,7 +1645,7 @@ public class SparseBitSet implements Cloneable, Serializable
//============================================================================== //==============================================================================
/** /**
* Throw the exception to indicate a range error. The <code>String</code> * Throw the exception to indicate a range error. The {@code String}
* constructed reports all the possible errors in one message. * constructed reports all the possible errors in one message.
* *
* @param i lower bound for a operation * @param i lower bound for a operation
@ -1743,7 +1743,7 @@ public class SparseBitSet implements Cloneable, Serializable
* Scans over the bit set (and a second bit set if part of the operation) are * Scans over the bit set (and a second bit set if part of the operation) are
* all performed by this method. The properties and the operation executed * all performed by this method. The properties and the operation executed
* are defined by a given strategy, which must be derived from the * are defined by a given strategy, which must be derived from the
* <code>AbstractStrategy</code>. The strategy defines how to operate on a * {@code AbstractStrategy}. The strategy defines how to operate on a
* single word, and on whole words that may or may not constitute a full * single word, and on whole words that may or may not constitute a full
* block of words. * block of words.
* *
@ -1993,7 +1993,7 @@ public class SparseBitSet implements Cloneable, Serializable
//============================================================================== //==============================================================================
/** /**
* Save the state of the <code>SparseBitSet</code> instance to a stream * Save the state of the {@code SparseBitSet} instance to a stream
* (<i>i.e.</i>, serialize it). * (<i>i.e.</i>, serialize it).
* *
* @param s the ObjectOutputStream to which to write the serialized object * @param s the ObjectOutputStream to which to write the serialized object
@ -2004,10 +2004,10 @@ public class SparseBitSet implements Cloneable, Serializable
* @serialData The default data is emitted, followed by the current * @serialData The default data is emitted, followed by the current
* <i>compactionCount</i> for the bit set, and then the * <i>compactionCount</i> for the bit set, and then the
* <i>length</i> of the set (the position of the last bit), * <i>length</i> of the set (the position of the last bit),
* followed by the <i>cache.count</i> value (an <code>int</code>, * followed by the <i>cache.count</i> value (an {@code int},
* the number of <code>int-&gt;long</code> pairs needed to describe * the number of {@code int->long} pairs needed to describe
* the set), followed by the index (<code>int</code>) and word * the set), followed by the index ({@code int}) and word
* (<code>long</code>) for each <code>int-&gt;long</code> pair. * ({@code long}) for each {@code int->long} pair.
* The mappings need not be emitted in any particular order. This * The mappings need not be emitted in any particular order. This
* is followed by the <i>hashCode</i> for the set that can be used * is followed by the <i>hashCode</i> for the set that can be used
* as an integrity check when the bit set is read back. * as an integrity check when the bit set is read back.
@ -2056,7 +2056,7 @@ public class SparseBitSet implements Cloneable, Serializable
private static final long serialVersionUID = -6663013367427929992L; private static final long serialVersionUID = -6663013367427929992L;
/** /**
* Reconstitute the <code>SparseBitSet</code> instance from a stream * Reconstitute the {@code SparseBitSet} instance from a stream
* (<i>i.e.</i>, deserialize it). * (<i>i.e.</i>, deserialize it).
* *
* @param s the ObjectInputStream to use * @param s the ObjectInputStream to use
@ -2110,12 +2110,12 @@ public class SparseBitSet implements Cloneable, Serializable
/** /**
* These enumeration values are used as labels for the values in the String * These enumeration values are used as labels for the values in the String
* created by the <i>statistics</i>() method. The values of the corresponding * created by the <i>statistics</i>() method. The values of the corresponding
* statistics are <code>int</code>s, except for the loadFactor and * statistics are {@code int}s, except for the loadFactor and
* Average_chain_length values, which are <code>float</code>s. * Average_chain_length values, which are {@code float}s.
* <p> * <p>
* An array of <code>String</code>s may be obtained containing a * An array of {@code String}s may be obtained containing a
* representation of each of these values. An element of such an array, say, * representation of each of these values. An element of such an array, say,
* <code>values</code>, may be accessed, for example, by: * {@code values}, may be accessed, for example, by:
* <pre> * <pre>
* values[SparseBitSet.statistics.Buckets_available.ordinal()]</pre> * values[SparseBitSet.statistics.Buckets_available.ordinal()]</pre>
* *
@ -2243,12 +2243,12 @@ public class SparseBitSet implements Cloneable, Serializable
/** /**
* This strategy class is used by the setScanner to carry out the a variety * This strategy class is used by the setScanner to carry out the a variety
* of operations on this set, and usually a second set. The * of operations on this set, and usually a second set. The
* <i>setScanner</i>() method of the main <code>SparseBitSet</code> class * <i>setScanner</i>() method of the main {@code SparseBitSet} class
* essentially finds matching level3 blocks, and then calls the strategy to * essentially finds matching level3 blocks, and then calls the strategy to
* do the appropriate operation on each of the elements of the block. * do the appropriate operation on each of the elements of the block.
* <p> * <p>
* The symbolic constants control optimisation paths in the * The symbolic constants control optimisation paths in the
* <i>setScanner</i>() method of the main <code>SparseBitSet</code> class. * <i>setScanner</i>() method of the main {@code SparseBitSet} class.
* *
* @see SparseBitSet#setScanner(int i, int j, * @see SparseBitSet#setScanner(int i, int j,
* SparseBitSet b, AbstractStrategy op) * SparseBitSet b, AbstractStrategy op)
@ -2366,10 +2366,7 @@ public class SparseBitSet implements Cloneable, Serializable
*/ */
protected final boolean isZeroBlock(long[] a3) protected final boolean isZeroBlock(long[] a3)
{ {
for (long word : a3) return Arrays.stream(a3).noneMatch(word -> word != 0L);
if (word != 0L)
return false;
return true;
} }
} }

View File

@ -1,5 +1,6 @@
package com.boydti.fawe.object.collection; package com.boydti.fawe.object.collection;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.io.Closeable; import java.io.Closeable;
@ -12,9 +13,9 @@ import java.util.function.Consumer;
public class YieldIterable<T> implements Iterable<T>, Consumer<T>, Closeable { public class YieldIterable<T> implements Iterable<T>, Consumer<T>, Closeable {
private static final Object END_MARKER = new Object(); private static final Object END_MARKER = new Object();
private final LinkedBlockingQueue<T> queue; private final LinkedBlockingQueue<T> queue;
private Future future; private Future<Integer> future;
public YieldIterable(@Nullable Future task) { public YieldIterable(@Nullable Future<Integer> task) {
this.queue = new LinkedBlockingQueue<>(); this.queue = new LinkedBlockingQueue<>();
this.future = task; this.future = task;
} }
@ -23,10 +24,11 @@ public class YieldIterable<T> implements Iterable<T>, Consumer<T>, Closeable {
this(null); this(null);
} }
public void setFuture(Future future) { public void setFuture(Future<Integer> future) {
this.future = future; this.future = future;
} }
@NotNull
@Override @Override
public Iterator<T> iterator() { public Iterator<T> iterator() {
return new Iterator<T>() { return new Iterator<T>() {

View File

@ -71,7 +71,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
public <B extends BlockStateHolder<B>> boolean setBlock(int x, int y, int z, B block) throws WorldEditException { public <B extends BlockStateHolder<B>> boolean setBlock(int x, int y, int z, B block) throws WorldEditException {
if (!contains(x, y, z)) { if (!contains(x, y, z)) {
if (!limit.MAX_FAILS()) { if (!limit.MAX_FAILS()) {
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOUTSIDE_REGION()); WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOutsideRegion());
} }
return false; return false;
} }
@ -82,7 +82,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
public boolean setBiome(int x, int y, int z, BiomeType biome) { public boolean setBiome(int x, int y, int z, BiomeType biome) {
if (!contains(x, y, z)) { if (!contains(x, y, z)) {
if (!limit.MAX_FAILS()) { if (!limit.MAX_FAILS()) {
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOUTSIDE_REGION()); WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOutsideRegion());
} }
return false; return false;
} }
@ -93,7 +93,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
public BiomeType getBiome(BlockVector2 position) { public BiomeType getBiome(BlockVector2 position) {
if (!contains(position)) { if (!contains(position)) {
if (!limit.MAX_FAILS()) { if (!limit.MAX_FAILS()) {
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOUTSIDE_REGION()); WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOutsideRegion());
} }
return null; return null;
} }
@ -104,7 +104,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
public BiomeType getBiomeType(int x, int y, int z) { public BiomeType getBiomeType(int x, int y, int z) {
if (!contains(x, z)) { if (!contains(x, z)) {
if (!limit.MAX_FAILS()) { if (!limit.MAX_FAILS()) {
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOUTSIDE_REGION()); WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOutsideRegion());
} }
return null; return null;
} }
@ -115,7 +115,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
public BaseBlock getFullBlock(BlockVector3 position) { public BaseBlock getFullBlock(BlockVector3 position) {
if (!contains(position)) { if (!contains(position)) {
if (!limit.MAX_FAILS()) { if (!limit.MAX_FAILS()) {
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOUTSIDE_REGION()); WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOutsideRegion());
} }
return BlockTypes.AIR.getDefaultState().toBaseBlock(); return BlockTypes.AIR.getDefaultState().toBaseBlock();
} }
@ -126,7 +126,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
public BlockState getBlock(BlockVector3 position) { public BlockState getBlock(BlockVector3 position) {
if (!contains(position)) { if (!contains(position)) {
if (!limit.MAX_FAILS()) { if (!limit.MAX_FAILS()) {
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOUTSIDE_REGION()); WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOutsideRegion());
} }
return BlockTypes.AIR.getDefaultState(); return BlockTypes.AIR.getDefaultState();
} }
@ -137,7 +137,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
public int getBlockLight(int x, int y, int z) { public int getBlockLight(int x, int y, int z) {
if (!contains(x, y, z)) { if (!contains(x, y, z)) {
if (!limit.MAX_FAILS()) { if (!limit.MAX_FAILS()) {
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOUTSIDE_REGION()); WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOutsideRegion());
} }
return 0; return 0;
} }
@ -148,7 +148,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
public int getBrightness(int x, int y, int z) { public int getBrightness(int x, int y, int z) {
if (!contains(x, y, z)) { if (!contains(x, y, z)) {
if (!limit.MAX_FAILS()) { if (!limit.MAX_FAILS()) {
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOUTSIDE_REGION()); WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOutsideRegion());
} }
return 0; return 0;
} }
@ -159,7 +159,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
public int getLight(int x, int y, int z) { public int getLight(int x, int y, int z) {
if (!contains(x, y, z)) { if (!contains(x, y, z)) {
if (!limit.MAX_FAILS()) { if (!limit.MAX_FAILS()) {
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOUTSIDE_REGION()); WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOutsideRegion());
} }
return 0; return 0;
} }
@ -170,7 +170,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
public int getOpacity(int x, int y, int z) { public int getOpacity(int x, int y, int z) {
if (!contains(x, y, z)) { if (!contains(x, y, z)) {
if (!limit.MAX_FAILS()) { if (!limit.MAX_FAILS()) {
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOUTSIDE_REGION()); WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOutsideRegion());
} }
return 0; return 0;
} }
@ -181,7 +181,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
public int getSkyLight(int x, int y, int z) { public int getSkyLight(int x, int y, int z) {
if (!contains(x, y, z)) { if (!contains(x, y, z)) {
if (!limit.MAX_FAILS()) { if (!limit.MAX_FAILS()) {
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOUTSIDE_REGION()); WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOutsideRegion());
} }
return 0; return 0;
} }
@ -193,7 +193,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
public Entity createEntity(Location location, BaseEntity entity) { public Entity createEntity(Location location, BaseEntity entity) {
if (!contains(location.getBlockX(), location.getBlockY(), location.getBlockZ())) { if (!contains(location.getBlockX(), location.getBlockY(), location.getBlockZ())) {
if (!limit.MAX_FAILS()) { if (!limit.MAX_FAILS()) {
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOUTSIDE_REGION()); WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getOutsideRegion());
} }
return null; return null;
} }

View File

@ -26,7 +26,7 @@ public class MemoryCheckingExtent extends PassthroughExtent {
this.player.print(TranslatableComponent.of("fawe.info.worldedit.oom.admin")); this.player.print(TranslatableComponent.of("fawe.info.worldedit.oom.admin"));
} }
} }
WEManager.IMP.cancelEdit(this, FaweCache.INSTANCE.getLOW_MEMORY()); WEManager.IMP.cancelEdit(this, FaweCache.INSTANCE.getLowMemory());
} }
return super.getExtent(); return super.getExtent();
} }

View File

@ -54,7 +54,7 @@ public class NullExtent extends FaweRegionExtent implements IBatchProcessor {
} }
public NullExtent() { public NullExtent() {
this(new com.sk89q.worldedit.extent.NullExtent(), FaweCache.INSTANCE.getMANUAL()); this(new com.sk89q.worldedit.extent.NullExtent(), FaweCache.INSTANCE.getManual());
} }
@Override @Override

View File

@ -2,7 +2,6 @@ package com.boydti.fawe.object.extent;
import com.boydti.fawe.FaweCache; import com.boydti.fawe.FaweCache;
import com.boydti.fawe.object.FaweLimit; import com.boydti.fawe.object.FaweLimit;
import com.boydti.fawe.object.exception.FaweException;
import com.boydti.fawe.util.WEManager; import com.boydti.fawe.util.WEManager;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.BaseEntity;
@ -38,7 +37,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
return null; return null;
} }
if (!limit.MAX_ENTITIES()) { if (!limit.MAX_ENTITIES()) {
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getMAX_ENTITIES()); WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getMaxEntities());
return null; return null;
} }
return super.createEntity(location, entity); return super.createEntity(location, entity);
@ -47,7 +46,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
@Override @Override
public BlockState getBlock(int x, int y, int z) { public BlockState getBlock(int x, int y, int z) {
if (!limit.MAX_CHECKS()) { if (!limit.MAX_CHECKS()) {
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getMAX_CHECKS()); WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getMaxChecks());
return BlockTypes.AIR.getDefaultState(); return BlockTypes.AIR.getDefaultState();
} else { } else {
return extent.getBlock(x, y, z); return extent.getBlock(x, y, z);
@ -57,7 +56,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
@Override @Override
public BaseBlock getFullBlock(BlockVector3 pos) { public BaseBlock getFullBlock(BlockVector3 pos) {
if (!limit.MAX_CHECKS()) { if (!limit.MAX_CHECKS()) {
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getMAX_CHECKS()); WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getMaxChecks());
return BlockTypes.AIR.getDefaultState().toBaseBlock(); return BlockTypes.AIR.getDefaultState().toBaseBlock();
} else { } else {
return extent.getFullBlock(pos); return extent.getFullBlock(pos);
@ -79,18 +78,18 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
boolean hasNbt = block instanceof BaseBlock && block.hasNbtData(); boolean hasNbt = block instanceof BaseBlock && block.hasNbtData();
if (hasNbt) { if (hasNbt) {
if (!limit.MAX_BLOCKSTATES()) { if (!limit.MAX_BLOCKSTATES()) {
WEManager.IMP.cancelEdit(this, FaweCache.INSTANCE.getMAX_TILES()); WEManager.IMP.cancelEdit(this, FaweCache.INSTANCE.getMaxTiles());
return false; return false;
} else { } else {
if (!limit.MAX_CHANGES()) { if (!limit.MAX_CHANGES()) {
WEManager.IMP.cancelEdit(this, FaweCache.INSTANCE.getMAX_CHANGES()); WEManager.IMP.cancelEdit(this, FaweCache.INSTANCE.getMaxChanges());
return false; return false;
} }
return extent.setBlock(x, y, z, block); return extent.setBlock(x, y, z, block);
} }
} }
if (!limit.MAX_CHANGES()) { if (!limit.MAX_CHANGES()) {
WEManager.IMP.cancelEdit(this, FaweCache.INSTANCE.getMAX_CHANGES()); WEManager.IMP.cancelEdit(this, FaweCache.INSTANCE.getMaxChanges());
return false; return false;
} else { } else {
return extent.setBlock(x, y, z, block); return extent.setBlock(x, y, z, block);
@ -100,7 +99,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
@Override @Override
public boolean setBiome(BlockVector2 position, BiomeType biome) { public boolean setBiome(BlockVector2 position, BiomeType biome) {
if (!limit.MAX_CHANGES()) { if (!limit.MAX_CHANGES()) {
WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getMAX_CHANGES()); WEManager.IMP.cancelEditSafe(this, FaweCache.INSTANCE.getMaxChanges());
return false; return false;
} }
return super.setBiome(position, biome); return super.setBiome(position, biome);

View File

@ -4,7 +4,6 @@ import com.google.common.collect.Lists;
import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent; import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.object.IntegerTrio;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.Operation;
@ -20,6 +19,7 @@ import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import kotlin.Triple;
public abstract class DFSVisitor implements Operation { public abstract class DFSVisitor implements Operation {
@ -57,11 +57,11 @@ public abstract class DFSVisitor implements Operation {
return this.directions; return this.directions;
} }
private IntegerTrio[] getIntDirections() { private Triple[] getIntDirections() {
IntegerTrio[] array = new IntegerTrio[directions.size()]; Triple[] array = new Triple[directions.size()];
for (int i = 0; i < array.length; i++) { for (int i = 0; i < array.length; i++) {
BlockVector3 dir = directions.get(i); BlockVector3 dir = directions.get(i);
array[i] = new IntegerTrio(dir.getBlockX(), dir.getBlockY(), dir.getBlockZ()); array[i] = new Triple<>(dir.getBlockX(), dir.getBlockY(), dir.getBlockZ());
} }
return array; return array;
} }
@ -83,7 +83,7 @@ public abstract class DFSVisitor implements Operation {
// MutableBlockVector3 mutable = new MutableBlockVector3(); // MutableBlockVector3 mutable = new MutableBlockVector3();
// MutableBlockVector3 mutable2 = new MutableBlockVector3(); // MutableBlockVector3 mutable2 = new MutableBlockVector3();
int countAdd, countAttempt; int countAdd, countAttempt;
IntegerTrio[] dirs = getIntDirections(); Triple[] dirs = getIntDirections();
for (int layer = 0; !queue.isEmpty(); layer++) { for (int layer = 0; !queue.isEmpty(); layer++) {
current = queue.poll(); current = queue.poll();
@ -99,11 +99,11 @@ public abstract class DFSVisitor implements Operation {
function.apply(bv); function.apply(bv);
countAdd = 0; countAdd = 0;
countAttempt = 0; countAttempt = 0;
for (IntegerTrio direction : dirs) { for (Triple<Integer,Integer,Integer> direction : dirs) {
// mutable2.mutX(from.getX() + direction.x); // mutable2.mutX(from.getX() + direction.x);
// mutable2.mutY(from.getY() + direction.y); // mutable2.mutY(from.getY() + direction.y);
// mutable2.mutZ(from.getZ() + direction.z); // mutable2.mutZ(from.getZ() + direction.z);
BlockVector3 bv2 = BlockVector3.at(from.getX() + direction.x, from.getY() + direction.y, from.getZ() + direction.z); BlockVector3 bv2 = BlockVector3.at(from.getX() + direction.getFirst(), from.getY() + direction.getSecond(), from.getZ() + direction.getThird());
if (isVisitable(bv, bv2)) { if (isVisitable(bv, bv2)) {
adjacent = new Node(bv2.getBlockX(), bv2.getBlockY(), bv2.getBlockZ()); adjacent = new Node(bv2.getBlockX(), bv2.getBlockY(), bv2.getBlockZ());
if ((!adjacent.equals(current.from))) { if ((!adjacent.equals(current.from))) {

View File

@ -232,11 +232,11 @@ public class EditSessionBuilder {
event.setExtent(extent); event.setExtent(extent);
eventBus.post(event); eventBus.post(event);
if (event.isCancelled()) { if (event.isCancelled()) {
return new NullExtent(extent, FaweCache.INSTANCE.getMANUAL()); return new NullExtent(extent, FaweCache.INSTANCE.getManual());
} }
final Extent toReturn = event.getExtent(); final Extent toReturn = event.getExtent();
if(toReturn instanceof com.sk89q.worldedit.extent.NullExtent) { if(toReturn instanceof com.sk89q.worldedit.extent.NullExtent) {
return new NullExtent(toReturn, FaweCache.INSTANCE.getMANUAL()); return new NullExtent(toReturn, FaweCache.INSTANCE.getManual());
} }
// if (!(toReturn instanceof AbstractDelegateExtent)) { // if (!(toReturn instanceof AbstractDelegateExtent)) {
// Fawe.debug("Extent " + toReturn + " must be AbstractDelegateExtent"); // Fawe.debug("Extent " + toReturn + " must be AbstractDelegateExtent");
@ -316,7 +316,7 @@ public class EditSessionBuilder {
if (Permission.hasPermission(player, "worldedit.fast")) { if (Permission.hasPermission(player, "worldedit.fast")) {
player.print(TranslatableComponent.of("fawe.info.worldedit.oom.admin")); player.print(TranslatableComponent.of("fawe.info.worldedit.oom.admin"));
} }
throw FaweCache.INSTANCE.getLOW_MEMORY(); throw FaweCache.INSTANCE.getLowMemory();
} }
} }
// this.originalLimit = limit; // this.originalLimit = limit;
@ -420,7 +420,7 @@ public class EditSessionBuilder {
FaweRegionExtent regionExtent = null; FaweRegionExtent regionExtent = null;
if (allowedRegions != null) { if (allowedRegions != null) {
if (allowedRegions.length == 0) { if (allowedRegions.length == 0) {
regionExtent = new NullExtent(this.extent, FaweCache.INSTANCE.getNO_REGION()); regionExtent = new NullExtent(this.extent, FaweCache.INSTANCE.getNoRegion());
} else { } else {
// this.extent = new ProcessedWEExtent(this.extent, this.limit); // this.extent = new ProcessedWEExtent(this.extent, this.limit);
if (allowedRegions.length == 1) { if (allowedRegions.length == 1) {

View File

@ -1,5 +1,7 @@
package com.boydti.fawe.util; package com.boydti.fawe.util;
import kotlin.UInt;
public class MathMan { public class MathMan {
/** /**
@ -414,4 +416,10 @@ public class MathMan {
public static boolean isPowerOfTwo(int x) { public static boolean isPowerOfTwo(int x) {
return (x & (x - 1)) == 0; return (x & (x - 1)) == 0;
} }
public static int floor(double value) {
int i = (int)value;
return value < (double)i ? i - 1 : i;
}
} }

View File

@ -58,7 +58,7 @@ public class SchemSync implements Runnable {
private void close(Error error) throws IOException { private void close(Error error) throws IOException {
this.clientSocket.getOutputStream().write(error.ordinal()); this.clientSocket.getOutputStream().write(error.ordinal());
throw FaweCache.INSTANCE.getMANUAL(); throw FaweCache.INSTANCE.getManual();
} }
@Override @Override

View File

@ -26,11 +26,6 @@ import java.util.Locale;
*/ */
public final class ByteArrayTag extends Tag { public final class ByteArrayTag extends Tag {
@Override
public int getTypeCode() {
return NBTConstants.TYPE_BYTE_ARRAY;
}
private final byte[] value; private final byte[] value;
/** /**

View File

@ -23,10 +23,6 @@ package com.sk89q.jnbt;
* The {@code TAG_Byte} tag. * The {@code TAG_Byte} tag.
*/ */
public final class ByteTag extends NumberTag { public final class ByteTag extends NumberTag {
@Override
public int getTypeCode() {
return NBTConstants.TYPE_BYTE;
}
private final byte value; private final byte value;

View File

@ -33,11 +33,6 @@ import java.util.UUID;
*/ */
public class CompoundTag extends Tag { public class CompoundTag extends Tag {
@Override
public int getTypeCode() {
return NBTConstants.TYPE_COMPOUND;
}
private Map<String, Tag> value; private Map<String, Tag> value;
/** /**

View File

@ -24,10 +24,6 @@ package com.sk89q.jnbt;
* *
*/ */
public final class DoubleTag extends NumberTag { public final class DoubleTag extends NumberTag {
@Override
public int getTypeCode() {
return NBTConstants.TYPE_DOUBLE;
}
private final double value; private final double value;

View File

@ -24,11 +24,6 @@ package com.sk89q.jnbt;
*/ */
public final class EndTag extends Tag { public final class EndTag extends Tag {
@Override
public int getTypeCode() {
return NBTConstants.TYPE_END;
}
@Override @Override
public Object getValue() { public Object getValue() {
return null; return null;

View File

@ -23,10 +23,6 @@ package com.sk89q.jnbt;
* The {@code TAG_Float} tag. * The {@code TAG_Float} tag.
*/ */
public final class FloatTag extends NumberTag { public final class FloatTag extends NumberTag {
@Override
public int getTypeCode() {
return NBTConstants.TYPE_FLOAT;
}
private final float value; private final float value;

View File

@ -28,11 +28,6 @@ import java.util.Locale;
*/ */
public final class IntArrayTag extends Tag { public final class IntArrayTag extends Tag {
@Override
public int getTypeCode() {
return NBTConstants.TYPE_INT_ARRAY;
}
private final int[] value; private final int[] value;
/** /**

View File

@ -23,10 +23,6 @@ package com.sk89q.jnbt;
* The {@code TAG_Int} tag. * The {@code TAG_Int} tag.
*/ */
public final class IntTag extends NumberTag { public final class IntTag extends NumberTag {
@Override
public int getTypeCode() {
return NBTConstants.TYPE_INT;
}
private final int value; private final int value;

View File

@ -32,11 +32,6 @@ import javax.annotation.Nullable;
*/ */
public class ListTag extends Tag { public class ListTag extends Tag {
@Override
public int getTypeCode() {
return NBTConstants.TYPE_LIST;
}
private final Class<? extends Tag> type; private final Class<? extends Tag> type;
private final List<Tag> value; private final List<Tag> value;

View File

@ -28,11 +28,6 @@ import java.util.Locale;
*/ */
public class LongArrayTag extends Tag { public class LongArrayTag extends Tag {
@Override
public int getTypeCode() {
return NBTConstants.TYPE_LONG_ARRAY;
}
private final long[] value; private final long[] value;
/** /**

View File

@ -24,10 +24,6 @@ package com.sk89q.jnbt;
* *
*/ */
public final class LongTag extends NumberTag { public final class LongTag extends NumberTag {
@Override
public int getTypeCode() {
return NBTConstants.TYPE_LONG;
}
private final long value; private final long value;

View File

@ -311,7 +311,7 @@ public final class NBTOutputStream extends OutputStream implements Closeable, Da
int size = tags.size(); int size = tags.size();
if (!tags.isEmpty()) { if (!tags.isEmpty()) {
Tag tag0 = tags.get(0); Tag tag0 = tags.get(0);
os.writeByte(tag0.getTypeCode()); os.writeByte(NBTUtils.getTypeCode(tag0.getClass()));
} else { } else {
os.writeByte(NBTUtils.getTypeCode(clazz)); os.writeByte(NBTUtils.getTypeCode(clazz));
} }

View File

@ -23,10 +23,6 @@ package com.sk89q.jnbt;
* The {@code TAG_Short} tag. * The {@code TAG_Short} tag.
*/ */
public final class ShortTag extends NumberTag { public final class ShortTag extends NumberTag {
@Override
public int getTypeCode() {
return NBTConstants.TYPE_SHORT;
}
private final short value; private final short value;

View File

@ -26,11 +26,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
*/ */
public final class StringTag extends Tag { public final class StringTag extends Tag {
@Override
public int getTypeCode() {
return NBTConstants.TYPE_STRING;
}
private final String value; private final String value;
/** /**

View File

@ -35,6 +35,4 @@ public abstract class Tag {
return getValue(); return getValue();
} }
public abstract int getTypeCode();
} }

View File

@ -62,7 +62,7 @@ public class YAMLNode {
/** /**
* Gets a property at a location. This will either return an Object * Gets a property at a location. This will either return an Object
* or null, with null meaning no configuration value exists at * or null, with null meaning that no configuration value exists at
* that location. This could potentially return a default value (not yet * that location. This could potentially return a default value (not yet
* implemented) as defined by a plugin, if this is a plugin-tied * implemented) as defined by a plugin, if this is a plugin-tied
* configuration. * configuration.
@ -197,7 +197,7 @@ public class YAMLNode {
} }
/** /**
* Gets a string at a location. This will either return a String * Gets a string at a location. This will either return an String
* or null, with null meaning that no configuration value exists at * or null, with null meaning that no configuration value exists at
* that location. If the object at the particular location is not actually * that location. If the object at the particular location is not actually
* a string, it will be converted to its string representation. * a string, it will be converted to its string representation.
@ -214,7 +214,7 @@ public class YAMLNode {
} }
/** /**
* Gets a vector at a location. This will either return a Vector * Gets a vector at a location. This will either return an Vector
* or a null. If the object at the particular location is not * or a null. If the object at the particular location is not
* actually a string, it will be converted to its string representation. * actually a string, it will be converted to its string representation.
* *
@ -239,7 +239,7 @@ public class YAMLNode {
} }
/** /**
* Gets a 2D vector at a location. This will either return a Vector * Gets a 2D vector at a location. This will either return an Vector
* or a null. If the object at the particular location is not * or a null. If the object at the particular location is not
* actually a string, it will be converted to its string representation. * actually a string, it will be converted to its string representation.
* *
@ -263,7 +263,7 @@ public class YAMLNode {
} }
/** /**
* Gets a string at a location. This will either return a Vector * Gets a string at a location. This will either return an Vector
* or the default value. If the object at the particular location is not * or the default value. If the object at the particular location is not
* actually a string, it will be converted to its string representation. * actually a string, it will be converted to its string representation.
* *
@ -281,7 +281,7 @@ public class YAMLNode {
} }
/** /**
* Gets a string at a location. This will either return a String * Gets a string at a location. This will either return an String
* or the default value. If the object at the particular location is not * or the default value. If the object at the particular location is not
* actually a string, it will be converted to its string representation. * actually a string, it will be converted to its string representation.
* *
@ -337,10 +337,10 @@ public class YAMLNode {
} }
/** /**
* Gets a double at a location. This will either return a double * Gets a double at a location. This will either return an double
* or null. If the object at the particular location is not * or null. If the object at the particular location is not
* actually a double, the default value will be returned. However, other * actually a double, the default value will be returned. However, other
* number types will be casted to a double. * number types will be casted to an double.
* *
* @param path path to node (dot notation) * @param path path to node (dot notation)
* @return double or null * @return double or null
@ -355,10 +355,10 @@ public class YAMLNode {
} }
/** /**
* Gets a double at a location. This will either return a double * Gets a double at a location. This will either return an double
* or the default value. If the object at the particular location is not * or the default value. If the object at the particular location is not
* actually a double, the default value will be returned. However, other * actually a double, the default value will be returned. However, other
* number types will be casted to a double. * number types will be casted to an double.
* *
* @param path path to node (dot notation) * @param path path to node (dot notation)
* @param def default value * @param def default value
@ -375,7 +375,7 @@ public class YAMLNode {
} }
/** /**
* Gets a boolean at a location. This will either return a boolean * Gets a boolean at a location. This will either return an boolean
* or null. If the object at the particular location is not * or null. If the object at the particular location is not
* actually a boolean, the default value will be returned. * actually a boolean, the default value will be returned.
* *
@ -392,7 +392,7 @@ public class YAMLNode {
} }
/** /**
* Gets a boolean at a location. This will either return a boolean * Gets a boolean at a location. This will either return an boolean
* or the default value. If the object at the particular location is not * or the default value. If the object at the particular location is not
* actually a boolean, the default value will be returned. * actually a boolean, the default value will be returned.
* *

View File

@ -2802,7 +2802,7 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
BlockVector3 max = region.getMaximumPoint(); BlockVector3 max = region.getMaximumPoint();
BlockVector3 min = region.getMinimumPoint(); BlockVector3 min = region.getMinimumPoint();
if (!fe.contains(max.getBlockX(), max.getBlockY(), max.getBlockZ()) && !fe.contains(min.getBlockX(), min.getBlockY(), min.getBlockZ())) { if (!fe.contains(max.getBlockX(), max.getBlockY(), max.getBlockZ()) && !fe.contains(min.getBlockX(), min.getBlockY(), min.getBlockZ())) {
throw FaweCache.INSTANCE.getOUTSIDE_REGION(); throw FaweCache.INSTANCE.getOutsideRegion();
} }
} }
final Set<BlockVector2> chunks = region.getChunks(); final Set<BlockVector2> chunks = region.getChunks();

View File

@ -128,7 +128,7 @@ public class ClipboardCommands {
((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1); ((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1);
FaweLimit limit = actor.getLimit(); FaweLimit limit = actor.getLimit();
if (volume >= limit.MAX_CHECKS) { if (volume >= limit.MAX_CHECKS) {
throw FaweCache.INSTANCE.getMAX_CHECKS(); throw FaweCache.INSTANCE.getMaxChecks();
} }
session.setClipboard(null); session.setClipboard(null);
@ -246,10 +246,10 @@ public class ClipboardCommands {
long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1)); long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1));
FaweLimit limit = actor.getLimit(); FaweLimit limit = actor.getLimit();
if (volume >= limit.MAX_CHECKS) { if (volume >= limit.MAX_CHECKS) {
throw FaweCache.INSTANCE.getMAX_CHECKS(); throw FaweCache.INSTANCE.getMaxChecks();
} }
if (volume >= limit.MAX_CHANGES) { if (volume >= limit.MAX_CHANGES) {
throw FaweCache.INSTANCE.getMAX_CHANGES(); throw FaweCache.INSTANCE.getMaxChanges();
} }
session.setClipboard(null); session.setClipboard(null);

View File

@ -422,7 +422,7 @@ public class RegionCommands {
long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1)); long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1));
FaweLimit limit = actor.getLimit(); FaweLimit limit = actor.getLimit();
if (volume >= limit.MAX_CHECKS) { if (volume >= limit.MAX_CHECKS) {
throw FaweCache.INSTANCE.getMAX_CHECKS(); throw FaweCache.INSTANCE.getMaxChecks();
} }
int affected = 0; int affected = 0;
try { try {

View File

@ -30,7 +30,7 @@ public class TransformCommands {
aliases = {"#l"}, aliases = {"#l"},
desc = "Sequentially pick from a list of transform" desc = "Sequentially pick from a list of transform"
) )
public ResettableExtent linear(Actor actor, LocalSession session, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) { public ResettableExtent linear(Actor actor, LocalSession session, @Arg(desc = "ResettableExtent", def = "#null") ResettableExtent other) {
if (other instanceof RandomTransform) { if (other instanceof RandomTransform) {
Set<ResettableExtent> extents = ((RandomTransform) other).getExtents(); Set<ResettableExtent> extents = ((RandomTransform) other).getExtents();
return new LinearTransform(extents.toArray(new ResettableExtent[0])); return new LinearTransform(extents.toArray(new ResettableExtent[0]));
@ -43,7 +43,7 @@ public class TransformCommands {
aliases = {"#l3d"}, aliases = {"#l3d"},
desc = "Use the x,y,z coordinate to pick a transform from the list" desc = "Use the x,y,z coordinate to pick a transform from the list"
) )
public ResettableExtent linear3d(Actor actor, LocalSession session, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) { public ResettableExtent linear3d(Actor actor, LocalSession session, @Arg(desc = "ResettableExtent", def = "#null") ResettableExtent other) {
if (other instanceof RandomTransform) { if (other instanceof RandomTransform) {
Set<ResettableExtent> extents = ((RandomTransform) other).getExtents(); Set<ResettableExtent> extents = ((RandomTransform) other).getExtents();
return new Linear3DTransform(extents.toArray(new ResettableExtent[0])); return new Linear3DTransform(extents.toArray(new ResettableExtent[0]));
@ -55,7 +55,7 @@ public class TransformCommands {
name = "#pattern", name = "#pattern",
desc = "Always use a specific pattern" desc = "Always use a specific pattern"
) )
public ResettableExtent pattern(Actor actor, LocalSession session, @Arg(desc = "Pattern") Pattern pattern, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) { public ResettableExtent pattern(Actor actor, LocalSession session, @Arg(desc = "Pattern") Pattern pattern, @Arg(desc = "ResettableExtent", def = "#null") ResettableExtent other) {
return new PatternTransform(other, pattern); return new PatternTransform(other, pattern);
} }
@ -63,7 +63,7 @@ public class TransformCommands {
name = "#offset", name = "#offset",
desc = "Offset transform" desc = "Offset transform"
) )
public ResettableExtent offset(Actor actor, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) { public ResettableExtent offset(Actor actor, LocalSession session, double x, double y, double z, @Arg(desc = "ResettableExtent", def = "#null") ResettableExtent other) {
return new OffsetExtent(other, (int) x, (int) y, (int) z); return new OffsetExtent(other, (int) x, (int) y, (int) z);
} }
@ -72,7 +72,7 @@ public class TransformCommands {
aliases = {"#randomoffset"}, aliases = {"#randomoffset"},
desc = "Random offset transform" desc = "Random offset transform"
) )
public ResettableExtent randomOffset(Actor actor, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) { public ResettableExtent randomOffset(Actor actor, LocalSession session, double x, double y, double z, @Arg(desc = "ResettableExtent", def = "#null") ResettableExtent other) {
return new RandomOffsetTransform(other, (int) x, (int) y, (int) z); return new RandomOffsetTransform(other, (int) x, (int) y, (int) z);
} }
@ -80,7 +80,7 @@ public class TransformCommands {
name = "#scale", name = "#scale",
desc = "All changes will be scaled" desc = "All changes will be scaled"
) )
public ResettableExtent scale(Actor actor, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) { public ResettableExtent scale(Actor actor, LocalSession session, double x, double y, double z, @Arg(desc = "ResettableExtent", def = "#null") ResettableExtent other) {
return new ScaleTransform(other, x, y, z); return new ScaleTransform(other, x, y, z);
} }
@ -88,7 +88,7 @@ public class TransformCommands {
name = "#rotate", name = "#rotate",
desc = "All changes will be rotate around the initial position" desc = "All changes will be rotate around the initial position"
) )
public ResettableExtent rotate(Player player, LocalSession session, double x, double y, double z, @Arg(name = "other", desc = "ResettableExtent", def = "#null") ResettableExtent other) { public ResettableExtent rotate(Player player, LocalSession session, double x, double y, double z, @Arg(desc = "ResettableExtent", def = "#null") ResettableExtent other) {
ExtentTraverser<TransformExtent> traverser = new ExtentTraverser<>(other).find(TransformExtent.class); ExtentTraverser<TransformExtent> traverser = new ExtentTraverser<>(other).find(TransformExtent.class);
BlockTransformExtent affine = traverser != null ? traverser.get() : null; BlockTransformExtent affine = traverser != null ? traverser.get() : null;
if (affine == null) { if (affine == null) {

View File

@ -46,6 +46,7 @@ import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.format.TextStyle; import java.time.format.TextStyle;
import java.time.zone.ZoneRulesException; import java.time.zone.ZoneRulesException;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import java.util.List; import java.util.List;
@ -79,7 +80,9 @@ public class WorldEditCommands {
if (fVer != null) { if (fVer != null) {
FaweVersion version = Fawe.get().getVersion(); FaweVersion version = Fawe.get().getVersion();
Date date = new GregorianCalendar(2000 + version.year, version.month - 1, version.day) //noinspection MagicConstant
Date date = new GregorianCalendar(2000 + version.year,
version.month - 1, version.day)
.getTime(); .getTime();
TextComponent dateArg = TextComponent.of(date.toLocaleString()); TextComponent dateArg = TextComponent.of(date.toLocaleString());

View File

@ -19,8 +19,6 @@
package com.sk89q.worldedit.command.factory; package com.sk89q.worldedit.command.factory;
import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull;
import com.sk89q.worldedit.extent.NullExtent; import com.sk89q.worldedit.extent.NullExtent;
import com.sk89q.worldedit.function.Contextual; import com.sk89q.worldedit.function.Contextual;
import com.sk89q.worldedit.function.EditContext; import com.sk89q.worldedit.function.EditContext;
@ -28,6 +26,8 @@ import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.function.block.BlockReplace; import com.sk89q.worldedit.function.block.BlockReplace;
import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.Pattern;
import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull;
public class ReplaceFactory implements Contextual<RegionFunction> { public class ReplaceFactory implements Contextual<RegionFunction> {
private final Pattern fill; private final Pattern fill;

View File

@ -41,4 +41,4 @@ public final class TreeGeneratorFactory implements Contextual<ForestGenerator> {
public String toString() { public String toString() {
return "tree of type " + type; return "tree of type " + type;
} }
} }

View File

@ -114,7 +114,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
/** /**
* Construct the tool. * Construct the tool.
* *
* @param permission the permission to check before use is allowed * @param permission the permission to check before use is allowed
*/ */
public BrushTool(String permission) { public BrushTool(String permission) {
@ -275,7 +275,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
/** /**
* Get the filter. * Get the filter.
* *
* @return the filter * @return the filter
*/ */
public Mask getMask() { public Mask getMask() {
@ -303,7 +303,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
/** /**
* Set the block filter used for identifying blocks to replace. * Set the block filter used for identifying blocks to replace.
* *
* @param filter the filter to set * @param filter the filter to set
*/ */
public void setMask(Mask filter) { public void setMask(Mask filter) {
@ -342,7 +342,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
/** /**
* Set the brush. * Set the brush.
* *
* @param brush tbe brush * @param brush tbe brush
* @param permission the permission * @param permission the permission
*/ */
@ -356,7 +356,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
/** /**
* Get the current brush. * Get the current brush.
* *
* @return the current brush * @return the current brush
*/ */
public Brush getBrush() { public Brush getBrush() {
@ -365,7 +365,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
/** /**
* Set the material. * Set the material.
* *
* @param material the material * @param material the material
*/ */
public void setFill(@Nullable Pattern material) { public void setFill(@Nullable Pattern material) {
@ -383,7 +383,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
/** /**
* Get the set brush size. * Get the set brush size.
* *
* @return a radius * @return a radius
*/ */
public double getSize() { public double getSize() {
@ -392,7 +392,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
/** /**
* Set the set brush size. * Set the set brush size.
* *
* @param radius a radius * @param radius a radius
*/ */
public void setSize(double radius) { public void setSize(double radius) {
@ -410,7 +410,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
/** /**
* Get the set brush range. * Get the set brush range.
* *
* @return the range of the brush in blocks * @return the range of the brush in blocks
*/ */
public int getRange() { public int getRange() {

View File

@ -19,7 +19,6 @@
package com.sk89q.worldedit.command.tool; package com.sk89q.worldedit.command.tool;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.entity.Player;
@ -29,6 +28,7 @@ import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.RegionSelector;
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
/** /**
* A wand that can be used at a distance. * A wand that can be used at a distance.

View File

@ -19,7 +19,6 @@
package com.sk89q.worldedit.command.tool; package com.sk89q.worldedit.command.tool;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.object.collection.LocalBlockVectorSet; import com.boydti.fawe.object.collection.LocalBlockVectorSet;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
@ -32,6 +31,7 @@ import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockCategories; import com.sk89q.worldedit.world.block.BlockCategories;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;

View File

@ -24,13 +24,13 @@ import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.util.LocatedBlock; import com.sk89q.worldedit.util.LocatedBlock;
import com.sk89q.worldedit.util.collection.LocatedBlockList;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockTypes;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.Set; import java.util.Set;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.util.collection.LocatedBlockList;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockTypes;
public class GravityBrush implements Brush { public class GravityBrush implements Brush {

Some files were not shown because too many files have changed in this diff Show More