From 97d31e64a5e4206b4c191f1d313d7c5fc5db88e4 Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 6 Aug 2018 14:39:37 +1000 Subject: Add merging and matching of parsed BlockData --- src/main/java/org/bukkit/block/data/BlockData.java | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src/main') 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 @@ -21,6 +21,41 @@ public interface BlockData extends Cloneable { */ String getAsString(); + /** + * Merges all explicitly set states from the given data with this BlockData. + *
+ * 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. + *
+ * 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. + *
+ * 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. + *
+ * Note that these semantics mean that a.matches(b) may not be the same + * as b.matches(a) + * + * @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. * -- cgit v1.2.3