diff --git a/src/main/java/com/sk89q/worldedit/blocks/BaseBlock.java b/src/main/java/com/sk89q/worldedit/blocks/BaseBlock.java index e909296d2..cc8bcf05c 100644 --- a/src/main/java/com/sk89q/worldedit/blocks/BaseBlock.java +++ b/src/main/java/com/sk89q/worldedit/blocks/BaseBlock.java @@ -53,6 +53,7 @@ import java.util.Collection; * as a "wildcard" block value, even though a {@link Mask} would be * more appropriate.
*/ +@SuppressWarnings("deprecation") public class BaseBlock extends Block implements TileEntityBlock { /** @@ -251,9 +252,8 @@ public class BaseBlock extends Block implements TileEntityBlock { return nbtData; } - @Nullable @Override - public void setNbtData(CompoundTag nbtData) { + public void setNbtData(@Nullable CompoundTag nbtData) { this.nbtData = nbtData; } @@ -359,11 +359,9 @@ public class BaseBlock extends Block implements TileEntityBlock { } final BaseBlock otherBlock = (BaseBlock) o; - if (getType() != otherBlock.getType()) { - return false; - } - return getData() == otherBlock.getData(); + return getType() == otherBlock.getType() && getData() == otherBlock.getData(); + } /** diff --git a/src/main/java/com/sk89q/worldedit/blocks/BlockID.java b/src/main/java/com/sk89q/worldedit/blocks/BlockID.java index 44765e329..b73dd1f6b 100644 --- a/src/main/java/com/sk89q/worldedit/blocks/BlockID.java +++ b/src/main/java/com/sk89q/worldedit/blocks/BlockID.java @@ -21,8 +21,6 @@ package com.sk89q.worldedit.blocks; /** * List of block IDs. - * - * @author sk89q */ public final class BlockID { public static final int AIR = 0; diff --git a/src/main/java/com/sk89q/worldedit/blocks/BlockMaterial.java b/src/main/java/com/sk89q/worldedit/blocks/BlockMaterial.java index 09c9f8716..bf9e3abb0 100644 --- a/src/main/java/com/sk89q/worldedit/blocks/BlockMaterial.java +++ b/src/main/java/com/sk89q/worldedit/blocks/BlockMaterial.java @@ -24,48 +24,160 @@ package com.sk89q.worldedit.blocks; */ public interface BlockMaterial { + /** + * Get whether this block is rendered like a normal block. + * + * @return the value of the test + */ boolean isRenderedAsNormalBlock(); + /** + * Get whether this block is a full sized cube. + * + * @return the value of the test + */ boolean isFullCube(); + /** + * Get whether this block is opaque. + * + * @return the value of the test + */ boolean isOpaque(); + /** + * Get whether this block emits a Redstone signal. + * + * @return the value of the test + */ boolean isPowerSource(); + /** + * Get whether this block is a liquid. + * + * @return the value of the test + */ boolean isLiquid(); + /** + * Get whether this block is a solid. + * + * @return the value of the test + */ boolean isSolid(); + /** + * Get the hardness factor for this block. + * + * @return the hardness factor + */ float getHardness(); + /** + * Get the resistance factor for this block. + * + * @return the resistance factor + */ float getResistance(); + /** + * Get the slipperiness factor for this block. + * + * @return the slipperiness factor + */ float getSlipperiness(); + /** + * Get whether this block blocks grass from growing. + * + * @return whether this block blocks grass + */ boolean isGrassBlocking(); + /** + * Get the ambient occlusion light value. + * + * @return the ambient occlusion light value + */ float getAmbientOcclusionLightValue(); + /** + * Get the opacity of this block for light to pass through. + * + * @return the opacity + */ int getLightOpacity(); + /** + * Get the light value for this block. + * + * @return the light value + */ int getLightValue(); + /** + * Get whether this block breaks when it is pushed by a piston. + * + * @return true if the block breaks + */ boolean isFragileWhenPushed(); + /** + * Get whether this block can be pushed by a piston. + * + * @return true if the block cannot be pushed + */ boolean isUnpushable(); + /** + * Get whether this block can be used in adventure mode. + * + * @return true if the block can be used in adventure mode + */ boolean isAdventureModeExempt(); + /** + * Get whether this block is ticked randomly. + * + * @return true if this block is ticked randomly + */ boolean isTicksRandomly(); + /** + * Gets whether this block uses a neighbor's light value. + * + * @return true if this block does + */ boolean isUsingNeighborLight(); + /** + * Get whether this block prevents movement. + * + * @return true if this block blocks movement + */ boolean isMovementBlocker(); + /** + * Get whether this block will burn. + * + * @return true if this block will burn + */ boolean isBurnable(); + /** + * Get whether this block needs to be broken by a tool for maximum + * speed. + * + * @return true if a tool is required + */ boolean isToolRequired(); + /** + * Get whether this block is replaced when a block is placed over it + * (for example, tall grass). + * + * @return true if the block is replaced + */ boolean isReplacedDuringPlacement(); } diff --git a/src/main/java/com/sk89q/worldedit/entity/BaseEntity.java b/src/main/java/com/sk89q/worldedit/entity/BaseEntity.java index 4f6c40731..4b8237400 100644 --- a/src/main/java/com/sk89q/worldedit/entity/BaseEntity.java +++ b/src/main/java/com/sk89q/worldedit/entity/BaseEntity.java @@ -22,10 +22,22 @@ package com.sk89q.worldedit.entity; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.world.NbtValued; +import javax.annotation.Nullable; + import static com.google.common.base.Preconditions.checkNotNull; /** - * A snapshot of an entity that can be reused and passed around. + * Represents a mutable "snapshot" of an entity. + * + *An instance of this class contains all the information needed to + * accurately reproduce the entity, provided that the instance was + * made correctly. In some implementations, it may not be possible to get a + * snapshot of entities correctly, so, for example, the NBT data for an entity + * may be missing.
+ * + *This class identifies entities using its entity type string, although + * this is not very efficient as the types are currently not interned. This + * may be changed in the future.
*/ public class BaseEntity implements NbtValued { @@ -68,14 +80,14 @@ public class BaseEntity implements NbtValued { return true; } + @Nullable @Override public CompoundTag getNbtData() { return nbtData; } @Override - public void setNbtData(CompoundTag nbtData) { - checkNotNull(nbtData); + public void setNbtData(@Nullable CompoundTag nbtData) { this.nbtData = nbtData; } diff --git a/src/main/java/com/sk89q/worldedit/entity/Entity.java b/src/main/java/com/sk89q/worldedit/entity/Entity.java index 4224e5de7..ef806ce7c 100644 --- a/src/main/java/com/sk89q/worldedit/entity/Entity.java +++ b/src/main/java/com/sk89q/worldedit/entity/Entity.java @@ -28,19 +28,21 @@ import javax.annotation.Nullable; /** * A reference to an instance of an entity that exists in an {@link Extent} * and thus would have position and similar details. - * - * This object cannot be directly cloned because it represents a particular + * + *This object cannot be directly cloned because it represents a particular * instance of an entity, but a {@link BaseEntity} can be created from - * this entity (or at least, it will be possible in the future), which - * can then be used to spawn new instances of that particular entity - * description. + * this entity by calling {@link #getState()}.
*/ public interface Entity extends Faceted { /** * Get a copy of the entity's state. * - * @return the entity's state or null if one cannot be gotten + *In some cases, this method may return {@code null} if a snapshot + * of the entity can't be created. It may not be possible, for example, + * to get a snapshot of a player.
+ * + * @return the entity's state or null if one cannot be created */ @Nullable BaseEntity getState(); diff --git a/src/main/java/com/sk89q/worldedit/entity/Player.java b/src/main/java/com/sk89q/worldedit/entity/Player.java index c5e2e333e..ebb2e24f8 100644 --- a/src/main/java/com/sk89q/worldedit/entity/Player.java +++ b/src/main/java/com/sk89q/worldedit/entity/Player.java @@ -30,7 +30,7 @@ import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.world.World; /** - * A player. + * Represents a player */ public interface Player extends Entity, Actor { @@ -192,12 +192,19 @@ public interface Player extends Entity, Actor { * Get the point of the block being looked at. May return null. * Will return the farthest away air block if useLastBlock is true and no other block is found. * - * @param range How far to checks for blocks - * @param useLastBlock Try to return the last valid air block found. + * @param range how far to checks for blocks + * @param useLastBlock try to return the last valid air block found * @return point */ WorldVector getBlockTrace(int range, boolean useLastBlock); + /** + * Get the face that the player is looking at. + * + * @param range the range + * @param useLastBlock try to return the last valid air block found + * @return a face + */ WorldVectorFace getBlockTraceFace(int range, boolean useLastBlock); /** @@ -225,25 +232,31 @@ public interface Player extends Entity, Actor { /** * Get the actor's position. - * - * If the actor has no permission, then return a dummy location. + * + *If the actor has no permission, then a dummy location is returned.
* * @return the actor's position + * @deprecated use {@link #getLocation()} */ + @Deprecated WorldVector getPosition(); /** - * Get the player's view pitch. + * Get the player's view pitch in degrees. * * @return pitch + * @deprecated use {@link #getLocation()} */ + @Deprecated double getPitch(); /** - * Get the player's view yaw. + * Get the player's view yaw in degrees. * * @return yaw + * @deprecated use {@link #getLocation()} */ + @Deprecated double getYaw(); /** @@ -257,16 +270,16 @@ public interface Player extends Entity, Actor { /** * Move the player. * - * @param pos Where to move them - * @param pitch The pitch (up/down) of the player's view - * @param yaw The yaw (left/right) of the player's view + * @param pos where to move them + * @param pitch the pitch (up/down) of the player's view in degrees + * @param yaw the yaw (left/right) of the player's view in degrees */ void setPosition(Vector pos, float pitch, float yaw); /** * Move the player. * - * @param pos Where to move them + * @param pos where to move them */ void setPosition(Vector pos); diff --git a/src/main/java/com/sk89q/worldedit/event/extent/EditSessionEvent.java b/src/main/java/com/sk89q/worldedit/event/extent/EditSessionEvent.java index 38124defe..f90642d07 100644 --- a/src/main/java/com/sk89q/worldedit/event/extent/EditSessionEvent.java +++ b/src/main/java/com/sk89q/worldedit/event/extent/EditSessionEvent.java @@ -34,17 +34,19 @@ import static com.sk89q.worldedit.EditSession.Stage; /** * Raised (several times) when a new {@link EditSession} is being instantiated. - * - * Block loggers, as well as block set interceptors, can use this event to wrap + * + * Block loggers, as well as block set interceptors, can use this event to wrap * the given {@link Extent} with their own, which would allow them to intercept * all changes made to the world. For example, the code below would wrap the * existing extent with a custom one, and the custom extent would receive * all method calls before the extent fetched from - * {@link #getExtent()} would. + * {@link #getExtent()} would. + * ** event.setExtent(new MyExtent(event.getExtent()) *- * This event is fired several times during the creation of a single + * + * This event is fired several times during the creation of a single * {@link EditSession}, but {@link #getStage()} will differ each time. * The stage determines at which point {@link Extent}s added to this event * will be called. For example, if you inject an extent when the stage @@ -55,7 +57,7 @@ import static com.sk89q.worldedit.EditSession.Stage; * custom {@link Extent} because that method bypasses history (and reorder). * It is thus recommended that loggers intercept at {@link Stage#BEFORE_CHANGE} * and block interceptors intercept at BOTH {@link Stage#BEFORE_CHANGE} and - * {@link Stage#BEFORE_HISTORY}. + * {@link Stage#BEFORE_HISTORY}. */ public class EditSessionEvent extends Event { diff --git a/src/main/java/com/sk89q/worldedit/extension/factory/BlockFactory.java b/src/main/java/com/sk89q/worldedit/extension/factory/BlockFactory.java index 2cb5c9d1d..43037ccf5 100644 --- a/src/main/java/com/sk89q/worldedit/extension/factory/BlockFactory.java +++ b/src/main/java/com/sk89q/worldedit/extension/factory/BlockFactory.java @@ -31,9 +31,9 @@ import java.util.Set; /** * A registry of known {@link BaseBlock}s. Provides methods to instantiate * new blocks from input. - * - * Instances of this class can be taken from - * {@link WorldEdit#getBlockFactory()}. + * + *
Instances of this class can be taken from + * {@link WorldEdit#getBlockFactory()}.
*/ public class BlockFactory extends AbstractFactoryInstances of this class can be taken from + * {@link WorldEdit#getMaskFactory()}.
*/ public final class MaskFactory extends AbstractFactoryInstances of this class can be taken from + * {@link WorldEdit#getPatternFactory()}.
*/ public final class PatternFactory extends AbstractFactoryBy default, {@link #isRestricted()} will return true.
*/ public class ParserContext { diff --git a/src/main/java/com/sk89q/worldedit/extension/platform/CommandManager.java b/src/main/java/com/sk89q/worldedit/extension/platform/CommandManager.java index 85cb40134..8fb39631c 100644 --- a/src/main/java/com/sk89q/worldedit/extension/platform/CommandManager.java +++ b/src/main/java/com/sk89q/worldedit/extension/platform/CommandManager.java @@ -59,8 +59,8 @@ import static com.google.common.base.Preconditions.checkNotNull; /** * Handles the registration and invocation of commands. - * - * This class is primarily for internal usage. + * + *This class is primarily for internal usage.
*/ public final class CommandManager { @@ -206,7 +206,7 @@ public final class CommandManager { Request.reset(); Actor actor = platformManager.createProxyActor(event.getActor()); - String split[] = commandDetection(event.getArguments().split(" ")); + String[] split = commandDetection(event.getArguments().split(" ")); // No command found! if (!dispatcher.contains(split[0])) { diff --git a/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java b/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java index 0c450689e..e8eb0b227 100644 --- a/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java +++ b/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java @@ -44,8 +44,8 @@ import static com.google.common.base.Preconditions.checkNotNull; /** * Manages registered {@link Platform}s for WorldEdit. Platforms are * implementations of WorldEdit. - * - * This class is thread-safe. + * + *This class is thread-safe.
*/ public class PlatformManager { @@ -99,9 +99,9 @@ public class PlatformManager { /** * Unregister a platform from WorldEdit. - * - * If the platform has been chosen for any capabilities, then a new - * platform will be found. + * + *If the platform has been chosen for any capabilities, then a new + * platform will be found.
* * @param platform the platform */ @@ -189,8 +189,8 @@ public class PlatformManager { /** * Get a list of loaded platforms. - * - * The returned list is a copy of the original and is mutable. + * + *The returned list is a copy of the original and is mutable.
* * @return a list of platforms */ @@ -252,9 +252,9 @@ public class PlatformManager { /** * Get the current configuration. - * - * If no platform has been registered yet, then a default configuration - * will be returned. + * + *If no platform has been registered yet, then a default configuration + * will be returned.
* * @return the configuration */ @@ -365,7 +365,6 @@ public class PlatformManager { // Create a proxy actor with a potentially different world for // making changes to the world Player player = createProxyActor(event.getPlayer()); - World world = player.getWorld(); switch (event.getInputType()) { case PRIMARY: { diff --git a/src/main/java/com/sk89q/worldedit/extent/Extent.java b/src/main/java/com/sk89q/worldedit/extent/Extent.java index 51ae4fc84..436c59ea8 100644 --- a/src/main/java/com/sk89q/worldedit/extent/Extent.java +++ b/src/main/java/com/sk89q/worldedit/extent/Extent.java @@ -39,9 +39,9 @@ public interface Extent extends InputExtent, OutputExtent { /** * Get the minimum point in the extent. - * - * If the extent is unbounded, then a large (negative) value may - * be returned. + * + *If the extent is unbounded, then a large (negative) value may + * be returned.
* * @return the minimum point */ @@ -49,9 +49,9 @@ public interface Extent extends InputExtent, OutputExtent { /** * Get the maximum point in the extent. - * - * If the extent is unbounded, then a large (positive) value may - * be returned. + * + *If the extent is unbounded, then a large (positive) value may + * be returned.
* * @return the maximum point */ @@ -59,10 +59,10 @@ public interface Extent extends InputExtent, OutputExtent { /** * Get a list of all entities within the given region. - * - * If the extent is not wholly loaded (i.e. a world being simulated in the + * + *If the extent is not wholly loaded (i.e. a world being simulated in the * game will not have every chunk loaded), then this list may not be - * incomplete. + * incomplete.
* * @return a list of entities */ @@ -70,10 +70,10 @@ public interface Extent extends InputExtent, OutputExtent { /** * Get a list of all entities. - * - * If the extent is not wholly loaded (i.e. a world being simulated in the + * + *If the extent is not wholly loaded (i.e. a world being simulated in the * game will not have every chunk loaded), then this list may not be - * incomplete. + * incomplete.
* * @return a list of entities */ diff --git a/src/main/java/com/sk89q/worldedit/extent/InputExtent.java b/src/main/java/com/sk89q/worldedit/extent/InputExtent.java index 81fcce5c9..f8e3a7a8f 100644 --- a/src/main/java/com/sk89q/worldedit/extent/InputExtent.java +++ b/src/main/java/com/sk89q/worldedit/extent/InputExtent.java @@ -32,20 +32,20 @@ public interface InputExtent { /** * Get a snapshot of the block at the given location. - * - * If the given position is out of the bounds of the extent, then the behavior - * is undefined (an air block could be returned). However,null
- * should not be returned.
- *
- * The returned block is mutable and is a snapshot of the block at the time
+ *
+ * If the given position is out of the bounds of the extent, then the behavior + * is undefined (an air block could be returned). However, {@code null} + * should not be returned.
+ * + *The returned block is mutable and is a snapshot of the block at the time * of call. It has no position attached to it, so it could be reused in - * {@link Pattern}s and so on. - *
- * Calls to this method can actually be quite expensive, so cache results + * {@link Pattern}s and so on. + * + *Calls to this method can actually be quite expensive, so cache results * whenever it is possible, while being aware of the mutability aspect. * The cost, however, depends on the implementation and particular extent. * If only basic information about the block is required, then use of - * {@link #getLazyBlock(Vector)} is recommended. + * {@link #getLazyBlock(Vector)} is recommended.
* * @param position position of the block * @return the block @@ -55,20 +55,20 @@ public interface InputExtent { /** * Get a lazy, immutable snapshot of the block at the given location that only * immediately contains information about the block's type (and metadata). - * - * Further information (such as NBT data) will be available by the + * + *Further information (such as NBT data) will be available by the * time of access. Therefore, it is not recommended that * this method is used if the world is being simulated at the time of * call. If the block needs to be stored for future use, then this method should * definitely not be used. Moreover, the block that is returned is immutable (or * should be), and therefore modifications should not be attempted on it. If a - * modifiable copy is required, then the block should be cloned. - *
- * This method exists because it is sometimes important to inspect the block + * modifiable copy is required, then the block should be cloned. + * + *This method exists because it is sometimes important to inspect the block * at a given location, but {@link #getBlock(Vector)} may be too expensive in * the underlying implementation. It is also not possible to implement * caching if the returned object is mutable, so this methods allows caching - * implementations to be used. + * implementations to be used.
* * @param position position of the block * @return the block diff --git a/src/main/java/com/sk89q/worldedit/extent/OutputExtent.java b/src/main/java/com/sk89q/worldedit/extent/OutputExtent.java index e0268495d..e7218e719 100644 --- a/src/main/java/com/sk89q/worldedit/extent/OutputExtent.java +++ b/src/main/java/com/sk89q/worldedit/extent/OutputExtent.java @@ -37,13 +37,13 @@ public interface OutputExtent { * Change the block at the given location to the given block. The operation may * not tie the given {@link BaseBlock} to the world, so future changes to the * {@link BaseBlock} do not affect the world until this method is called again. - * - * The return value of this method indicates whether the change was probably + * + *The return value of this method indicates whether the change was probably * successful. It may not be successful if, for example, the location is out * of the bounds of the extent. It may be unsuccessful if the block passed * is the same as the one in the world. However, the return value is only an * estimation and it may be incorrect, but it could be used to count, for - * example, the approximate number of changes. + * example, the approximate number of changes.
* * @param position position of the block * @param block block to set diff --git a/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java b/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java index 7070da6e6..297df8b1a 100644 --- a/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java +++ b/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java @@ -42,9 +42,9 @@ import static com.google.common.base.Preconditions.checkNotNull; /** * Buffers changes to an {@link Extent} and allows later retrieval for * actual application of the changes. - * - * This buffer will not attempt to return results from the buffer when - * accessor methods (such as {@link #getBlock(Vector)}) are called. + * + *This buffer will not attempt to return results from the buffer when + * accessor methods (such as {@link #getBlock(Vector)}) are called.
*/ public class ForgetfulExtentBuffer extends AbstractDelegateExtent implements Pattern { diff --git a/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java b/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java index 1b819e036..15c9b7345 100644 --- a/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java +++ b/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java @@ -51,8 +51,8 @@ public class BlockArrayClipboard implements Clipboard { /** * Create a new instance. - *- * The origin will be placed at the region's lowest minimum point. + * + *
The origin will be placed at the region's lowest minimum point.
* * @param region the bounding region */ diff --git a/src/main/java/com/sk89q/worldedit/extent/clipboard/StoredEntity.java b/src/main/java/com/sk89q/worldedit/extent/clipboard/StoredEntity.java index a38d2d412..4311ada18 100644 --- a/src/main/java/com/sk89q/worldedit/extent/clipboard/StoredEntity.java +++ b/src/main/java/com/sk89q/worldedit/extent/clipboard/StoredEntity.java @@ -28,8 +28,8 @@ import static com.google.common.base.Preconditions.checkNotNull; /** * An implementation of {@link Entity} that stores a {@link BaseEntity} with it. - * - * Calls to {@link #getState()} return a clone. + * + *Calls to {@link #getState()} return a clone.
*/ abstract class StoredEntity implements Entity { diff --git a/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBag.java b/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBag.java index bc8ad8d86..969ecbd84 100644 --- a/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBag.java +++ b/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBag.java @@ -24,15 +24,14 @@ import com.sk89q.worldedit.blocks.*; /** * Represents a source to get blocks from and store removed ones. - * - * @author sk89q */ public abstract class BlockBag { + /** * Stores a block as if it was mined. * - * @param id - * @throws BlockBagException + * @param id the type ID + * @throws BlockBagException on error * @deprecated Use {@link BlockBag#storeDroppedBlock(int, int)} instead */ @Deprecated @@ -43,9 +42,9 @@ public abstract class BlockBag { /** * Stores a block as if it was mined. * - * @param id - * @param data - * @throws BlockBagException + * @param id the type ID + * @param data the data value + * @throws BlockBagException on error */ public void storeDroppedBlock(int id, int data) throws BlockBagException { BaseItem dropped = BlockType.getBlockBagItem(id, data); @@ -58,8 +57,8 @@ public abstract class BlockBag { /** * Sets a block as if it was placed by hand. * - * @param id - * @throws BlockBagException + * @param id the type ID + * @throws BlockBagException on error * @deprecated Use {@link #fetchPlacedBlock(int,int)} instead */ @Deprecated @@ -70,9 +69,9 @@ public abstract class BlockBag { /** * Sets a block as if it was placed by hand. * - * @param id - * @param data TODO - * @throws BlockBagException + * @param id the type ID + * @param data the data value + * @throws BlockBagException on error */ public void fetchPlacedBlock(int id, int data) throws BlockBagException { try { @@ -117,10 +116,10 @@ public abstract class BlockBag { /** * Get a block. * - * Either this method or fetchItem needs to be overridden + *Either this method or fetchItem needs to be overridden.
* - * @param id - * @throws BlockBagException + * @param id the type ID + * @throws BlockBagException on error */ public void fetchBlock(int id) throws BlockBagException { fetchItem(new BaseItem(id)); @@ -129,10 +128,10 @@ public abstract class BlockBag { /** * Get a block. * - * Either this method or fetchBlock needs to be overridden + *Either this method or fetchItem needs to be overridden.
* - * @param item - * @throws BlockBagException + * @param item the item + * @throws BlockBagException on error */ public void fetchItem(BaseItem item) throws BlockBagException { fetchBlock(item.getType()); @@ -140,11 +139,11 @@ public abstract class BlockBag { /** * Store a block. + * + *Either this method or fetchItem needs to be overridden.
* - * Either this method or storeItem needs to be overridden - * - * @param id - * @throws BlockBagException + * @param id the type ID + * @throws BlockBagException on error */ public void storeBlock(int id) throws BlockBagException { storeItem(new BaseItem(id)); @@ -152,11 +151,11 @@ public abstract class BlockBag { /** * Store a block. + * + *Either this method or fetchItem needs to be overridden.
* - * Either this method or storeBlock needs to be overridden - * - * @param item - * @throws BlockBagException + * @param item the item + * @throws BlockBagException on error */ public void storeItem(BaseItem item) throws BlockBagException { storeBlock(item.getType()); @@ -165,7 +164,7 @@ public abstract class BlockBag { /** * Checks to see if a block exists without removing it. * - * @param id + * @param id the type ID * @return whether the block exists */ public boolean peekBlock(int id) { @@ -186,14 +185,14 @@ public abstract class BlockBag { /** * Adds a position to be used a source. * - * @param pos + * @param pos the position */ public abstract void addSourcePosition(WorldVector pos); /** * Adds a position to be used a source. * - * @param pos + * @param pos the position */ public abstract void addSingleSourcePosition(WorldVector pos); } diff --git a/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagException.java b/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagException.java index 9cce8a5ac..07a450887 100644 --- a/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagException.java +++ b/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagException.java @@ -20,9 +20,7 @@ package com.sk89q.worldedit.extent.inventory; /** - * - * @author sk89q + * Thrown when a block bag detects a problem. */ public class BlockBagException extends Exception { - private static final long serialVersionUID = 4672190086028430655L; } diff --git a/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java b/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java index 0d29fea34..7eca18d20 100644 --- a/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java +++ b/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java @@ -44,7 +44,6 @@ public class BlockBagExtent extends AbstractDelegateExtent { * Create a new instance. * * @param extent the extent - * @param world the world * @param blockBag the block bag */ public BlockBagExtent(Extent extent, @Nullable BlockBag blockBag) { diff --git a/src/main/java/com/sk89q/worldedit/extent/inventory/OutOfBlocksException.java b/src/main/java/com/sk89q/worldedit/extent/inventory/OutOfBlocksException.java index be85ce4c7..7c632c664 100644 --- a/src/main/java/com/sk89q/worldedit/extent/inventory/OutOfBlocksException.java +++ b/src/main/java/com/sk89q/worldedit/extent/inventory/OutOfBlocksException.java @@ -20,9 +20,7 @@ package com.sk89q.worldedit.extent.inventory; /** - * - * @author sk89q + * Thrown when there are no more blocks left. */ public class OutOfBlocksException extends BlockBagException { - private static final long serialVersionUID = 7495899825677689509L; } diff --git a/src/main/java/com/sk89q/worldedit/extent/inventory/OutOfSpaceException.java b/src/main/java/com/sk89q/worldedit/extent/inventory/OutOfSpaceException.java index 0d06d6d80..27eb6d1f4 100644 --- a/src/main/java/com/sk89q/worldedit/extent/inventory/OutOfSpaceException.java +++ b/src/main/java/com/sk89q/worldedit/extent/inventory/OutOfSpaceException.java @@ -20,26 +20,24 @@ package com.sk89q.worldedit.extent.inventory; /** - * - * @author sk89q + * Thrown when the target inventory of a block bag is full. */ public class OutOfSpaceException extends BlockBagException { - private static final long serialVersionUID = -2962840237632916821L; - /** - * Stores the block ID. - */ private int id; /** * Construct the object. - * @param id + * + * @param id the ID of the block */ public OutOfSpaceException(int id) { this.id = id; } /** + * Get the ID of the block + * * @return the id */ public int getID() { diff --git a/src/main/java/com/sk89q/worldedit/extent/inventory/UnplaceableBlockException.java b/src/main/java/com/sk89q/worldedit/extent/inventory/UnplaceableBlockException.java index fecb02bba..2749a5688 100644 --- a/src/main/java/com/sk89q/worldedit/extent/inventory/UnplaceableBlockException.java +++ b/src/main/java/com/sk89q/worldedit/extent/inventory/UnplaceableBlockException.java @@ -20,10 +20,7 @@ package com.sk89q.worldedit.extent.inventory; /** - * - * @author sk89q + * Thrown when a block that can't be placed is used. */ public class UnplaceableBlockException extends BlockBagException { - private static final long serialVersionUID = 7227883966999843526L; - } diff --git a/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java b/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java index 578639019..0f1b3fda0 100644 --- a/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java +++ b/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java @@ -186,7 +186,7 @@ public class MultiStageReorder extends AbstractDelegateExtent implements Reorder current = current.add(attachment.vector()).toBlockVector(); if (!blocks.contains(current)) { - // We ran outside the remaing set => assume we can place blocks on this + // We ran outside the remaining set => assume we can place blocks on this break; } diff --git a/src/main/java/com/sk89q/worldedit/extent/reorder/ReorderingExtent.java b/src/main/java/com/sk89q/worldedit/extent/reorder/ReorderingExtent.java index 66c9c7015..84e5626f0 100644 --- a/src/main/java/com/sk89q/worldedit/extent/reorder/ReorderingExtent.java +++ b/src/main/java/com/sk89q/worldedit/extent/reorder/ReorderingExtent.java @@ -24,10 +24,10 @@ import com.sk89q.worldedit.extent.Extent; /** * An interface for {@link Extent}s that are meant to reorder changes so * that they are more successful. - * - * For example, torches in Minecraft need to be placed on a block. A smart + * + *For example, torches in Minecraft need to be placed on a block. A smart * reordering implementation might place the torch after the block has - * been placed. + * been placed.
*/ public interface ReorderingExtent extends Extent { diff --git a/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java b/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java index bbf5b4699..de7c21b2c 100644 --- a/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java +++ b/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java @@ -31,11 +31,11 @@ import static com.google.common.base.Preconditions.checkNotNull; /** * Makes changes to the world as if a player had done so during survival mode. - * - * Note that this extent may choose to not call the underlying + * + *Note that this extent may choose to not call the underlying * extent and may instead call methods on the {@link World} that is passed * in the constructor. For that reason, if you wish to "catch" changes, you - * should catch them before the changes reach this extent. + * should catch them before the changes reach this extent.
*/ public class SurvivalModeExtent extends AbstractDelegateExtent { @@ -57,10 +57,10 @@ public class SurvivalModeExtent extends AbstractDelegateExtent { /** * Return whether changes to the world should be simulated with the * use of game tools (such as pickaxes) whenever possible and reasonable. - * - * For example, we could pretend that the act of setting a coal ore block + * + *For example, we could pretend that the act of setting a coal ore block * to air (nothing) was the act of a player mining that coal ore block - * with a pickaxe, which would mean that a coal item would be dropped. + * with a pickaxe, which would mean that a coal item would be dropped.
* * @return true if tool use is to be simulated */ diff --git a/src/main/java/com/sk89q/worldedit/function/LayerFunction.java b/src/main/java/com/sk89q/worldedit/function/LayerFunction.java index e54049725..bd9acb7cb 100644 --- a/src/main/java/com/sk89q/worldedit/function/LayerFunction.java +++ b/src/main/java/com/sk89q/worldedit/function/LayerFunction.java @@ -39,9 +39,9 @@ public interface LayerFunction { /** * Apply the function to the given position. - * - * The depth would be the number of blocks from the surface if - * a {@link LayerVisitor} was used. + * + *The depth would be the number of blocks from the surface if + * a {@link LayerVisitor} was used.
* * @param position the position * @param depth the depth as a number starting from 0 diff --git a/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java b/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java index 25d64a135..17d2547d6 100644 --- a/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java +++ b/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java @@ -31,9 +31,9 @@ import com.sk89q.worldedit.function.pattern.RandomPattern; /** * Generates flora (which may include tall grass, flowers, etc.). - *- * The current implementation is not biome-aware, but it may become so in - * the future. + * + *
The current implementation is not biome-aware, but it may become so in + * the future.
*/ public class FloraGenerator implements RegionFunction { @@ -53,8 +53,9 @@ public class FloraGenerator implements RegionFunction { /** * Return whether the flora generator is set to be biome-aware. - *- * By default, it is currently disabled by default, but this may change. + * + *
By default, it is currently disabled by default, but + * this may change.
* * @return true if biome aware */ @@ -64,8 +65,8 @@ public class FloraGenerator implements RegionFunction { /** * Set whether the generator is biome aware. - *- * It is currently not possible to make the generator biome-aware. + * + *
It is currently not possible to make the generator biome-aware.
* * @param biomeAware must always be false */ @@ -73,7 +74,6 @@ public class FloraGenerator implements RegionFunction { if (biomeAware) { throw new IllegalArgumentException("Cannot enable biome-aware mode; not yet implemented"); } - this.biomeAware = biomeAware; } /** diff --git a/src/main/java/com/sk89q/worldedit/function/mask/Masks.java b/src/main/java/com/sk89q/worldedit/function/mask/Masks.java index 837bcd2ae..86280cb08 100644 --- a/src/main/java/com/sk89q/worldedit/function/mask/Masks.java +++ b/src/main/java/com/sk89q/worldedit/function/mask/Masks.java @@ -133,10 +133,10 @@ public final class Masks { /** * Wrap an old-style mask and convert it to a new mask. - * - * Note, however, that this is strongly not recommended because + * + *Note, however, that this is strongly not recommended because * {@link com.sk89q.worldedit.masks.Mask#prepare(LocalSession, LocalPlayer, Vector)} - * is not called. + * is not called.
* * @param mask the old-style mask * @param editSession the edit session to bind to @@ -163,10 +163,10 @@ public final class Masks { /** * Wrap an old-style mask and convert it to a new mask. - * - * As an {@link EditSession} is not provided in this case, one will be + * + *As an {@link EditSession} is not provided in this case, one will be * taken from the {@link Request}, if possible. If not possible, then the - * mask will return false. + * mask will return false.
* * @param mask the old-style mask * @return a new-style mask diff --git a/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter.java b/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter.java index 7c5b658d4..61dd7b73a 100644 --- a/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter.java +++ b/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter.java @@ -77,8 +77,6 @@ public class NoiseFilter extends AbstractMask { /** * Set the probability of passing as a number between 0 and 1 (inclusive). - * - * @return the density */ public void setDensity(double density) { checkArgument(density >= 0, "density must be >= 0"); diff --git a/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter2D.java b/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter2D.java index f0dbe6240..6a2146c58 100644 --- a/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter2D.java +++ b/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter2D.java @@ -75,8 +75,6 @@ public class NoiseFilter2D extends AbstractMask2D { /** * Set the probability of passing as a number between 0 and 1 (inclusive). - * - * @return the density */ public void setDensity(double density) { checkArgument(density >= 0, "density must be >= 0"); diff --git a/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java b/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java index 3f9887b28..06da47e6b 100644 --- a/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java +++ b/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java @@ -43,10 +43,10 @@ import static com.google.common.base.Preconditions.checkNotNull; /** * Makes a copy of a portion of one extent to another extent or another point. - * - * This is a forward extent copy, meaning that it iterates over the blocks in the - * source extent, and will copy as many blocks as there are in the source. - * Therefore, interpolation will not occur to fill in the gaps. + * + *This is a forward extent copy, meaning that it iterates over the blocks + * in the source extent, and will copy as many blocks as there are in the + * source. Therefore, interpolation will not occur to fill in the gaps.
*/ public class ForwardExtentCopy implements Operation { @@ -102,8 +102,8 @@ public class ForwardExtentCopy implements Operation { /** * Get the transformation that will occur on every point. - * - * The transformation will stack with each repetition. + * + *The transformation will stack with each repetition.
* * @return a transformation */ @@ -124,8 +124,8 @@ public class ForwardExtentCopy implements Operation { /** * Get the mask that gets applied to the source extent. - * - * This mask can be used to filter what will be copied from the source. + * + *This mask can be used to filter what will be copied from the source.
* * @return a source mask */ @@ -195,7 +195,7 @@ public class ForwardExtentCopy implements Operation { /** * Set whether entities that are copied should be removed. * - * @param removing true if removing + * @param removingEntities true if removing */ public void setRemovingEntities(boolean removingEntities) { this.removingEntities = removingEntities; diff --git a/src/main/java/com/sk89q/worldedit/function/operation/OperationQueue.java b/src/main/java/com/sk89q/worldedit/function/operation/OperationQueue.java index fd25f7c8c..895195c2f 100644 --- a/src/main/java/com/sk89q/worldedit/function/operation/OperationQueue.java +++ b/src/main/java/com/sk89q/worldedit/function/operation/OperationQueue.java @@ -77,7 +77,7 @@ public class OperationQueue implements Operation { @Override public Operation resume(RunContext run) throws WorldEditException { - if (current == null && queue.size() > 0) { + if (current == null && !queue.isEmpty()) { current = queue.poll(); } diff --git a/src/main/java/com/sk89q/worldedit/function/operation/RunContext.java b/src/main/java/com/sk89q/worldedit/function/operation/RunContext.java index c8c7b15c7..1af0412cf 100644 --- a/src/main/java/com/sk89q/worldedit/function/operation/RunContext.java +++ b/src/main/java/com/sk89q/worldedit/function/operation/RunContext.java @@ -26,8 +26,8 @@ public class RunContext { /** * Return whether the current operation should still continue running. - * - * This method can be called frequently. + * + *This method can be called frequently.
* * @return true if the operation should continue running */ diff --git a/src/main/java/com/sk89q/worldedit/function/pattern/RandomPattern.java b/src/main/java/com/sk89q/worldedit/function/pattern/RandomPattern.java index 00a0f8661..992eda5c5 100644 --- a/src/main/java/com/sk89q/worldedit/function/pattern/RandomPattern.java +++ b/src/main/java/com/sk89q/worldedit/function/pattern/RandomPattern.java @@ -39,9 +39,9 @@ public class RandomPattern extends AbstractPattern { /** * Add a pattern to the weight list of patterns. - * - * The probability for the pattern added is chance / max where max is the sum - * of the probabilities of all added patterns. + * + *The probability for the pattern added is chance / max where max is + * the sum of the probabilities of all added patterns.
* * @param pattern the pattern * @param chance the chance, which can be any positive number diff --git a/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java b/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java index 368e8d906..5356f568d 100644 --- a/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java +++ b/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java @@ -36,10 +36,10 @@ import static com.google.common.base.Preconditions.checkNotNull; * to a certain adjacent point provided that the method * {@link #isVisitable(com.sk89q.worldedit.Vector, com.sk89q.worldedit.Vector)} * returns true for that point. - * - * As an abstract implementation, this class can be used to implement + * + *As an abstract implementation, this class can be used to implement * functionality that starts at certain points and extends outward from - * those points. + * those points.
*/ public abstract class BreadthFirstSearch implements Operation { @@ -62,12 +62,13 @@ public abstract class BreadthFirstSearch implements Operation { /** * Get the list of directions will be visited. - * - * Directions are {@link com.sk89q.worldedit.Vector}s that determine + * + *Directions are {@link com.sk89q.worldedit.Vector}s that determine * what adjacent points area available. Vectors should not be - * unit vectors. An example of a valid direction is {@code new Vector(1, 0, 1)}. - *
- * The list of directions can be cleared. + * unit vectors. An example of a valid direction is + * {@code new Vector(1, 0, 1)}. + * + *The list of directions can be cleared.
* * @return the list of directions */ diff --git a/src/main/java/com/sk89q/worldedit/function/visitor/DownwardVisitor.java b/src/main/java/com/sk89q/worldedit/function/visitor/DownwardVisitor.java index 1fe358da5..ae57a4418 100644 --- a/src/main/java/com/sk89q/worldedit/function/visitor/DownwardVisitor.java +++ b/src/main/java/com/sk89q/worldedit/function/visitor/DownwardVisitor.java @@ -31,8 +31,8 @@ import static com.google.common.base.Preconditions.checkNotNull; * Visits adjacent points on the same X-Z plane as long as the points * pass the given mask, and then executes the provided region * function on the entire column. - * - * This is used by//fill
.
+ *
+ * This is used by {@code //fill}.
*/ public class DownwardVisitor extends RecursiveVisitor { diff --git a/src/main/java/com/sk89q/worldedit/function/visitor/LayerVisitor.java b/src/main/java/com/sk89q/worldedit/function/visitor/LayerVisitor.java index e368a8606..93b03c60e 100644 --- a/src/main/java/com/sk89q/worldedit/function/visitor/LayerVisitor.java +++ b/src/main/java/com/sk89q/worldedit/function/visitor/LayerVisitor.java @@ -34,11 +34,11 @@ import static com.google.common.base.Preconditions.checkNotNull; /** * Visits the layers within a region. - * - * This class works by iterating over all the columns in a {@link FlatRegion}, + * + *This class works by iterating over all the columns in a {@link FlatRegion}, * finding the first ground block in each column (searching from a given * maximum Y down to a minimum Y), and then applies a {@link LayerFunction} to - * each layer. + * each layer.
*/ public class LayerVisitor implements Operation { diff --git a/src/main/java/com/sk89q/worldedit/history/UndoContext.java b/src/main/java/com/sk89q/worldedit/history/UndoContext.java index 31ec39c41..647844acb 100644 --- a/src/main/java/com/sk89q/worldedit/history/UndoContext.java +++ b/src/main/java/com/sk89q/worldedit/history/UndoContext.java @@ -26,9 +26,9 @@ import javax.annotation.Nullable; /** * Provides context for undo and redo operations. - * - * For example, {@link BlockChange}s take the {@link Extent} from the - * context rather than store a reference to one. + * + *For example, {@link BlockChange}s take the {@link Extent} from the + * context rather than store a reference to one.
*/ public class UndoContext { diff --git a/src/main/java/com/sk89q/worldedit/history/change/BlockChange.java b/src/main/java/com/sk89q/worldedit/history/change/BlockChange.java index 142c29e42..0b1e91e05 100644 --- a/src/main/java/com/sk89q/worldedit/history/change/BlockChange.java +++ b/src/main/java/com/sk89q/worldedit/history/change/BlockChange.java @@ -29,10 +29,10 @@ import static com.google.common.base.Preconditions.checkNotNull; /** * Represents a block change that may be undone or replayed. - * - * This block change does not have an {@link Extent} assigned to it because + * + *This block change does not have an {@link Extent} assigned to it because * one will be taken from the passed {@link UndoContext}. If the context - * does not have an extent (it is null), cryptic errors may occur. + * does not have an extent (it is null), cryptic errors may occur.
*/ public class BlockChange implements Change { diff --git a/src/main/java/com/sk89q/worldedit/history/changeset/BlockOptimizedHistory.java b/src/main/java/com/sk89q/worldedit/history/changeset/BlockOptimizedHistory.java index 4750ecd36..d8286ffb5 100644 --- a/src/main/java/com/sk89q/worldedit/history/changeset/BlockOptimizedHistory.java +++ b/src/main/java/com/sk89q/worldedit/history/changeset/BlockOptimizedHistory.java @@ -36,10 +36,10 @@ import static java.util.Map.Entry; /** * An extension of {@link ArrayListHistory} that stores {@link BlockChange}s * separately in two {@link ArrayList}s. - * - * Whether this is a good idea or not is highly questionable, but this class + * + *Whether this is a good idea or not is highly questionable, but this class * exists because this is how history was implemented in WorldEdit for - * many years. + * many years.
*/ public class BlockOptimizedHistory extends ArrayListHistory { diff --git a/src/main/java/com/sk89q/worldedit/history/changeset/ChangeSet.java b/src/main/java/com/sk89q/worldedit/history/changeset/ChangeSet.java index eab0d0e87..0b018bcb9 100644 --- a/src/main/java/com/sk89q/worldedit/history/changeset/ChangeSet.java +++ b/src/main/java/com/sk89q/worldedit/history/changeset/ChangeSet.java @@ -38,9 +38,9 @@ public interface ChangeSet { /** * Get a backward directed iterator that can be used for undo. - * - * The iterator may return the changes out of order, as long as the final - * result after all changes have been applied is correct. + * + *The iterator may return the changes out of order, as long as the final + * result after all changes have been applied is correct.
* * @return a undo directed iterator */ @@ -48,9 +48,9 @@ public interface ChangeSet { /** * Get a forward directed iterator that can be used for redo. - * - * The iterator may return the changes out of order, as long as the final - * result after all changes have been applied is correct. + * + *The iterator may return the changes out of order, as long as the final + * result after all changes have been applied is correct.
* * @return a forward directed iterator */ diff --git a/src/main/java/com/sk89q/worldedit/internal/LocalWorldAdapter.java b/src/main/java/com/sk89q/worldedit/internal/LocalWorldAdapter.java index d800de00a..2ded7c439 100644 --- a/src/main/java/com/sk89q/worldedit/internal/LocalWorldAdapter.java +++ b/src/main/java/com/sk89q/worldedit/internal/LocalWorldAdapter.java @@ -47,6 +47,7 @@ import static com.google.common.base.Preconditions.checkNotNull; /** * Wraps {@link World}s into {@link LocalWorld}. */ +@SuppressWarnings("deprecation") public class LocalWorldAdapter extends LocalWorld { private final World world; @@ -203,6 +204,7 @@ public class LocalWorldAdapter extends LocalWorld { return world.getWorldData(); } + @SuppressWarnings("EqualsWhichDoesntCheckParameterClass") @Override public boolean equals(Object other) { return world.equals(other); diff --git a/src/main/java/com/sk89q/worldedit/internal/ServerInterfaceAdapter.java b/src/main/java/com/sk89q/worldedit/internal/ServerInterfaceAdapter.java index 32d0922cc..af49c16f4 100644 --- a/src/main/java/com/sk89q/worldedit/internal/ServerInterfaceAdapter.java +++ b/src/main/java/com/sk89q/worldedit/internal/ServerInterfaceAdapter.java @@ -37,6 +37,7 @@ import static com.google.common.base.Preconditions.checkNotNull; /** * Adapts {@link Platform}s into the legacy {@link ServerInterface}. */ +@SuppressWarnings("ALL") public class ServerInterfaceAdapter extends ServerInterface { private final Platform platform; diff --git a/src/main/java/com/sk89q/worldedit/internal/cui/CUIRegion.java b/src/main/java/com/sk89q/worldedit/internal/cui/CUIRegion.java index f4bfd934c..84b740e39 100644 --- a/src/main/java/com/sk89q/worldedit/internal/cui/CUIRegion.java +++ b/src/main/java/com/sk89q/worldedit/internal/cui/CUIRegion.java @@ -19,7 +19,6 @@ package com.sk89q.worldedit.internal.cui; -import com.sk89q.worldedit.LocalPlayer; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.extension.platform.Actor; @@ -46,13 +45,14 @@ public interface CUIRegion { * up-to-date data. If the CUI version is smaller than * this value, the legacy methods will be called. * - * @return + * @return the protocol version */ public int getProtocolVersion(); /** - * Returns the type ID to send to CUI in the selection event. - * @return + * Returns the type ID to send to CUI in the selection event. + * + * @return the type ID */ public String getTypeID(); @@ -60,7 +60,7 @@ public interface CUIRegion { * Returns the type ID to send to CUI in the selection * event if the CUI is in legacy mode. * - * @return + * @return the legacy type ID */ public String getLegacyTypeID(); } diff --git a/src/main/java/com/sk89q/worldedit/internal/cui/SelectionCylinderEvent.java b/src/main/java/com/sk89q/worldedit/internal/cui/SelectionCylinderEvent.java index 70dc22601..d23fd9a74 100644 --- a/src/main/java/com/sk89q/worldedit/internal/cui/SelectionCylinderEvent.java +++ b/src/main/java/com/sk89q/worldedit/internal/cui/SelectionCylinderEvent.java @@ -34,10 +34,12 @@ public class SelectionCylinderEvent implements CUIEvent { this.radius = radius; } + @Override public String getTypeId() { return "cyl"; } + @Override public String[] getParameters() { return new String[] { String.valueOf(pos.getBlockX()), diff --git a/src/main/java/com/sk89q/worldedit/internal/cui/SelectionEllipsoidPointEvent.java b/src/main/java/com/sk89q/worldedit/internal/cui/SelectionEllipsoidPointEvent.java index a4254cbd9..3e371b105 100644 --- a/src/main/java/com/sk89q/worldedit/internal/cui/SelectionEllipsoidPointEvent.java +++ b/src/main/java/com/sk89q/worldedit/internal/cui/SelectionEllipsoidPointEvent.java @@ -22,6 +22,7 @@ package com.sk89q.worldedit.internal.cui; import com.sk89q.worldedit.Vector; public class SelectionEllipsoidPointEvent implements CUIEvent { + protected final int id; protected final Vector pos; @@ -30,10 +31,12 @@ public class SelectionEllipsoidPointEvent implements CUIEvent { this.pos = pos; } + @Override public String getTypeId() { return "e"; } + @Override public String[] getParameters() { return new String[] { String.valueOf(id), @@ -42,4 +45,5 @@ public class SelectionEllipsoidPointEvent implements CUIEvent { String.valueOf(pos.getBlockZ()) }; } + } diff --git a/src/main/java/com/sk89q/worldedit/internal/cui/SelectionMinMaxEvent.java b/src/main/java/com/sk89q/worldedit/internal/cui/SelectionMinMaxEvent.java index 515b8970c..3eeaabb72 100644 --- a/src/main/java/com/sk89q/worldedit/internal/cui/SelectionMinMaxEvent.java +++ b/src/main/java/com/sk89q/worldedit/internal/cui/SelectionMinMaxEvent.java @@ -29,10 +29,12 @@ public class SelectionMinMaxEvent implements CUIEvent { this.max = max; } + @Override public String getTypeId() { return "mm"; } + @Override public String[] getParameters() { return new String[] { String.valueOf(min), diff --git a/src/main/java/com/sk89q/worldedit/internal/cui/SelectionPoint2DEvent.java b/src/main/java/com/sk89q/worldedit/internal/cui/SelectionPoint2DEvent.java index c5cd62307..dc4d0adaa 100644 --- a/src/main/java/com/sk89q/worldedit/internal/cui/SelectionPoint2DEvent.java +++ b/src/main/java/com/sk89q/worldedit/internal/cui/SelectionPoint2DEvent.java @@ -43,10 +43,12 @@ public class SelectionPoint2DEvent implements CUIEvent { this.area = area; } + @Override public String getTypeId() { return "p2"; } + @Override public String[] getParameters() { return new String[] { String.valueOf(id), diff --git a/src/main/java/com/sk89q/worldedit/internal/cui/SelectionPointEvent.java b/src/main/java/com/sk89q/worldedit/internal/cui/SelectionPointEvent.java index 0e2f80329..e719b1855 100644 --- a/src/main/java/com/sk89q/worldedit/internal/cui/SelectionPointEvent.java +++ b/src/main/java/com/sk89q/worldedit/internal/cui/SelectionPointEvent.java @@ -33,10 +33,12 @@ public class SelectionPointEvent implements CUIEvent { this.area = area; } + @Override public String getTypeId() { return "p"; } + @Override public String[] getParameters() { return new String[] { String.valueOf(id), diff --git a/src/main/java/com/sk89q/worldedit/internal/cui/SelectionPolygonEvent.java b/src/main/java/com/sk89q/worldedit/internal/cui/SelectionPolygonEvent.java index 6ff38bf5a..e6a0de312 100644 --- a/src/main/java/com/sk89q/worldedit/internal/cui/SelectionPolygonEvent.java +++ b/src/main/java/com/sk89q/worldedit/internal/cui/SelectionPolygonEvent.java @@ -22,16 +22,19 @@ package com.sk89q.worldedit.internal.cui; public class SelectionPolygonEvent implements CUIEvent { + protected final int[] vertices; public SelectionPolygonEvent(int... vertices) { this.vertices = vertices; } + @Override public String getTypeId() { return "poly"; } + @Override public String[] getParameters() { final String[] ret = new String[vertices.length]; @@ -42,4 +45,5 @@ public class SelectionPolygonEvent implements CUIEvent { return ret; } + } diff --git a/src/main/java/com/sk89q/worldedit/internal/cui/SelectionShapeEvent.java b/src/main/java/com/sk89q/worldedit/internal/cui/SelectionShapeEvent.java index 478ab8483..c4bad96b4 100644 --- a/src/main/java/com/sk89q/worldedit/internal/cui/SelectionShapeEvent.java +++ b/src/main/java/com/sk89q/worldedit/internal/cui/SelectionShapeEvent.java @@ -27,10 +27,12 @@ public class SelectionShapeEvent implements CUIEvent { this.shapeName = shapeName; } + @Override public String getTypeId() { return "s"; } + @Override public String[] getParameters() { return new String[] { shapeName }; } diff --git a/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java b/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java index bb73a6b19..09583d5bb 100644 --- a/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java +++ b/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java @@ -19,47 +19,57 @@ package com.sk89q.worldedit.internal.expression; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Stack; - import com.sk89q.worldedit.internal.expression.lexer.Lexer; import com.sk89q.worldedit.internal.expression.lexer.tokens.Token; import com.sk89q.worldedit.internal.expression.parser.Parser; -import com.sk89q.worldedit.internal.expression.runtime.ExpressionEnvironment; import com.sk89q.worldedit.internal.expression.runtime.Constant; import com.sk89q.worldedit.internal.expression.runtime.EvaluationException; +import com.sk89q.worldedit.internal.expression.runtime.ExpressionEnvironment; import com.sk89q.worldedit.internal.expression.runtime.Functions; import com.sk89q.worldedit.internal.expression.runtime.RValue; import com.sk89q.worldedit.internal.expression.runtime.ReturnException; import com.sk89q.worldedit.internal.expression.runtime.Variable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Stack; + /** * Compiles and evaluates expressions. * - * Supported operators: - * Logical: &&, ||, ! (unary) - * Bitwise: ~ (unary), >>, << - * Arithmetic: +, -, *, /, % (modulo), ^ (power), - (unary), --, ++ (prefix only) - * Comparison: <=, >=, >, <, ==, !=, ~= (near) + *Supported operators:
* - * Supported functions: abs, acos, asin, atan, atan2, cbrt, ceil, cos, cosh, exp, floor, ln, log, log10, max, max, min, min, rint, round, sin, sinh, sqrt, tan, tanh and more. (See the Functions class or the wiki) + *Supported functions: abs, acos, asin, atan, atan2, cbrt, ceil, cos, cosh, + * exp, floor, ln, log, log10, max, max, min, min, rint, round, sin, sinh, + * sqrt, tan, tanh and more. (See the Functions class or the wiki)
* - * To compile an equation, runExpression.compile("expression here", "var1", "var2"...)
- * If you wish to run the equation multiple times, you can then optimize it, by calling myExpression.optimize();
- * You can then run the equation as many times as you want by calling myExpression.evaluate(var1, var2...)
- * You do not need to pass values for all variables specified while compiling.
- * To query variables after evaluation, you can use myExpression.getVariable("variable name").
- * To get a value out of these, use myVariable.getValue()
+ * Constants: e, pi
* - * Variables are also supported and can be set either by passing values toevaluate
+ * To compile an equation, run + * {@code Expression.compile("expression here", "var1", "var2"...)}. + * If you wish to run the equation multiple times, you can then optimize it, + * by calling {@link #optimize()}. You can then run the equation as many times + * as you want by calling {@link #evaluate(double...)}. You do not need to + * pass values for all variables specified while compiling. + * To query variables after evaluation, you can use + * {@link #getVariable(String, boolean)}. To get a value out of these, use + * {@link Variable#getValue()}.
+ * + *Variables are also supported and can be set either by passing values + * to {@link #evaluate(double...)}.
* * @author TomyLobo */ public class Expression { + private static final ThreadLocalTokens can be numbers, identifiers, operators and assorted other + * characters.
*/ public class Lexer { + private final String expression; private int position = 0; @@ -46,7 +51,7 @@ public class Lexer { this.expression = expression; } - public static final ListTokens can be numbers, identifiers, operators and assorted other characters.
*/ public class Parser { private final class NullToken extends Token { @@ -56,6 +55,7 @@ public class Parser { super(position); } + @Override public char id() { return '\0'; } @@ -75,7 +75,7 @@ public class Parser { this.expression = expression; } - public static final RValue parse(List- * In IEEE 754 arithmetic, this is also the smallest normalized number + * + *
In IEEE 754 arithmetic, this is also the smallest normalized number * 2-1022. The value of this constant is from Apache Commons - * Math 2.2. + * Math 2.2.
*/ public static final double SAFE_MIN = 0x1.0p-1022; diff --git a/src/main/java/com/sk89q/worldedit/math/convolution/GaussianKernel.java b/src/main/java/com/sk89q/worldedit/math/convolution/GaussianKernel.java index 1bc86cfe3..bc8b647f7 100644 --- a/src/main/java/com/sk89q/worldedit/math/convolution/GaussianKernel.java +++ b/src/main/java/com/sk89q/worldedit/math/convolution/GaussianKernel.java @@ -22,11 +22,8 @@ package com.sk89q.worldedit.math.convolution; import java.awt.image.Kernel; /** - * A Gaussian Kernel generator (2D bellcurve) - * - * @author Grum + * A Gaussian Kernel generator (2D bellcurve). */ - public class GaussianKernel extends Kernel { /** @@ -35,7 +32,6 @@ public class GaussianKernel extends Kernel { * @param radius the resulting diameter will be radius * 2 + 1 * @param sigma controls 'flatness' */ - public GaussianKernel(int radius, double sigma) { super(radius * 2 + 1, radius * 2 + 1, createKernel(radius, sigma)); } @@ -54,4 +50,5 @@ public class GaussianKernel extends Kernel { return data; } + } diff --git a/src/main/java/com/sk89q/worldedit/math/convolution/HeightMap.java b/src/main/java/com/sk89q/worldedit/math/convolution/HeightMap.java index 3d3768c85..44f750760 100644 --- a/src/main/java/com/sk89q/worldedit/math/convolution/HeightMap.java +++ b/src/main/java/com/sk89q/worldedit/math/convolution/HeightMap.java @@ -26,14 +26,15 @@ import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.regions.Region; -/** - * Allows applications of Kernels onto the region's heightmap. - * Currently only used for smoothing (with a GaussianKernel). - * - * @author Grum - */ +import static com.google.common.base.Preconditions.checkNotNull; +/** + * Allows applications of Kernels onto the region's height map. + * + *Currently only used for smoothing (with a GaussianKernel)
. + */ public class HeightMap { + private int[] data; private int width; private int height; @@ -44,8 +45,8 @@ public class HeightMap { /** * Constructs the HeightMap * - * @param session - * @param region + * @param session an edit session + * @param region the region */ public HeightMap(EditSession session, Region region) { this(session, region, false); @@ -53,12 +54,15 @@ public class HeightMap { /** * Constructs the HeightMap - * - * @param session - * @param region + * + * @param session an edit session + * @param region the region * @param naturalOnly ignore non-natural blocks */ public HeightMap(EditSession session, Region region, boolean naturalOnly) { + checkNotNull(session); + checkNotNull(region); + this.session = session; this.region = region; @@ -82,13 +86,15 @@ public class HeightMap { /** * Apply the filter 'iterations' amount times. * - * @param filter - * @param iterations + * @param filter the filter + * @param iterations the number of iterations * @return number of blocks affected * @throws MaxChangedBlocksException */ public int applyFilter(HeightMapFilter filter, int iterations) throws MaxChangedBlocksException { + checkNotNull(filter); + int[] newData = new int[data.length]; System.arraycopy(data, 0, newData, 0, data.length); @@ -102,12 +108,14 @@ public class HeightMap { /** * Apply a raw heightmap to the region * - * @param data + * @param data the data * @return number of blocks affected * @throws MaxChangedBlocksException */ public int apply(int[] data) throws MaxChangedBlocksException { + checkNotNull(data); + Vector minY = region.getMinimumPoint(); int originX = minY.getBlockX(); int originY = minY.getBlockY(); @@ -178,4 +186,5 @@ public class HeightMap { return blocksChanged; } + } diff --git a/src/main/java/com/sk89q/worldedit/math/convolution/HeightMapFilter.java b/src/main/java/com/sk89q/worldedit/math/convolution/HeightMapFilter.java index 80de5f95a..93f4f7c06 100644 --- a/src/main/java/com/sk89q/worldedit/math/convolution/HeightMapFilter.java +++ b/src/main/java/com/sk89q/worldedit/math/convolution/HeightMapFilter.java @@ -21,33 +21,36 @@ package com.sk89q.worldedit.math.convolution; import java.awt.image.Kernel; -/** - * Allows applications of Kernels onto the region's heightmap. - * Only used for smoothing (with a GaussianKernel). - * - * @author Grum - */ +import static com.google.common.base.Preconditions.checkNotNull; +/** + * Allows applications of Kernels onto the region's height map. + * + *Only used for smoothing (with a GaussianKernel).
+ */ public class HeightMapFilter { + private Kernel kernel; /** * Construct the HeightMapFilter object. * - * @param kernel + * @param kernel the kernel */ public HeightMapFilter(Kernel kernel) { + checkNotNull(kernel); this.kernel = kernel; } /** * Construct the HeightMapFilter object. * - * @param kernelWidth - * @param kernelHeight - * @param kernelData + * @param kernelWidth the width + * @param kernelHeight the height + * @param kernelData the data */ public HeightMapFilter(int kernelWidth, int kernelHeight, float[] kernelData) { + checkNotNull(kernelData); this.kernel = new Kernel(kernelWidth, kernelHeight, kernelData); } @@ -61,21 +64,26 @@ public class HeightMapFilter { /** * Set Kernel * - * @param kernel + * @param kernel the kernel */ public void setKernel(Kernel kernel) { + checkNotNull(kernel); + this.kernel = kernel; } /** * Filter with a 2D kernel - * - * @param inData - * @param width - * @param height - * @return the modified heightmap + * + * @param inData the data + * @param width the width + * @param height the height + * + * @return the modified height map */ public int[] filter(int[] inData, int width, int height) { + checkNotNull(inData); + int index = 0; float[] matrix = kernel.getKernelData(null); int[] outData = new int[inData.length]; @@ -117,4 +125,5 @@ public class HeightMapFilter { } return outData; } + } diff --git a/src/main/java/com/sk89q/worldedit/math/convolution/LinearKernel.java b/src/main/java/com/sk89q/worldedit/math/convolution/LinearKernel.java index 3a65ffeb5..3e31c199e 100644 --- a/src/main/java/com/sk89q/worldedit/math/convolution/LinearKernel.java +++ b/src/main/java/com/sk89q/worldedit/math/convolution/LinearKernel.java @@ -23,10 +23,7 @@ import java.awt.image.Kernel; /** * A linear Kernel generator (all cells weight the same) - * - * @author Grum */ - public class LinearKernel extends Kernel { public LinearKernel(int radius) { @@ -37,8 +34,9 @@ public class LinearKernel extends Kernel { int diameter = radius * 2 + 1; float[] data = new float[diameter * diameter]; - for (int i = 0; i < data.length; data[i++] = 1.0f / data.length) ; + for (int i = 0; i < data.length; data[i++] = 1.0f / data.length); return data; } + } diff --git a/src/main/java/com/sk89q/worldedit/math/interpolation/Interpolation.java b/src/main/java/com/sk89q/worldedit/math/interpolation/Interpolation.java index 0652d598a..89f0a8012 100644 --- a/src/main/java/com/sk89q/worldedit/math/interpolation/Interpolation.java +++ b/src/main/java/com/sk89q/worldedit/math/interpolation/Interpolation.java @@ -21,38 +21,36 @@ package com.sk89q.worldedit.math.interpolation; -import java.util.List; - import com.sk89q.worldedit.Vector; +import java.util.List; + /** * Represents an arbitrary function in ℝ → ℝ3 - * - * @author TomyLobo - * */ public interface Interpolation { + /** * Sets nodes to be used by subsequent calls to * {@link #getPosition(double)} and the other methods. * - * @param nodes + * @param nodes the nodes */ public void setNodes(ListSupports {@link Node#tension tension}, {@link Node#bias bias} and + * {@link Node#continuity continuity} parameters per {@link Node}.
*/ public class KochanekBartelsInterpolation implements Interpolation { + private ListThe {@link #tension}, {@link #bias} and {@link #continuity} fields + * are parameters for the Kochanek-Bartels interpolation algorithm.
*/ public class Node { + private Vector position; private double tension; @@ -86,4 +85,5 @@ public class Node { public void setContinuity(double continuity) { this.continuity = continuity; } + } diff --git a/src/main/java/com/sk89q/worldedit/math/interpolation/ReparametrisingInterpolation.java b/src/main/java/com/sk89q/worldedit/math/interpolation/ReparametrisingInterpolation.java index 4d5695bda..8a0df7b9f 100644 --- a/src/main/java/com/sk89q/worldedit/math/interpolation/ReparametrisingInterpolation.java +++ b/src/main/java/com/sk89q/worldedit/math/interpolation/ReparametrisingInterpolation.java @@ -21,31 +21,39 @@ package com.sk89q.worldedit.math.interpolation; +import com.sk89q.worldedit.Vector; + import java.util.List; import java.util.Map.Entry; import java.util.TreeMap; +import java.util.logging.Logger; -import com.sk89q.worldedit.Vector; +import static com.google.common.base.Preconditions.checkNotNull; /** - * Reparametrises another interpolation function by arc length.This is done so entities travel at roughly the same speed across + * the whole route.
*/ public class ReparametrisingInterpolation implements Interpolation { + + private static final Logger log = Logger.getLogger(ReparametrisingInterpolation.class.getCanonicalName()); + private final Interpolation baseInterpolation; private double totalArcLength; private final TreeMapRandom
.
+ * Create a new noise generator using the given {@code Random}.
*
* @param random the random instance
*/
@@ -42,7 +42,7 @@ public class RandomNoise implements NoiseGenerator {
}
/**
- * Create a new noise generator with a newly constructed Random
+ * Create a new noise generator with a newly constructed {@code Random}
* instance.
*/
public RandomNoise() {
diff --git a/src/main/java/com/sk89q/worldedit/math/transform/AffineTransform.java b/src/main/java/com/sk89q/worldedit/math/transform/AffineTransform.java
index 3540daa77..3d5fb7186 100644
--- a/src/main/java/com/sk89q/worldedit/math/transform/AffineTransform.java
+++ b/src/main/java/com/sk89q/worldedit/math/transform/AffineTransform.java
@@ -23,27 +23,27 @@ import com.sk89q.worldedit.Vector;
/**
* An affine transform.
- *
- * This class is from the
+ *
+ *
- * {@link #hasNbtData()} must return true if and only if method does not return null.
+ *
+ * {@link #hasNbtData()} must return true if and only if method does not return null.
* * @return compound tag, or null */ @@ -55,7 +55,6 @@ public interface NbtValued { * Set the object's NBT data (tile entity data). * * @param nbtData NBT data, or null if no data - * @throws DataException if possibly the data is invalid */ void setNbtData(@Nullable CompoundTag nbtData);