refactor: simplify tag
This commit is contained in:
parent
2c7ee30ad2
commit
1216cfbdf5
1 changed files with 3 additions and 4 deletions
|
@ -14,7 +14,7 @@ import java.util.Objects;
|
||||||
|
|
||||||
public class ConversationPrompt extends Prompt {
|
public class ConversationPrompt extends Prompt {
|
||||||
private final ConversationFactory conversationFactory = new ConversationFactory(Nicko.getInstance());
|
private final ConversationFactory conversationFactory = new ConversationFactory(Nicko.getInstance());
|
||||||
private final String identifier;
|
private final String changeBothTag = "changeBoth";
|
||||||
private final Player player;
|
private final Player player;
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
@ -22,7 +22,6 @@ public class ConversationPrompt extends Prompt {
|
||||||
public ConversationPrompt(Player player) {
|
public ConversationPrompt(Player player) {
|
||||||
super(player);
|
super(player);
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.identifier = "nicko-conversation-" + player.getUniqueId();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,7 +33,7 @@ public class ConversationPrompt extends Prompt {
|
||||||
.withModality(false)
|
.withModality(false)
|
||||||
.withFirstPrompt(new ChangeNameConversation())
|
.withFirstPrompt(new ChangeNameConversation())
|
||||||
.withEscapeSequence("EXIT")
|
.withEscapeSequence("EXIT")
|
||||||
.withInitialSessionData(Map.of(identifier, true, identifier + "-both", true))
|
.withInitialSessionData(Map.of(changeBothTag, true))
|
||||||
.withLocalEcho(false)
|
.withLocalEcho(false)
|
||||||
.buildConversation(player)
|
.buildConversation(player)
|
||||||
.begin();
|
.begin();
|
||||||
|
@ -74,7 +73,7 @@ public class ConversationPrompt extends Prompt {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable org.bukkit.conversations.Prompt acceptInput(@NotNull ConversationContext context, @Nullable String input) {
|
public @Nullable org.bukkit.conversations.Prompt acceptInput(@NotNull ConversationContext context, @Nullable String input) {
|
||||||
if (Objects.equals(context.getSessionData(identifier + "-both"), true)) {
|
if (Objects.equals(context.getSessionData(changeBothTag), true)) {
|
||||||
name = input;
|
name = input;
|
||||||
return new ChangeSkinConversation();
|
return new ChangeSkinConversation();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue