Skip to content

Commit 074bce9

Browse files
committed
feat: expand read-only section
1 parent 76e717a commit 074bce9

File tree

1 file changed

+4
-1
lines changed
  • src/content/docs/paper/dev/api

1 file changed

+4
-1
lines changed

src/content/docs/paper/dev/api/pdc.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,11 @@ container.set(key, UUIDDataType.INSTANCE, uuid);
203203
## Read-only containers
204204
:::note
205205

206-
Certain classes, like `ItemStack` or [`OfflinePlayer`](jd:paper:org.bukkit.OfflinePlayer), provide a read-only view of their PDC.
206+
- Certain classes, like `ItemStack` or [`OfflinePlayer`](jd:paper:org.bukkit.OfflinePlayer), provide a read-only view of their PDC.
207207
In contrast to `ItemStack`, `OfflinePlayer` does <u>not</u> provide any way to modify the underlying container.
208+
- This is because the `OfflinePlayer` is directly read from disk and would require a blocking file operation.
209+
Mutable objects, like the `PersistentDataHolder#getPersistentDataContainer()`, generally need to be re-saved even without modification or monitored.
210+
That's why it's better to use unmodifiable "views" for read-only operations.
208211

209212
:::
210213

0 commit comments

Comments
 (0)