Skip to content

Commit

Permalink
Send page /npc t ext
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Dec 12, 2022
1 parent b78312b commit 505b61d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
12 changes: 3 additions & 9 deletions main/src/main/java/net/citizensnpcs/trait/text/Text.java
Expand Up @@ -10,8 +10,6 @@
import org.bukkit.GameMode;
import org.bukkit.command.CommandSender;
import org.bukkit.conversations.Conversation;
import org.bukkit.conversations.ConversationAbandonedEvent;
import org.bukkit.conversations.ConversationAbandonedListener;
import org.bukkit.conversations.ConversationFactory;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
Expand Down Expand Up @@ -40,7 +38,7 @@
* Persists text metadata, i.e. text that will be said by an NPC on certain triggers.
*/
@TraitName("text")
public class Text extends Trait implements Runnable, Listener, ConversationAbandonedListener {
public class Text extends Trait implements Runnable, Listener {
private final Map<UUID, Long> cooldowns = Maps.newHashMap();
private int currentIndex;
private int delay = -1;
Expand Down Expand Up @@ -68,10 +66,6 @@ public void add(String string) {
text.add(string);
}

@Override
public void conversationAbandoned(ConversationAbandonedEvent event) {
}

/**
* Edit the text at a given index to a new text.
*
Expand All @@ -88,8 +82,8 @@ public void edit(int index, String newText) {
* Builds a text editor in game for the supplied {@link Player}.
*/
public Editor getEditor(final Player player) {
final Conversation conversation = new ConversationFactory(plugin).addConversationAbandonedListener(this)
.withLocalEcho(false).withEscapeSequence("/npc text").withEscapeSequence("exit").withModality(false)
final Conversation conversation = new ConversationFactory(plugin).withLocalEcho(false)
.withEscapeSequence("/npc text").withEscapeSequence("exit").withModality(false)
.withFirstPrompt(new TextBasePrompt(this)).buildConversation(player);
return new Editor() {
@Override
Expand Down
Expand Up @@ -91,7 +91,6 @@ public Prompt acceptInput(ConversationContext context, String original) {
Messaging.sendErrorTr(sender, Messages.TEXT_EDITOR_INVALID_PAGE);
}
context.setSessionData("page", page);
return this;
} catch (NumberFormatException e) {
Messaging.sendErrorTr(sender, Messages.TEXT_EDITOR_INVALID_PAGE);
}
Expand Down

0 comments on commit 505b61d

Please sign in to comment.