mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-02-03 05:51:42 +01:00
Send page /npc t ext
This commit is contained in:
parent
b78312b8f0
commit
505b61df17
@ -10,8 +10,6 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.conversations.Conversation;
|
import org.bukkit.conversations.Conversation;
|
||||||
import org.bukkit.conversations.ConversationAbandonedEvent;
|
|
||||||
import org.bukkit.conversations.ConversationAbandonedListener;
|
|
||||||
import org.bukkit.conversations.ConversationFactory;
|
import org.bukkit.conversations.ConversationFactory;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
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.
|
* Persists text metadata, i.e. text that will be said by an NPC on certain triggers.
|
||||||
*/
|
*/
|
||||||
@TraitName("text")
|
@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 final Map<UUID, Long> cooldowns = Maps.newHashMap();
|
||||||
private int currentIndex;
|
private int currentIndex;
|
||||||
private int delay = -1;
|
private int delay = -1;
|
||||||
@ -68,10 +66,6 @@ public class Text extends Trait implements Runnable, Listener, ConversationAband
|
|||||||
text.add(string);
|
text.add(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void conversationAbandoned(ConversationAbandonedEvent event) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edit the text at a given index to a new text.
|
* 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}.
|
* Builds a text editor in game for the supplied {@link Player}.
|
||||||
*/
|
*/
|
||||||
public Editor getEditor(final Player player) {
|
public Editor getEditor(final Player player) {
|
||||||
final Conversation conversation = new ConversationFactory(plugin).addConversationAbandonedListener(this)
|
final Conversation conversation = new ConversationFactory(plugin).withLocalEcho(false)
|
||||||
.withLocalEcho(false).withEscapeSequence("/npc text").withEscapeSequence("exit").withModality(false)
|
.withEscapeSequence("/npc text").withEscapeSequence("exit").withModality(false)
|
||||||
.withFirstPrompt(new TextBasePrompt(this)).buildConversation(player);
|
.withFirstPrompt(new TextBasePrompt(this)).buildConversation(player);
|
||||||
return new Editor() {
|
return new Editor() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -91,7 +91,6 @@ public class TextBasePrompt extends StringPrompt {
|
|||||||
Messaging.sendErrorTr(sender, Messages.TEXT_EDITOR_INVALID_PAGE);
|
Messaging.sendErrorTr(sender, Messages.TEXT_EDITOR_INVALID_PAGE);
|
||||||
}
|
}
|
||||||
context.setSessionData("page", page);
|
context.setSessionData("page", page);
|
||||||
return this;
|
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
Messaging.sendErrorTr(sender, Messages.TEXT_EDITOR_INVALID_PAGE);
|
Messaging.sendErrorTr(sender, Messages.TEXT_EDITOR_INVALID_PAGE);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user