| 12345678910111213141516171819202122232425262728293031323334 |
- package cz.davza.studentadventure.Items;
- import cz.davza.studentadventure.base.ItemBase;
- import cz.davza.studentadventure.interfaces.IInteractable;
- import cz.davza.studentadventure.objects.CommandResult;
- import cz.davza.studentadventure.objects.GameData;
- /**
- * A sticky note left in a room, containing a readable message.
- *
- * <p>Interacting with the note prints its contents. Notes are not collectable
- * and stay in the room permanently. Max stack of 1 (each note is unique).</p>
- *
- * <p>Used throughout the world to hint at passwords, lore, and jokes.</p>
- */
- public class StickyNote extends ItemBase implements IInteractable {
- private final String note;
- /**
- * Creates a sticky note with the given message text.
- *
- * @param note the text written on the note
- */
- public StickyNote(String note) {
- super("Sticky Note", "A sticky note with scribbled text. You may be able to just read it", "sticky_note", 1);
- this.note = note;
- }
- /**
- * {@inheritDoc}
- * Prints the note's message to {@code System.out}.
- */
- @Override
- public CommandResult Interact(GameData context) {
- return CommandResult.success("You lean in to read the note. \n It reads: \n " + note + "\n");
- }
- }
|