feat: specify if prompt is about name or skin change
This commit is contained in:
parent
1646488316
commit
b908e0562f
1 changed files with 10 additions and 4 deletions
|
@ -37,7 +37,7 @@ public class ConversationPrompt extends Prompt {
|
||||||
conversationFactory
|
conversationFactory
|
||||||
.thatExcludesNonPlayersWithMessage("Player only")
|
.thatExcludesNonPlayersWithMessage("Player only")
|
||||||
.withTimeout(30)
|
.withTimeout(30)
|
||||||
.withFirstPrompt(new NickoConversation(player, playerLanguage))
|
.withFirstPrompt(new ChangeAppearanceConversation(player, playerLanguage))
|
||||||
.withInitialSessionData(Map.of(identifier, true, identifier + "-skin", true))
|
.withInitialSessionData(Map.of(identifier, true, identifier + "-skin", true))
|
||||||
.withLocalEcho(false)
|
.withLocalEcho(false)
|
||||||
.buildConversation(player)
|
.buildConversation(player)
|
||||||
|
@ -48,11 +48,11 @@ public class ConversationPrompt extends Prompt {
|
||||||
public void displayNamePrompt() {
|
public void displayNamePrompt() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private class NickoConversation extends StringPrompt {
|
private class ChangeAppearanceConversation extends StringPrompt {
|
||||||
private final Player player;
|
private final Player player;
|
||||||
private final PlayerLanguage playerLanguage;
|
private final PlayerLanguage playerLanguage;
|
||||||
|
|
||||||
public NickoConversation(Player player, PlayerLanguage playerLanguage) {
|
public ChangeAppearanceConversation(Player player, PlayerLanguage playerLanguage) {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.playerLanguage = playerLanguage;
|
this.playerLanguage = playerLanguage;
|
||||||
|
|
||||||
|
@ -60,7 +60,13 @@ public class ConversationPrompt extends Prompt {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull String getPromptText(@NotNull ConversationContext context) {
|
public @NotNull String getPromptText(@NotNull ConversationContext context) {
|
||||||
return "Enter your skin";
|
|
||||||
|
if (Objects.equals(context.getSessionData(identifier + "-skin"), true)) {
|
||||||
|
// If changing skin
|
||||||
|
return "Enter your new skin";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "Enter your new name";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue