接口 RegistryAware
- 所有已知子接口:
Art,Attribute,Biome,BlockType,BlockType.Typed<B>,Cat.Type,Chicken.Variant,Cow.Variant,DamageType,Fluid,Frog.Variant,GameRule<T>,ItemType,ItemType.Typed<M>,JukeboxSong,MapCursor.Type,MenuType,MenuType.Typed<V,,B> PatternType,Pig.Variant,Sound,TrimMaterial,TrimPattern,Villager.Profession,Villager.Type,Wolf.Variant,ZombieNautilus.Variant
- 所有已知实现类:
Enchantment,EnchantmentWrapper,EntityType,GameEvent,Material,MemoryKey,MusicInstrument,Particle,PotionEffectType,PotionEffectTypeWrapper,PotionType,Structure,StructureType
public interface RegistryAware
表示类的实例可以注册到服务器并具有关联的键。
- 另请参阅:
-
方法概要
修饰符和类型方法说明获取此实例的键(如果已注册),否则返回null。获取此实例的键(如果已注册),否则抛出错误。boolean返回此实例是否注册在注册表中,因此是否具有键。
-
方法详细资料
-
getKeyOrThrow
获取此实例的键(如果已注册),否则抛出错误。
这是一个便捷方法,插件在使用此方法之前应始终检查isRegistered()。原文:Gets the key of this instance if it is registered otherwise throws an error. This is a convenience method and plugins should always check
isRegistered()before using this method.- 返回:
- 此实例注册时使用的键.
- 抛出:
IllegalStateException- 如果此实例未注册.- 另请参阅:
-
getKeyOrNull
获取此实例的键(如果已注册),否则返回null。原文:Gets the key of this instance if it is registered otherwise returns
null.- 返回:
- 此实例注册时使用的键,如果未注册则返回
null. - 另请参阅:
-
isRegistered
boolean isRegistered()返回此实例是否注册在注册表中,因此是否具有键。原文:Returns whether this instance is register in a registry and therefore has a key or not.
- 返回:
- 如果此实例已注册则返回 true,否则返回 false.
- 另请参阅:
-