Skip to content

Commit 223e87c

Browse files
committed
feat: expand read-only section
1 parent 76e717a commit 223e87c

File tree

1 file changed

+3
-0
lines changed
  • src/content/docs/paper/dev/api

1 file changed

+3
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@ container.set(key, UUIDDataType.INSTANCE, uuid);
205205

206206
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)