Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
MetadataStore.java
1 package org.bukkit.metadata;
2 
3 import org.bukkit.plugin.Plugin;
4 
5 import java.util.List;
6 
7 public interface MetadataStore<T> {
8  /**
9  * Adds a metadata value to an object.
10  *
11  * @param subject The object receiving the metadata.
12  * @param metadataKey A unique key to identify this metadata.
13  * @param newMetadataValue The metadata value to apply.
14  * @throws IllegalArgumentException If value is null, or the owning plugin
15  * is null
16  */
17  public void setMetadata(T subject, String metadataKey, MetadataValue newMetadataValue);
18 
19  /**
20  * Returns all metadata values attached to an object. If multiple plugins
21  * have attached metadata, each will value will be included.
22  *
23  * @param subject the object being interrogated.
24  * @param metadataKey the unique metadata key being sought.
25  * @return A list of values, one for each plugin that has set the
26  * requested value.
27  */
28  public List<MetadataValue> getMetadata(T subject, String metadataKey);
29 
30  /**
31  * Tests to see if a metadata attribute has been set on an object.
32  *
33  * @param subject the object upon which the has-metadata test is
34  * performed.
35  * @param metadataKey the unique metadata key being queried.
36  * @return the existence of the metadataKey within subject.
37  */
38  public boolean hasMetadata(T subject, String metadataKey);
39 
40  /**
41  * Removes a metadata item owned by a plugin from a subject.
42  *
43  * @param subject the object to remove the metadata from.
44  * @param metadataKey the unique metadata key identifying the metadata to
45  * remove.
46  * @param owningPlugin the plugin attempting to remove a metadata item.
47  * @throws IllegalArgumentException If plugin is null
48  */
49  public void removeMetadata(T subject, String metadataKey, Plugin owningPlugin);
50 
51  /**
52  * Invalidates all metadata in the metadata store that originates from the
53  * given plugin. Doing this will force each invalidated metadata item to
54  * be recalculated the next time it is accessed.
55  *
56  * @param owningPlugin the plugin requesting the invalidation.
57  * @throws IllegalArgumentException If plugin is null
58  */
59  public void invalidateAll(Plugin owningPlugin);
60 }
void removeMetadata(T subject, String metadataKey, Plugin owningPlugin)
List< MetadataValue > getMetadata(T subject, String metadataKey)
void setMetadata(T subject, String metadataKey, MetadataValue newMetadataValue)
void invalidateAll(Plugin owningPlugin)
boolean hasMetadata(T subject, String metadataKey)