summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2018-08-06 14:39:37 +1000
committermd_5 <git@md-5.net>2018-08-06 14:44:55 +1000
commit97d31e64a5e4206b4c191f1d313d7c5fc5db88e4 (patch)
treeecdf0b67240374918fdb1174ec2bdf53ea321d9a
parentd2834556b1032e98f2ff3125340e792bf19b0ec1 (diff)
downloadbukkit-97d31e64a5e4206b4c191f1d313d7c5fc5db88e4.tar
bukkit-97d31e64a5e4206b4c191f1d313d7c5fc5db88e4.tar.gz
bukkit-97d31e64a5e4206b4c191f1d313d7c5fc5db88e4.tar.lz
bukkit-97d31e64a5e4206b4c191f1d313d7c5fc5db88e4.tar.xz
bukkit-97d31e64a5e4206b4c191f1d313d7c5fc5db88e4.zip
Add merging and matching of parsed BlockData
-rw-r--r--src/main/java/org/bukkit/block/data/BlockData.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/block/data/BlockData.java b/src/main/java/org/bukkit/block/data/BlockData.java
index b3e13733..3f64c741 100644
--- a/src/main/java/org/bukkit/block/data/BlockData.java
+++ b/src/main/java/org/bukkit/block/data/BlockData.java
@@ -22,6 +22,41 @@ public interface BlockData extends Cloneable {
String getAsString();
/**
+ * Merges all explicitly set states from the given data with this BlockData.
+ * <br>
+ * Note that the given data MUST have been created from one of the String
+ * parse methods, e.g. {@link Server#createBlockData(java.lang.String)} and
+ * not have been subsequently modified.
+ * <br>
+ * Note also that the block types must match identically.
+ *
+ * @param data the data to merge from
+ * @return a new instance of this blockdata with the merged data
+ * @deprecated draft API
+ */
+ @Deprecated
+ BlockData merge(BlockData data);
+
+ /**
+ * Checks if the specified BlockData matches this block data.
+ * <br>
+ * The semantics of this method are such that for manually created or
+ * modified BlockData it has the same effect as
+ * {@link Object#equals(java.lang.Object)}, whilst for parsed data (that to
+ * which {@link #merge(org.bukkit.block.data.BlockData)} applies, it will
+ * return true when the type and all explicitly set states match.
+ * <br>
+ * <b>Note that these semantics mean that a.matches(b) may not be the same
+ * as b.matches(a)</b>
+ *
+ * @param data the data to match against (normally a parsed constant)
+ * @return if there is a match
+ * @deprecated draft API
+ */
+ @Deprecated
+ boolean matches(BlockData data);
+
+ /**
* Returns a copy of this BlockData.
*
* @return a copy of the block data