Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NO MERGE] Contextual Data API #3995

Draft
wants to merge 7 commits into
base: api-11
Choose a base branch
from
Draft

[NO MERGE] Contextual Data API #3995

wants to merge 7 commits into from

Conversation

aromaa
Copy link
Member

@aromaa aromaa commented Apr 23, 2024

Sponge | SpongeAPI

Implemented data directions:

  • Entity -> Entity
  • Entity -> Team
  • Entity -> World
  • Team -> Entity
  • Team -> Team
  • Team -> World
  • World -> Entity
  • World -> Team
  • World -> World

Implemented data operations:

  • offer
  • offerSingle
  • offerAll
  • removeSingle
  • removeAll
  • remove

@aromaa aromaa added api: pending the API is not finished (input wanted, etc.) system: data status: wip Work in progress version: 1.20 API: 11 labels Apr 23, 2024
@Override
public PerspectiveContainer<?, ?> createDataPerception(final DataPerspective perspective) {
return this.perspectives.computeIfAbsent(perspective, p -> {
if (p instanceof final Entity entity) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a bridge to all the perspectives implement that returns the container? Feels cleaner than this if chain that may keep growing over time.

Copy link
Member Author

@aromaa aromaa Apr 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be done but it can also be super confusing because the PerspectiveContainer have different behavior depending on is the entity itself the holder as in ContextualDataHolder or some other type like Team which uses ContextualDataDelegate that propagates the updates differently.

The difference is in the implementation of PerspectiveContainer#offer

@aromaa aromaa changed the title [NO MERGE] Contextual API [NO MERGE] Contextual Data API Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pending the API is not finished (input wanted, etc.) status: wip Work in progress system: data version: 1.20 API: 11
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants