-
-
Notifications
You must be signed in to change notification settings - Fork 343
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
src/main/java/org/spongepowered/api/data/DataPerspective.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.spongepowered.api.data; | ||
|
||
import org.spongepowered.api.data.value.ValueContainer; | ||
import org.spongepowered.plugin.PluginContainer; | ||
|
||
public interface DataPerspective { | ||
|
||
Iterable<DataPerspective> perceives(); | ||
|
||
ValueContainer getDataPerception(DataPerspective perspective); | ||
|
||
DataHolder.Mutable createDataPerception(PluginContainer plugin, DataPerspective perspective); | ||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/org/spongepowered/api/data/DataPerspectiveResolver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.spongepowered.api.data; | ||
|
||
import org.checkerframework.checker.nullness.qual.Nullable; | ||
import org.spongepowered.api.data.value.Value; | ||
|
||
public interface DataPerspectiveResolver<V extends Value<E>, E> { | ||
|
||
/** | ||
* Gets the {@link Key} this resolver supports. | ||
* | ||
* @return The key | ||
*/ | ||
Key<V> key(); | ||
|
||
/** | ||
* When multiple plugins provide the same key this is used to | ||
* merge and pick the best. | ||
* | ||
* @return The merged value | ||
*/ | ||
E merge(Iterable<E> values); | ||
|
||
/** | ||
* When data holders value changes when looking at perspective of. | ||
* | ||
* @param dataHolder The data holder which value was overridden. | ||
* @param perspective The perspective it is perceived from. | ||
* @param value The value. | ||
*/ | ||
void apply(DataHolder dataHolder, DataPerspective perspective, @Nullable E value); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters