diff --git a/src/main/java/org/kapelle/multiblock/BlockComponent.java b/src/main/java/org/kapelle/multiblock/BlockComponent.java index c8bf6d2..a9870ab 100644 --- a/src/main/java/org/kapelle/multiblock/BlockComponent.java +++ b/src/main/java/org/kapelle/multiblock/BlockComponent.java @@ -8,6 +8,11 @@ import java.util.Collections; import java.util.HashSet; import java.util.Set; +/** + * Represents a single position in a multiblock. + * Can be a single type of block or multiple types. + * Custom valid check functions are supported, + */ public class BlockComponent { private final BlockComponentMode mode; private final Set blocks; diff --git a/src/main/java/org/kapelle/multiblock/ICheckFunction.java b/src/main/java/org/kapelle/multiblock/ICheckFunction.java index cfaddf5..b25baf3 100644 --- a/src/main/java/org/kapelle/multiblock/ICheckFunction.java +++ b/src/main/java/org/kapelle/multiblock/ICheckFunction.java @@ -2,6 +2,9 @@ package org.kapelle.multiblock; import org.bukkit.Location; +/** + * Interface for a custom check function. + */ public interface ICheckFunction { boolean apply(Location location); } diff --git a/src/main/java/org/kapelle/multiblock/MultiblockListener.java b/src/main/java/org/kapelle/multiblock/MultiblockListener.java index 7dc5390..c7de236 100644 --- a/src/main/java/org/kapelle/multiblock/MultiblockListener.java +++ b/src/main/java/org/kapelle/multiblock/MultiblockListener.java @@ -7,6 +7,9 @@ import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.util.BlockVector; +/** + * Listens for block placements and checks if it is part of a the multiblock structure. + */ public abstract class MultiblockListener implements Listener { private final BlockComponent coreBlock; private final BlockVector coreBlockOffset; @@ -31,6 +34,10 @@ public abstract class MultiblockListener implements Listener { } } - abstract void callback(Location coreBlockLocation); + /** + * Gets called on successfully validating a multiblock + * @param coreBlockLocation location of the core block + */ + protected abstract void callback(Location coreBlockLocation); } diff --git a/src/main/java/org/kapelle/multiblock/MultiblockStructure.java b/src/main/java/org/kapelle/multiblock/MultiblockStructure.java index b76dd3b..dc87ba4 100644 --- a/src/main/java/org/kapelle/multiblock/MultiblockStructure.java +++ b/src/main/java/org/kapelle/multiblock/MultiblockStructure.java @@ -5,10 +5,20 @@ import org.bukkit.util.BlockVector; import java.util.List; +/** + * Represents a full multiblock. + * Contains the individual block components. + */ public class MultiblockStructure { List>> structure; + /** + * Create a multiblock structure. + * The format is like this: [y][z][x] + * So you describe the layers from bottom to top. + * @param structure structure in the format: [y][z][x] + */ public MultiblockStructure(List>> structure){ this.structure = structure; } @@ -21,6 +31,12 @@ public class MultiblockStructure { return structure.get(y).get(z).get(x); } + /** + * Checks if the multiblock is valid at the given location. + * @param location Location of a block in a multiblock structure. + * @param offset the offset of the location from <0,0,0> + * @return true if valid + */ public boolean isValid(Location location, BlockVector offset){ for (int y = 0; y < structure.size(); y++) { for (int z = 0; z < structure.get(y).size(); z++) {