Add merging and matching of parsed BlockData

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot 2018-08-06 14:39:37 +10:00
parent d255faf4af
commit 61df111039

View File

@ -21,6 +21,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.
*