mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-01-02 14:38:19 +01:00
Update website
This commit is contained in:
parent
5cbc8b7c15
commit
c81e2c1035
@ -21,7 +21,7 @@ public class PageChangePrompt extends NumericPrompt {
|
||||
Player player = (Player) context.getForWhom();
|
||||
if (!text.sendPage(player, input.intValue())) {
|
||||
Messaging.sendErrorTr(player, Messages.TEXT_EDITOR_INVALID_PAGE);
|
||||
return new StartPrompt(text);
|
||||
return new TextStartPrompt(text);
|
||||
}
|
||||
return (Prompt) context.getSessionData("previous");
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public class Text extends Trait implements Runnable, Toggleable, Listener, Conve
|
||||
public Editor getEditor(final Player player) {
|
||||
final Conversation conversation = new ConversationFactory(plugin)
|
||||
.addConversationAbandonedListener(this).withLocalEcho(false).withEscapeSequence("/npc text")
|
||||
.withEscapeSequence("exit").withModality(false).withFirstPrompt(new StartPrompt(this))
|
||||
.withEscapeSequence("exit").withModality(false).withFirstPrompt(new TextStartPrompt(this))
|
||||
.buildConversation(player);
|
||||
return new Editor() {
|
||||
|
||||
|
@ -20,7 +20,7 @@ public class TextAddPrompt extends StringPrompt {
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
text.add(input);
|
||||
Messaging.sendTr((Player) context.getForWhom(), Messages.TEXT_EDITOR_ADDED_ENTRY, input);
|
||||
return new StartPrompt(text);
|
||||
return new TextStartPrompt(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,7 +22,7 @@ public class TextEditPrompt extends StringPrompt {
|
||||
text.edit(index, input);
|
||||
Messaging
|
||||
.sendTr((CommandSender) context.getForWhom(), Messages.TEXT_EDITOR_EDITED_TEXT, index, input);
|
||||
return new StartPrompt(text);
|
||||
return new TextStartPrompt(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,7 +22,7 @@ public class TextEditStartPrompt extends StringPrompt {
|
||||
int index = Integer.parseInt(input);
|
||||
if (!text.hasIndex(index)) {
|
||||
Messaging.sendErrorTr(player, Messages.TEXT_EDITOR_INVALID_INDEX, index);
|
||||
return new StartPrompt(text);
|
||||
return new TextStartPrompt(text);
|
||||
}
|
||||
context.setSessionData("index", index);
|
||||
return new TextEditPrompt(text);
|
||||
@ -33,7 +33,7 @@ public class TextEditStartPrompt extends StringPrompt {
|
||||
}
|
||||
}
|
||||
Messaging.sendErrorTr(player, Messages.TEXT_EDITOR_INVALID_INPUT);
|
||||
return new StartPrompt(text);
|
||||
return new TextStartPrompt(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,11 +22,11 @@ public class TextRemovePrompt extends StringPrompt {
|
||||
int index = Integer.parseInt(input);
|
||||
if (!text.hasIndex(index)) {
|
||||
Messaging.sendErrorTr(player, Messages.TEXT_EDITOR_INVALID_INDEX, index);
|
||||
return new StartPrompt(text);
|
||||
return new TextStartPrompt(text);
|
||||
}
|
||||
text.remove(index);
|
||||
Messaging.sendTr(player, Messages.TEXT_EDITOR_REMOVED_ENTRY, index);
|
||||
return new StartPrompt(text);
|
||||
return new TextStartPrompt(text);
|
||||
} catch (NumberFormatException ex) {
|
||||
if (input.equalsIgnoreCase("page")) {
|
||||
context.setSessionData("previous", this);
|
||||
@ -34,7 +34,7 @@ public class TextRemovePrompt extends StringPrompt {
|
||||
}
|
||||
}
|
||||
Messaging.sendErrorTr(player, Messages.TEXT_EDITOR_INVALID_INPUT);
|
||||
return new StartPrompt(text);
|
||||
return new TextStartPrompt(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,53 @@
|
||||
package net.citizensnpcs.trait.text;
|
||||
|
||||
import net.citizensnpcs.util.Messages;
|
||||
import net.citizensnpcs.util.Messaging;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.conversations.Prompt;
|
||||
import org.bukkit.conversations.StringPrompt;
|
||||
|
||||
public class TextStartPrompt extends StringPrompt {
|
||||
private final Text text;
|
||||
|
||||
public TextStartPrompt(Text text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
input = ChatColor.stripColor(input.trim().split(" ")[0]);
|
||||
CommandSender sender = (CommandSender) context.getForWhom();
|
||||
if (input.equalsIgnoreCase("add"))
|
||||
return new TextAddPrompt(text);
|
||||
else if (input.equalsIgnoreCase("edit"))
|
||||
return new TextEditStartPrompt(text);
|
||||
else if (input.equalsIgnoreCase("remove"))
|
||||
return new TextRemovePrompt(text);
|
||||
else if (input.equalsIgnoreCase("random"))
|
||||
Messaging.sendTr(sender, Messages.TEXT_EDITOR_RANDOM_TALKER_SET, text.toggleRandomTalker());
|
||||
else if (input.equalsIgnoreCase("realistic looking"))
|
||||
Messaging.sendTr(sender, Messages.TEXT_EDITOR_REALISTIC_LOOKING_SET,
|
||||
text.toggleRealisticLooking());
|
||||
else if (input.equalsIgnoreCase("close"))
|
||||
Messaging.sendTr(sender, Messages.TEXT_EDITOR_CLOSE_TALKER_SET, text.toggle());
|
||||
else if (input.equalsIgnoreCase("help")) {
|
||||
context.setSessionData("said-text", false);
|
||||
Messaging.send(sender, getPromptText(context));
|
||||
} else
|
||||
Messaging.sendErrorTr(sender, Messages.TEXT_EDITOR_INVALID_EDIT_TYPE);
|
||||
|
||||
return new TextStartPrompt(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
if (context.getSessionData("said-text") == Boolean.TRUE)
|
||||
return "";
|
||||
String text = Messaging.tr(Messages.TEXT_EDITOR_START_PROMPT);
|
||||
context.setSessionData("said-text", Boolean.TRUE);
|
||||
return text;
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@ authors: [aPunch, fullwall]
|
||||
softdepend: [Vault]
|
||||
version: 2.0.3
|
||||
main: net.citizensnpcs.Citizens
|
||||
website: http://www.citizensnpcs.net
|
||||
website: http://www.citizensnpcs.com
|
||||
commands:
|
||||
traitc:
|
||||
description: Configures traits
|
||||
|
Loading…
Reference in New Issue
Block a user