Package org.bukkit.registry
Interface RegistryAware
- All Known Subinterfaces:
Art
,Attribute
,Biome
,BlockType
,BlockType.Typed<B>
,Cat.Type
,DamageType
,Fluid
,Frog.Variant
,ItemType
,ItemType.Typed<M>
,JukeboxSong
,MapCursor.Type
,MenuType
,MenuType.Typed<V,
,B> PatternType
,Sound
,TrimMaterial
,TrimPattern
,Villager.Profession
,Villager.Type
,Wolf.Variant
- All Known Implementing Classes:
Enchantment
,EnchantmentWrapper
,EntityType
,GameEvent
,Material
,MemoryKey
,MusicInstrument
,Particle
,PotionEffectType
,PotionEffectTypeWrapper
,PotionType
,Structure
,StructureType
public interface RegistryAware
Indicates that instances of a class may be registered to the server and have a key associated with them.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionGets the key of this instance if it is registered otherwise returnsnull
.Gets the key of this instance if it is registered otherwise throws an error.boolean
Returns whether this instance is register in a registry and therefore has a key or not.
-
Method Details
-
getKeyOrThrow
Gets the key of this instance if it is registered otherwise throws an error.
This is a convenience method and plugins should always checkisRegistered()
before using this method.- Returns:
- the key with which this instance is registered.
- Throws:
IllegalStateException
- if this instance is not registered.- See Also:
-
getKeyOrNull
Gets the key of this instance if it is registered otherwise returnsnull
.- Returns:
- the key with which this instance is registered or
null
if not registered. - See Also:
-
isRegistered
boolean isRegistered()Returns whether this instance is register in a registry and therefore has a key or not.- Returns:
- true, if this instance is registered. Otherwise, false.
- See Also:
-