From 505b61df179cc64923239d5e5f31395670aadba8 Mon Sep 17 00:00:00 2001 From: fullwall Date: Mon, 12 Dec 2022 23:51:19 +0800 Subject: [PATCH] Send page /npc t ext --- .../main/java/net/citizensnpcs/trait/text/Text.java | 12 +++--------- .../net/citizensnpcs/trait/text/TextBasePrompt.java | 1 - 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/main/src/main/java/net/citizensnpcs/trait/text/Text.java b/main/src/main/java/net/citizensnpcs/trait/text/Text.java index d33cff1a5..4968d7396 100644 --- a/main/src/main/java/net/citizensnpcs/trait/text/Text.java +++ b/main/src/main/java/net/citizensnpcs/trait/text/Text.java @@ -10,8 +10,6 @@ import java.util.concurrent.TimeUnit; 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; @@ -40,7 +38,7 @@ import net.citizensnpcs.util.Util; * 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 cooldowns = Maps.newHashMap(); private int currentIndex; private int delay = -1; @@ -68,10 +66,6 @@ public class Text extends Trait implements Runnable, Listener, ConversationAband text.add(string); } - @Override - public void conversationAbandoned(ConversationAbandonedEvent event) { - } - /** * Edit the text at a given index to a new text. * @@ -88,8 +82,8 @@ public class Text extends Trait implements Runnable, Listener, ConversationAband * 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 diff --git a/main/src/main/java/net/citizensnpcs/trait/text/TextBasePrompt.java b/main/src/main/java/net/citizensnpcs/trait/text/TextBasePrompt.java index b39251060..2124223b7 100644 --- a/main/src/main/java/net/citizensnpcs/trait/text/TextBasePrompt.java +++ b/main/src/main/java/net/citizensnpcs/trait/text/TextBasePrompt.java @@ -91,7 +91,6 @@ public class TextBasePrompt extends StringPrompt { 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); }