T
- The type of property that this store can handlepublic interface PropertyStore<T extends Property<?,?>>
PropertyHolder
such that if a
PropertyHolder
cannot properly provide the Property
instances natively, a PropertyStore
can optionally provide
an "override" or "customized" support of a particular Property
for any variants of PropertyHolder
s.Modifier and Type | Method and Description |
---|---|
Optional<T> |
getFor(Location<World> location)
Gets the desired property for the provided
Location at present
time. |
Optional<T> |
getFor(Location<World> location,
Direction direction)
|
Optional<T> |
getFor(PropertyHolder propertyHolder)
Gets the desired property for the provided
PropertyHolder at
present time. |
int |
getPriority()
Gets the priority of which this
PropertyStore is used for
handling a particular PropertyHolder . |
Optional<T> getFor(PropertyHolder propertyHolder)
PropertyHolder
at
present time. A property may not be the same throughout the course of
the lifetime of the PropertyHolder
.propertyHolder
- The data holder to get a property fromOptional<T> getFor(Location<World> location)
Location
at present
time. A property may not be the same throughout the course of the
lifetime of the Location
.location
- The location of the blockOptional<T> getFor(Location<World> location, Direction direction)
Location
at present
time, in relation to the provided Direction
.location
- The location of the blockdirection
- The direction in relation toint getPriority()
PropertyStore
is used for
handling a particular PropertyHolder
. This is useful for
multiple possible handlers of a Property
being available
in customized PropertyHolder
s.
The priority is a measurement where the higher the priority, the
sooner this PropertyStore
is queried such that if
getFor(PropertyHolder)
is called and returns a present value,
that present value is returned. Usually, Sponge implemented
PropertyStore
s have a priority of 100
.