diff --git a/README.md b/README.md index 5ab6879..0beaadf 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ Thirteen craft-persistence tests cover these backend boundaries, including worke ## Paper sheet and recipe definition -`CharacterSheets` renders one Paper sheet from a saved live record, with its current name and the exact offhand instruction. `fantasystick:sheet_version` (integer 1) and `character_id` (UUID string) identify the character, with no owner lock or duplicated progress snapshot. Identification is only a reference: it does not authorize entry or replace saved-state/session validation. Rendering from a dead record is refused. +`CharacterSheets` renders one Paper sheet from a saved live record, with its current name and three separate lore lines: `Character sheet:`, `Place in off hand`, `to enter fantasy world.` Recipe previews and acknowledged crafted sheets use the same layout; existing items are not bulk-rewritten. `fantasystick:sheet_version` (integer 1) and `character_id` (UUID string) identify the character, with no owner lock or duplicated progress snapshot. Identification is only a reference: it does not authorize entry or replace saved-state/session validation. Rendering from a dead record is refused. `CharacterFactory` allocates a fresh UUID and randomized two-part character name when explicitly called. It reuses the progression initializer for zero stats, level 1/zero XP, configured unspent points and full base health, with empty abilities/loadout/cooldowns and no prior death. Name collisions are allowed; identity is independent. Construction and recipe previews do not invoke allocation. Unit tests check fresh defaults/configured arbitrary-precision points, request-time allocation, seeded name variation and same-name/different-ID characters. A native composition test prepares a planned batch through YAML and verifies individually named sheets/IDs after native serialization without consuming or delivering inventory items. The assembled craft-event controller now invokes this allocator only for accepted current attempts. diff --git a/src/main/java/games/dmg/fantasystick/items/CharacterSheets.java b/src/main/java/games/dmg/fantasystick/items/CharacterSheets.java index 25c7a14..ca4c9c9 100644 --- a/src/main/java/games/dmg/fantasystick/items/CharacterSheets.java +++ b/src/main/java/games/dmg/fantasystick/items/CharacterSheets.java @@ -16,7 +16,8 @@ public final class CharacterSheets { public static final NamespacedKey RECIPE = new NamespacedKey("fantasystick", "character_sheet"); private static final NamespacedKey VERSION = new NamespacedKey("fantasystick", "sheet_version"); private static final NamespacedKey CHARACTER = new NamespacedKey("fantasystick", "character_id"); - private static final String INSTRUCTION = "Character sheet: place in off hand to enter fantasy world."; + private static final List INSTRUCTION = List.of(Component.text("Character sheet:"), + Component.text("Place in off hand"), Component.text("to enter fantasy world.")); public ItemStack create(CharacterRecord character) { if (character.dead()) throw new IllegalArgumentException("Dead characters require authoritative revival before sheet creation"); @@ -40,7 +41,7 @@ public final class CharacterSheets { var item = new ItemStack(Material.PAPER); var meta = item.getItemMeta(); meta.displayName(Component.text(name)); - meta.lore(List.of(Component.text(INSTRUCTION))); + meta.lore(INSTRUCTION); item.setItemMeta(meta); return item; } diff --git a/src/nativeTest/java/games/dmg/fantasystick/CharacterSheetsNativeTest.java b/src/nativeTest/java/games/dmg/fantasystick/CharacterSheetsNativeTest.java index eee901d..588ecf8 100644 --- a/src/nativeTest/java/games/dmg/fantasystick/CharacterSheetsNativeTest.java +++ b/src/nativeTest/java/games/dmg/fantasystick/CharacterSheetsNativeTest.java @@ -84,6 +84,8 @@ class CharacterSheetsNativeTest { assertEquals(1, preview.getAmount()); assertTrue(sheets.identify(preview).isEmpty()); assertTrue(preview.getItemMeta().getPersistentDataContainer().isEmpty()); + assertEquals(List.of(Component.text("Character sheet:"), Component.text("Place in off hand"), + Component.text("to enter fantasy world.")), preview.getItemMeta().lore()); } } @@ -104,7 +106,8 @@ class CharacterSheetsNativeTest { assertEquals(Material.PAPER, sheet.getType()); assertEquals(1, sheet.getAmount()); assertEquals(Component.text(record.name()), sheet.getItemMeta().displayName()); - assertEquals(List.of(Component.text("Character sheet: place in off hand to enter fantasy world.")), sheet.getItemMeta().lore()); + assertEquals(List.of(Component.text("Character sheet:"), Component.text("Place in off hand"), + Component.text("to enter fantasy world.")), sheet.getItemMeta().lore()); assertEquals(record.id(), sheets.identify(sheet).orElseThrow()); assertEquals(Set.of(new NamespacedKey("fantasystick", "sheet_version"), new NamespacedKey("fantasystick", "character_id")), sheet.getItemMeta().getPersistentDataContainer().getKeys(), "No player owner, equipment or progress snapshot belongs on the sheet"); diff --git a/src/nativeTest/java/games/dmg/fantasystick/FantasyStickLifecycleNativeTest.java b/src/nativeTest/java/games/dmg/fantasystick/FantasyStickLifecycleNativeTest.java index 7256c9e..06548ed 100644 --- a/src/nativeTest/java/games/dmg/fantasystick/FantasyStickLifecycleNativeTest.java +++ b/src/nativeTest/java/games/dmg/fantasystick/FantasyStickLifecycleNativeTest.java @@ -178,6 +178,9 @@ class FantasyStickLifecycleNativeTest { assertTrue(actor.fixture.view.getCursor().isEmpty()); var complete = fixture.tasks.poll(5, java.util.concurrent.TimeUnit.SECONDS); assertNotNull(complete); complete.run(); + assertEquals(List.of(net.kyori.adventure.text.Component.text("Character sheet:"), + net.kyori.adventure.text.Component.text("Place in off hand"), + net.kyori.adventure.text.Component.text("to enter fantasy world.")), actor.fixture.view.getCursor().getItemMeta().lore()); var id = new CharacterSheets().identify(actor.fixture.view.getCursor()).orElseThrow(); var saved = new games.dmg.fantasystick.persistence.YamlCharacterRepository(directory).load(id).orElseThrow(); assertEquals(new java.math.BigInteger(points), saved.unspentPoints());