mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-01-08 09:27:40 +01:00
Update website
This commit is contained in:
parent
2d90f6c867
commit
2afb371099
@ -21,7 +21,7 @@ public class PageChangePrompt extends NumericPrompt {
|
|||||||
Player player = (Player) context.getForWhom();
|
Player player = (Player) context.getForWhom();
|
||||||
if (!text.sendPage(player, input.intValue())) {
|
if (!text.sendPage(player, input.intValue())) {
|
||||||
Messaging.sendErrorTr(player, Messages.TEXT_EDITOR_INVALID_PAGE);
|
Messaging.sendErrorTr(player, Messages.TEXT_EDITOR_INVALID_PAGE);
|
||||||
return new StartPrompt(text);
|
return new TextStartPrompt(text);
|
||||||
}
|
}
|
||||||
return (Prompt) context.getSessionData("previous");
|
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) {
|
public Editor getEditor(final Player player) {
|
||||||
final Conversation conversation = new ConversationFactory(plugin)
|
final Conversation conversation = new ConversationFactory(plugin)
|
||||||
.addConversationAbandonedListener(this).withLocalEcho(false).withEscapeSequence("/npc text")
|
.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);
|
.buildConversation(player);
|
||||||
return new Editor() {
|
return new Editor() {
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ public class TextAddPrompt extends StringPrompt {
|
|||||||
public Prompt acceptInput(ConversationContext context, String input) {
|
public Prompt acceptInput(ConversationContext context, String input) {
|
||||||
text.add(input);
|
text.add(input);
|
||||||
Messaging.sendTr((Player) context.getForWhom(), Messages.TEXT_EDITOR_ADDED_ENTRY, input);
|
Messaging.sendTr((Player) context.getForWhom(), Messages.TEXT_EDITOR_ADDED_ENTRY, input);
|
||||||
return new StartPrompt(text);
|
return new TextStartPrompt(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -22,7 +22,7 @@ public class TextEditPrompt extends StringPrompt {
|
|||||||
text.edit(index, input);
|
text.edit(index, input);
|
||||||
Messaging
|
Messaging
|
||||||
.sendTr((CommandSender) context.getForWhom(), Messages.TEXT_EDITOR_EDITED_TEXT, index, input);
|
.sendTr((CommandSender) context.getForWhom(), Messages.TEXT_EDITOR_EDITED_TEXT, index, input);
|
||||||
return new StartPrompt(text);
|
return new TextStartPrompt(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -22,7 +22,7 @@ public class TextEditStartPrompt extends StringPrompt {
|
|||||||
int index = Integer.parseInt(input);
|
int index = Integer.parseInt(input);
|
||||||
if (!text.hasIndex(index)) {
|
if (!text.hasIndex(index)) {
|
||||||
Messaging.sendErrorTr(player, Messages.TEXT_EDITOR_INVALID_INDEX, index);
|
Messaging.sendErrorTr(player, Messages.TEXT_EDITOR_INVALID_INDEX, index);
|
||||||
return new StartPrompt(text);
|
return new TextStartPrompt(text);
|
||||||
}
|
}
|
||||||
context.setSessionData("index", index);
|
context.setSessionData("index", index);
|
||||||
return new TextEditPrompt(text);
|
return new TextEditPrompt(text);
|
||||||
@ -33,7 +33,7 @@ public class TextEditStartPrompt extends StringPrompt {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Messaging.sendErrorTr(player, Messages.TEXT_EDITOR_INVALID_INPUT);
|
Messaging.sendErrorTr(player, Messages.TEXT_EDITOR_INVALID_INPUT);
|
||||||
return new StartPrompt(text);
|
return new TextStartPrompt(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -22,11 +22,11 @@ public class TextRemovePrompt extends StringPrompt {
|
|||||||
int index = Integer.parseInt(input);
|
int index = Integer.parseInt(input);
|
||||||
if (!text.hasIndex(index)) {
|
if (!text.hasIndex(index)) {
|
||||||
Messaging.sendErrorTr(player, Messages.TEXT_EDITOR_INVALID_INDEX, index);
|
Messaging.sendErrorTr(player, Messages.TEXT_EDITOR_INVALID_INDEX, index);
|
||||||
return new StartPrompt(text);
|
return new TextStartPrompt(text);
|
||||||
}
|
}
|
||||||
text.remove(index);
|
text.remove(index);
|
||||||
Messaging.sendTr(player, Messages.TEXT_EDITOR_REMOVED_ENTRY, index);
|
Messaging.sendTr(player, Messages.TEXT_EDITOR_REMOVED_ENTRY, index);
|
||||||
return new StartPrompt(text);
|
return new TextStartPrompt(text);
|
||||||
} catch (NumberFormatException ex) {
|
} catch (NumberFormatException ex) {
|
||||||
if (input.equalsIgnoreCase("page")) {
|
if (input.equalsIgnoreCase("page")) {
|
||||||
context.setSessionData("previous", this);
|
context.setSessionData("previous", this);
|
||||||
@ -34,7 +34,7 @@ public class TextRemovePrompt extends StringPrompt {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Messaging.sendErrorTr(player, Messages.TEXT_EDITOR_INVALID_INPUT);
|
Messaging.sendErrorTr(player, Messages.TEXT_EDITOR_INVALID_INPUT);
|
||||||
return new StartPrompt(text);
|
return new TextStartPrompt(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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]
|
softdepend: [Vault]
|
||||||
version: 2.0.3
|
version: 2.0.3
|
||||||
main: net.citizensnpcs.Citizens
|
main: net.citizensnpcs.Citizens
|
||||||
website: http://www.citizensnpcs.net
|
website: http://www.citizensnpcs.com
|
||||||
commands:
|
commands:
|
||||||
traitc:
|
traitc:
|
||||||
description: Configures traits
|
description: Configures traits
|
||||||
|
Loading…
Reference in New Issue
Block a user