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

Data Docs 2.0 #331

Closed
wants to merge 11 commits into from
Closed

Data Docs 2.0 #331

wants to merge 11 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Sep 14, 2015

The first section of the data docs is aimed at people using it for the first time, so explanations may seem overly verbose. It is not my intent to explore every detail and every possiblitity of the Data API but to give an overview and an introduction which enables the user to utilise features relying on the Data API (Items, Blocks, Entities, ...).

This PR is open to feedback regarding the content and code examples; the wording may be subject to change, though suggestions are also welcome.

Last but not least, feel free to list any topics not yet included which in your opinion seem important to have for beginner's docs.

  • Explain how to use keys
  • Explain DataManipulator usage and use cases
  • DataTransactionResult

@ghost ghost self-assigned this Sep 14, 2015
@ghost ghost added the FLARD This is gathering dust label Sep 14, 2015
@ghost ghost added this to the Finish /plugin Pages milestone Sep 14, 2015
@Tzky Tzky added input wanted We would like to hear your opinion needs review The submission is ready and needs to be reviewed and removed needs review The submission is ready and needs to be reviewed labels Sep 14, 2015

public void swapHealth(DataHolder targetA, DataHolder targetB) {
if (targetA.supports(HealthData.class) && targetB.supports(HealthData.class)) {
HealthData healthA = targetA.get(HealthData.class).orNull();
Copy link
Member

Choose a reason for hiding this comment

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

If you have the guarantee, use get() instead of orNull().

@ghost ghost added the needs review The submission is ready and needs to be reviewed label Sep 19, 2015
@ghost ghost changed the title [WIP] Data Docs 2.0 Data Docs 2.0 Sep 19, 2015
@ghost
Copy link
Author

ghost commented Sep 19, 2015

Since this now explains the core features of the Data API, it is best gotten out as soon as possible. Therefore I'll open it up for review and nitpicking, additional stuff (like Serialization) can be included later.

@gabizou Go wild, if you have the time

@ the rest, please help me make sure that these docs are as understandable as they need to be

Property
~~~~~~~~

A property is a read-only point of data. It provides information that is directly derived from its holders type,
Copy link
Contributor

Choose a reason for hiding this comment

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

"holders" --> "holder's"

=======================================

To every data manipulator, there is a matching ``ImmutableDataHolder``. For instance both ``HealthData`` and
``ImmutableHealthData`` contain the same data, only the latter does not provide any means to make alterations to
Copy link
Contributor

Choose a reason for hiding this comment

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

"only" --> "but" (just sounds better to me, you may disagree)

 - Fixed various small problems pointed out by @RobertHerhold
 - use get() instead of getOrNull() for consistency
 - consistency in Code Example heading
@ghost ghost removed the input wanted We would like to hear your opinion label Sep 20, 2015
First we need to check if our target has health data. We do so by first asking it to provide us with its health
data by passing its class to the ``getOrCreate()`` method. We get an ``Optional`` which we can use for our check.
If the target does not support health data, it will be absent. But if the health data is present, it now contains
a mutable copy of the data present on the data holder. We make our alterations and finally offer the changed data
Copy link
Member

Choose a reason for hiding this comment

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

Don't forget to include that if the data is "supported" but not available, it is still created. (the whole point of getOrCreate() versus get()).

 - worked braindump into description of data and properties
 - made descriptions of code examples match the code and vice versa
 - 'value container' -> 'keyed value'
 - several small fixes based on gabizous suggestions
ghost pushed a commit that referenced this pull request Sep 22, 2015
 - Overview / Glossary
 - Value API
 - DataManipulators
 - DataTransactionResults
 - no FLARD
@ghost
Copy link
Author

ghost commented Sep 22, 2015

Squashed and merged in 4dda74c

@ghost ghost closed this Sep 22, 2015
@ghost ghost deleted the saladoc/data branch September 23, 2015 14:11
@Inscrutable Inscrutable removed the needs review The submission is ready and needs to be reviewed label Oct 20, 2015
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FLARD This is gathering dust
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants