diff --git a/prompt-paper/src/main/java/dev/cyr1en/promptpaper/factory/PromptFactory.java b/prompt-paper/src/main/java/dev/cyr1en/promptpaper/factory/PromptFactory.java
index d1c2e2d4..183d7333 100644
--- a/prompt-paper/src/main/java/dev/cyr1en/promptpaper/factory/PromptFactory.java
+++ b/prompt-paper/src/main/java/dev/cyr1en/promptpaper/factory/PromptFactory.java
@@ -198,6 +198,19 @@ public InputScreen create(Player player, PromptDefinition def, DialogCompletionC
return createExpanded(player, presentationExpander.expand(player, def), context);
}
+ /**
+ * Builds the screen for a definition mapped from an inline tag. Inline text is player-authored,
+ * so it goes through {@link PromptPresentationExpander#expandInline} instead of the preset path.
+ */
+ private InputScreen createInline(
+ Player player, PromptDefinition def, DialogCompletionContext context, boolean trustedOrigin) {
+ plugin
+ .getPluginLogger()
+ .debug("PromptFactory.createInline: player=" + player.getName() + " type=" + def.type());
+ return createExpanded(
+ player, presentationExpander.expandInline(player, def, trustedOrigin), context);
+ }
+
/**
* Builds the screen from an already-expanded definition. Never expands again — the public {@link
* #create(Player, PromptDefinition, DialogCompletionContext)} is the only entry point allowed to
@@ -238,14 +251,30 @@ public InputScreen createFromTag(Player player, PromptTag tag) {
*
Other inline tags map the raw tag and materialize it once via {@link
+ * PromptPresentationExpander#expandInline}.
*
+ *
+ * Inline text is typed by the player, so placeholders in it are only resolved for players
+ * holding {@code promptpaper.inline.placeholders} or for a trusted origin (see the four-argument
+ * overload); preset text is always resolved.
*/
public InputScreen createFromTag(Player player, PromptTag tag, DialogCompletionContext context) {
+ return createFromTag(player, tag, context, false);
+ }
+
+ /**
+ * As {@link #createFromTag(Player, PromptTag, DialogCompletionContext)}.
+ *
+ * @param trustedOrigin {@code true} when the command line holding the tag was written by the
+ * console ({@code /consoledelegate}, {@code /playerdelegate}) rather than typed by a player;
+ * placeholders in its inline text are then resolved.
+ */
+ public InputScreen createFromTag(
+ Player player, PromptTag tag, DialogCompletionContext context, boolean trustedOrigin) {
if (tag == null) throw new IllegalArgumentException("PromptTag must not be null");
if (tag.isPreset()) {
// Lookup uses the raw displayText — a PAPI-looking preset id must never be expanded.
@@ -278,12 +307,12 @@ public InputScreen createFromTag(Player player, PromptTag tag, DialogCompletionC
if (isDialog) {
// Expand the presentation-only copy of the tag, then build the dialog screen directly so
// the expanded fields are materialized exactly once.
- var expandedTag = presentationExpander.expandInlineDialog(player, tag);
+ var expandedTag = presentationExpander.expandInlineDialog(player, tag, trustedOrigin);
var dialogScreen = new DialogPromptScreen(plugin, player, expandedTag, promptConfig, context);
return wrapWithTagTitle(player, expandedTag, dialogScreen);
}
var def = InlineTagMapper.toPromptDefinition(tag, mappings);
- return create(player, def, context);
+ return createInline(player, def, context, trustedOrigin);
}
private ChatPromptScreen createChat(Player player, ChatPrompt chat) {
diff --git a/prompt-paper/src/main/java/dev/cyr1en/promptpaper/factory/PromptPresentationExpander.java b/prompt-paper/src/main/java/dev/cyr1en/promptpaper/factory/PromptPresentationExpander.java
index af703144..cfd01608 100644
--- a/prompt-paper/src/main/java/dev/cyr1en/promptpaper/factory/PromptPresentationExpander.java
+++ b/prompt-paper/src/main/java/dev/cyr1en/promptpaper/factory/PromptPresentationExpander.java
@@ -50,6 +50,14 @@
* {@code title.main} / {@code title.sub}.
*
*
+ *
Origin
+ *
+ * Only preset-sourced definitions ({@link #expand}) are sent to the expansion delegate. Inline
+ * tags are written on the command line by the player, so {@link #expandInline} and {@link
+ * #expandInlineDialog} leave their text unexpanded (length-bounded only) unless the player holds
+ * {@value #INLINE_PLACEHOLDER_PERMISSION} or the caller marks the tag as written by the console
+ * ({@code /consoledelegate}, {@code /playerdelegate}).
+ *
*
Never expanded
*
* Preset ids, tag keys, {@code rawTag}, filters, validator aliases, answer types, {@code
@@ -65,6 +73,9 @@ final class PromptPresentationExpander {
static final int MAX_DISPLAY_LENGTH = 1024;
+ /** Opt-in permission that lets a player's own inline prompt text reach the expansion delegate. */
+ static final String INLINE_PLACEHOLDER_PERMISSION = "promptpaper.inline.placeholders";
+
@FunctionalInterface
interface TruncationListener {
void onTruncate(Player player, int originalLength, int maxLength);
@@ -72,6 +83,9 @@ interface TruncationListener {
private final BiFunction expander;
private final TruncationListener truncationListener;
+ // Same length bounding, but text never reaches the expansion delegate. Null on the literal
+ // instance itself.
+ private final PromptPresentationExpander literal;
/**
* @param expander the per-field expansion function (e.g. a PAPI hook). Injected so tests can use
@@ -88,8 +102,19 @@ interface TruncationListener {
*/
PromptPresentationExpander(
BiFunction expander, TruncationListener truncationListener) {
+ this(expander, truncationListener, true);
+ }
+
+ private PromptPresentationExpander(
+ BiFunction expander,
+ TruncationListener truncationListener,
+ boolean withLiteral) {
this.expander = Objects.requireNonNull(expander, "expander");
this.truncationListener = Objects.requireNonNull(truncationListener, "truncationListener");
+ this.literal =
+ withLiteral
+ ? new PromptPresentationExpander((player, text) -> text, truncationListener, false)
+ : null;
}
/**
@@ -121,7 +146,11 @@ static PromptPresentationExpander forPlugin(CommandPrompter plugin) {
});
}
- /** Expands every player-visible presentation field of the definition; semantic fields are raw. */
+ /**
+ * Expands every player-visible presentation field of a preset-sourced definition; semantic
+ * fields are raw. Never pass a definition mapped from an inline tag here — use {@link
+ * #expandInline}.
+ */
PromptDefinition expand(Player player, PromptDefinition raw) {
Objects.requireNonNull(raw, "raw");
return switch (raw) {
@@ -169,15 +198,48 @@ private dev.cyr1en.promptpaper.preset.ConfirmationPrompt expandConfirmation(
confirmation.behavior());
}
+ /**
+ * Materializes a definition mapped from an inline tag. Its text is player-authored, so it is
+ * passed through unexpanded unless the player holds {@value #INLINE_PLACEHOLDER_PERMISSION}.
+ */
+ PromptDefinition expandInline(Player player, PromptDefinition raw) {
+ return expandInline(player, raw, false);
+ }
+
+ /**
+ * @param trustedOrigin {@code true} when the inline tag was written by the console ({@code
+ * /consoledelegate}, {@code /playerdelegate}), not typed by a player; such text is expanded.
+ */
+ PromptDefinition expandInline(Player player, PromptDefinition raw, boolean trustedOrigin) {
+ return forInline(player, trustedOrigin).expand(player, raw);
+ }
+
+ private PromptPresentationExpander forInline(Player player, boolean trustedOrigin) {
+ if (literal == null || trustedOrigin) return this;
+ return player != null && player.hasPermission(INLINE_PLACEHOLDER_PERMISSION) ? this : literal;
+ }
+
/**
* Expands the presentation-only copy of an inline (compound) dialog tag: every sub-tag's {@code
* displayText} (recursively) plus the {@code -t} title config. All parser/semantic components
* ({@code rawTag}, {@code key}, {@code filter}, {@code validatorAlias}, {@code type}, {@code
* sanitize}, {@code preset}) are copied through unchanged.
+ *
+ * The text is player-authored: it only reaches the expansion delegate when the player holds
+ * {@value #INLINE_PLACEHOLDER_PERMISSION}.
*/
PromptTag expandInlineDialog(Player player, PromptTag raw) {
+ return expandInlineDialog(player, raw, false);
+ }
+
+ /** As {@link #expandInlineDialog(Player, PromptTag)}; see {@link #expandInline} for the flag. */
+ PromptTag expandInlineDialog(Player player, PromptTag raw, boolean trustedOrigin) {
Objects.requireNonNull(raw, "raw");
- var subTags = raw.subTags().stream().map(sub -> expandInlineDialog(player, sub)).toList();
+ return forInline(player, trustedOrigin).expandTag(player, raw);
+ }
+
+ private PromptTag expandTag(Player player, PromptTag raw) {
+ var subTags = raw.subTags().stream().map(sub -> expandTag(player, sub)).toList();
return new PromptTag(
raw.rawTag(),
raw.key(),
diff --git a/prompt-paper/src/main/java/dev/cyr1en/promptpaper/screen/ScreenManager.java b/prompt-paper/src/main/java/dev/cyr1en/promptpaper/screen/ScreenManager.java
index 90f300cb..87ca3083 100644
--- a/prompt-paper/src/main/java/dev/cyr1en/promptpaper/screen/ScreenManager.java
+++ b/prompt-paper/src/main/java/dev/cyr1en/promptpaper/screen/ScreenManager.java
@@ -52,6 +52,30 @@ public class ScreenManager {
@FunctionalInterface
public interface ScreenCreator {
InputScreen create(Player player, PromptTag tag, DialogCompletionContext context);
+
+ /**
+ * @param trustedOrigin whether the command line was written by the console ({@code
+ * /consoledelegate}, {@code /playerdelegate}) instead of typed by a player
+ */
+ default InputScreen create(
+ Player player, PromptTag tag, DialogCompletionContext context, boolean trustedOrigin) {
+ return create(player, tag, context);
+ }
+ }
+
+ private static ScreenCreator factoryCreator(PromptFactory factory) {
+ return new ScreenCreator() {
+ @Override
+ public InputScreen create(Player player, PromptTag tag, DialogCompletionContext context) {
+ return factory.createFromTag(player, tag, context);
+ }
+
+ @Override
+ public InputScreen create(
+ Player player, PromptTag tag, DialogCompletionContext context, boolean trustedOrigin) {
+ return factory.createFromTag(player, tag, context, trustedOrigin);
+ }
+ };
}
public enum DispatchMode {
@@ -84,7 +108,8 @@ public enum DispatchMode {
public ScreenManager(
CommandPrompter plugin, PromptEngine engine, PromptFactory factory, Scheduler scheduler) {
- this(plugin, engine, factory, scheduler, factory != null ? factory::createFromTag : null, null);
+ this(
+ plugin, engine, factory, scheduler, factory != null ? factoryCreator(factory) : null, null);
}
public ScreenManager(
@@ -139,7 +164,7 @@ public ScreenManager(
this.factory = factory;
this.scheduler = scheduler;
this.screenCreator =
- screenCreator != null ? screenCreator : (factory != null ? factory::createFromTag : null);
+ screenCreator != null ? screenCreator : (factory != null ? factoryCreator(factory) : null);
this.playerExecutorFactory =
playerExecutorFactory != null
? playerExecutorFactory
@@ -525,10 +550,13 @@ private void showPrompt(Player player, PromptTag tag) {
}
} else {
var context = buildCompletionContext(player, tag);
+ // Both delegate commands are console-only, so the console wrote this command line.
+ var mode = dispatchModes.get(uuid);
+ var trustedOrigin = mode == DispatchMode.CONSOLE || mode == DispatchMode.ATTACHMENT;
screen =
screenCreator != null
- ? screenCreator.create(player, tag, context)
- : factory.createFromTag(player, tag, context);
+ ? screenCreator.create(player, tag, context, trustedOrigin)
+ : factory.createFromTag(player, tag, context, trustedOrigin);
}
if (screen == null) {
diff --git a/prompt-paper/src/main/resources/paper-plugin.yml b/prompt-paper/src/main/resources/paper-plugin.yml
index d4ce5c1b..00966f70 100644
--- a/prompt-paper/src/main/resources/paper-plugin.yml
+++ b/prompt-paper/src/main/resources/paper-plugin.yml
@@ -52,6 +52,9 @@ permissions:
description: Allows using /commandprompter version
promptpaper.use:
description: Allows using prompt features
+ promptpaper.inline.placeholders:
+ description: Resolves PlaceholderAPI placeholders in inline prompt text typed by the player
+ default: false
promptpaper.consoledelegate:
description: Allows using /consoledelegate
promptpaper.playerdelegate:
diff --git a/prompt-paper/src/test/java/dev/cyr1en/promptpaper/engine/ScreenManagerTest.java b/prompt-paper/src/test/java/dev/cyr1en/promptpaper/engine/ScreenManagerTest.java
index 8dfa3b0e..3d8628b6 100644
--- a/prompt-paper/src/test/java/dev/cyr1en/promptpaper/engine/ScreenManagerTest.java
+++ b/prompt-paper/src/test/java/dev/cyr1en/promptpaper/engine/ScreenManagerTest.java
@@ -146,6 +146,40 @@ void startDelegatedSessionWithPromptsCreatesScreen() {
assertTrue(screenManager.hasActiveScreen(player));
}
+ @Test
+ void onlyDelegatedInlineTagsAreCreatedWithTrustedOrigin() {
+ var origins = new java.util.ArrayList();
+ var recording =
+ new ScreenManager.ScreenCreator() {
+ @Override
+ public dev.cyr1en.promptui.InputScreen create(
+ Player p,
+ dev.cyr1en.promptcore.PromptTag tag,
+ dev.cyr1en.promptpaper.screen.dialog.DialogCompletionContext context) {
+ return factory.createFromTag(p, tag, context);
+ }
+
+ @Override
+ public dev.cyr1en.promptui.InputScreen create(
+ Player p,
+ dev.cyr1en.promptcore.PromptTag tag,
+ dev.cyr1en.promptpaper.screen.dialog.DialogCompletionContext context,
+ boolean trustedOrigin) {
+ origins.add(trustedOrigin);
+ return factory.createFromTag(p, tag, context, trustedOrigin);
+ }
+ };
+ var manager = new ScreenManager(plugin, engine, factory, scheduler, recording, null);
+
+ manager.startDelegatedSession(
+ createPlayer(), "/cmd ", ScreenManager.DispatchMode.CONSOLE, null);
+ manager.startSession(createPlayer(), "/cmd ");
+ manager.startDelegatedSession(
+ createPlayer(), "/cmd ", ScreenManager.DispatchMode.ATTACHMENT, "some.key");
+
+ assertEquals(java.util.List.of(true, false, true), origins);
+ }
+
@Test
void handleChatInputProcessesAnswer() {
var player = createPlayer();
@@ -489,7 +523,7 @@ void presetDialogWithTabCompletionBuildsCompletionContext() {
java.util.Map.of()));
var dummyScreen = org.mockito.Mockito.mock(dev.cyr1en.promptui.InputScreen.class);
- when(mockFactory.createFromTag(any(Player.class), any(PromptTag.class), any()))
+ when(mockFactory.createFromTag(any(Player.class), any(PromptTag.class), any(), eq(false)))
.thenReturn(dummyScreen);
var player = createPlayer();
@@ -498,7 +532,8 @@ void presetDialogWithTabCompletionBuildsCompletionContext() {
var captor =
org.mockito.ArgumentCaptor.forClass(
dev.cyr1en.promptpaper.screen.dialog.DialogCompletionContext.class);
- verify(mockFactory).createFromTag(eq(player), any(PromptTag.class), captor.capture());
+ verify(mockFactory)
+ .createFromTag(eq(player), any(PromptTag.class), captor.capture(), eq(false));
assertNotNull(captor.getValue());
assertEquals("/cmd ", captor.getValue().partialCommand());
@@ -529,7 +564,7 @@ void presetDialogWithoutTabCompletionPassesNullContext() {
when(registry.getPrompt("my_conf_preset")).thenReturn(java.util.Optional.of(dialog));
var dummyScreen = org.mockito.Mockito.mock(dev.cyr1en.promptui.InputScreen.class);
- when(mockFactory.createFromTag(any(Player.class), any(PromptTag.class), any()))
+ when(mockFactory.createFromTag(any(Player.class), any(PromptTag.class), any(), eq(false)))
.thenReturn(dummyScreen);
var player = createPlayer();
@@ -538,7 +573,8 @@ void presetDialogWithoutTabCompletionPassesNullContext() {
var captor =
org.mockito.ArgumentCaptor.forClass(
dev.cyr1en.promptpaper.screen.dialog.DialogCompletionContext.class);
- verify(mockFactory).createFromTag(eq(player), any(PromptTag.class), captor.capture());
+ verify(mockFactory)
+ .createFromTag(eq(player), any(PromptTag.class), captor.capture(), eq(false));
assertNull(captor.getValue());
}
diff --git a/prompt-paper/src/test/java/dev/cyr1en/promptpaper/factory/PromptFactoryTest.java b/prompt-paper/src/test/java/dev/cyr1en/promptpaper/factory/PromptFactoryTest.java
index 50bebe7e..7163c4b1 100644
--- a/prompt-paper/src/test/java/dev/cyr1en/promptpaper/factory/PromptFactoryTest.java
+++ b/prompt-paper/src/test/java/dev/cyr1en/promptpaper/factory/PromptFactoryTest.java
@@ -814,18 +814,44 @@ void emptyTitleMainIsPreservedAndFallbackUsesExpandedPromptTextOnce() {
}
/**
- * A non-dialog inline tag flows through {@link InlineTagMapper} on the raw tag and then {@link
- * PromptFactory#create}, so the display text is expanded exactly once (never twice by the mapper
- * and the factory).
+ * Inline tag text is typed by the player, so neither the mapped (non-dialog) path nor the inline
+ * dialog path may send it to the expansion delegate.
*/
@Test
- void inlineTagDisplayTextIsExpandedExactlyOnce() {
+ void inlineTagDisplayTextNeverReachesExpander() {
+ List expanded = new ArrayList<>();
+ var testFactory = factoryWithExpander(expanded);
+
+ var anvil = new PromptTag("", "a", null, "Enter %player_name%");
+ assertInstanceOf(AnvilPromptScreen.class, testFactory.createFromTag(createPlayer(), anvil));
+
+ var dialog = new PromptTag("", "d", "text", "Enter %player_name%");
+ try {
+ testFactory.createFromTag(createPlayer("Other"), dialog);
+ } catch (NoClassDefFoundError ignored) {
+ // Paper's dialog API is absent from the test classpath; the tag is materialized before the
+ // dialog screen is constructed, so the assertion below still covers the dialog path.
+ }
+
+ assertTrue(expanded.isEmpty(), "inline text reached the expander: " + expanded);
+ }
+
+ /**
+ * With the opt-in permission, a non-dialog inline tag flows through {@link InlineTagMapper} on
+ * the raw tag and is expanded exactly once (never twice by the mapper and the factory).
+ */
+ @Test
+ void inlineTagDisplayTextIsExpandedExactlyOnceWithOptInPermission() {
var tag = new PromptTag("", "a", null, "Enter %player_name%");
List expanded = new ArrayList<>();
var testFactory = factoryWithExpander(expanded);
+ var player = createPlayer();
+ player
+ .addAttachment(plugin)
+ .setPermission(PromptPresentationExpander.INLINE_PLACEHOLDER_PERMISSION, true);
- var screen = testFactory.createFromTag(createPlayer(), tag);
+ var screen = testFactory.createFromTag(player, tag);
assertInstanceOf(AnvilPromptScreen.class, screen);
assertEquals(1, Collections.frequency(expanded, "Enter %player_name%"));
diff --git a/prompt-paper/src/test/java/dev/cyr1en/promptpaper/factory/PromptPresentationExpanderTest.java b/prompt-paper/src/test/java/dev/cyr1en/promptpaper/factory/PromptPresentationExpanderTest.java
index e8132929..9e954140 100644
--- a/prompt-paper/src/test/java/dev/cyr1en/promptpaper/factory/PromptPresentationExpanderTest.java
+++ b/prompt-paper/src/test/java/dev/cyr1en/promptpaper/factory/PromptPresentationExpanderTest.java
@@ -6,6 +6,7 @@
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
import com.google.gson.JsonPrimitive;
import dev.cyr1en.promptcore.PromptTag;
@@ -27,6 +28,7 @@
import dev.cyr1en.promptpaper.preset.PromptDefinition;
import dev.cyr1en.promptpaper.preset.SignPrompt;
import dev.cyr1en.promptpaper.preset.UIButton;
+import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
@@ -319,8 +321,123 @@ void dialogPreservesNullBaseAndNullActions() {
// Inline (compound) dialog tags
// ------------------------------------------------------------------
+ private void grantInlinePlaceholders() {
+ when(player.hasPermission(PromptPresentationExpander.INLINE_PLACEHOLDER_PERMISSION))
+ .thenReturn(true);
+ }
+
+ @Test
+ void consoleAuthoredInlineTagIsExpandedWithoutRecipientPermission() {
+ var recording = new PromptPresentationExpander((p, value) -> "[" + value + "]");
+ var tag =
+ new PromptTag(
+ "",
+ "a",
+ null,
+ "%player_name%",
+ true,
+ null,
+ PromptTag.AnswerType.NONE,
+ List.of(),
+ false,
+ null);
+
+ var inline =
+ (AnvilPrompt) recording.expandInline(player, InlineTagMapper.toPromptDefinition(tag), true);
+ var inlineDialog = recording.expandInlineDialog(player, tag, true);
+
+ assertEquals("[%player_name%]", inline.promptText());
+ assertEquals("[%player_name%]", inlineDialog.displayText());
+ }
+
+ @Test
+ void inlineTagNeverReachesDelegateButPresetDefinitionStillDoes() {
+ var calls = new ArrayList();
+ var recording =
+ new PromptPresentationExpander(
+ (p, value) -> {
+ calls.add(value);
+ return "[" + value + "]";
+ });
+ var tag =
+ new PromptTag(
+ "",
+ "a",
+ null,
+ "%player_name%",
+ true,
+ null,
+ PromptTag.AnswerType.NONE,
+ List.of(),
+ false,
+ new TitleConfig("%server_name%", "%player_uuid%", 20));
+
+ var inline =
+ (AnvilPrompt) recording.expandInline(player, InlineTagMapper.toPromptDefinition(tag));
+ var inlineDialog = recording.expandInlineDialog(player, tag);
+
+ assertEquals("%player_name%", inline.promptText());
+ assertEquals("%server_name%", inline.titleDisplay().main());
+ assertEquals("%player_uuid%", inline.titleDisplay().sub());
+ assertEquals("%player_name%", inlineDialog.displayText());
+ assertEquals("%server_name%", inlineDialog.title().main());
+ assertTrue(calls.isEmpty(), "inline text must never reach the expansion delegate: " + calls);
+
+ var preset =
+ (ChatPrompt)
+ recording.expand(
+ player,
+ new ChatPrompt(
+ "chat", "p", "%player_name%", new CancelBehavior(false, "", false, ""), true));
+
+ assertEquals("[%player_name%]", preset.promptText());
+ assertEquals(List.of("%player_name%"), calls);
+ }
+
+ @Test
+ void inlineCompoundSubTagsNeverReachDelegate() {
+ var calls = new ArrayList();
+ var recording =
+ new PromptPresentationExpander(
+ (p, value) -> {
+ calls.add(value);
+ return "[" + value + "]";
+ });
+ var row = new PromptTag("", "d", "text", "%player_name%");
+ var block =
+ new PromptTag(
+ "",
+ "d", null, "", true, null, PromptTag.AnswerType.NONE, List.of(row), false);
+
+ var out = recording.expandInlineDialog(player, block);
+
+ assertEquals("%player_name%", out.subTags().get(0).displayText());
+ assertTrue(calls.isEmpty());
+ }
+
+ @Test
+ void inlineTagIsExpandedForPlayersHoldingTheOptInPermission() {
+ grantInlinePlaceholders();
+ var tag = new PromptTag("", "a", null, "%player_name%");
+
+ var out = (AnvilPrompt) expander.expandInline(player, InlineTagMapper.toPromptDefinition(tag));
+
+ assertEquals("[%player_name%]", out.promptText());
+ }
+
+ @Test
+ void unexpandedInlineTextIsStillLengthBounded() {
+ var text = "x".repeat(PromptPresentationExpander.MAX_DISPLAY_LENGTH + 10);
+ var tag = new PromptTag("", "a", null, text);
+
+ var out = (AnvilPrompt) expander.expandInline(player, InlineTagMapper.toPromptDefinition(tag));
+
+ assertEquals(PromptPresentationExpander.MAX_DISPLAY_LENGTH, out.promptText().length());
+ }
+
@Test
void inlineDialogExpandsEverySubTagDisplayTextAndTitle() {
+ grantInlinePlaceholders();
var titleRow = new PromptTag("", "d", "title", "Header %a%");
var bodyRow = new PromptTag("", "d", "body", "Note %b%");
var textRow = new PromptTag("", "d", "text", "Enter %c%");
@@ -434,6 +551,7 @@ void itemExpandsPresentationFieldsExactlyOnce() {
@Test
void inlineDialogWithoutTitleConfigKeepsNullTitle() {
+ grantInlinePlaceholders();
var tag = new PromptTag("", "d", "text", "Enter %a%");
var out = expander.expandInlineDialog(player, tag);
assertEquals("[Enter %a%]", out.displayText());
@@ -443,6 +561,7 @@ void inlineDialogWithoutTitleConfigKeepsNullTitle() {
@Test
void inlineDialogEmptyMainIsPreservedForFactoryFallback() {
+ grantInlinePlaceholders();
var tag =
new PromptTag(
"",