mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-21 18:15:32 +01:00
parent
0df7b37529
commit
a070255c0b
@ -76,7 +76,7 @@ public abstract class QuestsNumericPrompt extends NumericPrompt {
|
||||
final Matcher matcher = NUMBER_PATTERN.matcher(ChatColor.stripColor(line));
|
||||
final TextComponent lineComponent = new TextComponent(TextComponent.fromLegacyText(line));
|
||||
if (matcher.find()) {
|
||||
lineComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, matcher.group(1)));
|
||||
lineComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/quests choice " + matcher.group(1)));
|
||||
}
|
||||
if (first) {
|
||||
first = false;
|
||||
|
@ -71,7 +71,7 @@ public abstract class QuestsStringPrompt extends StringPrompt {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
final TextComponent questName = new TextComponent(list.get(i));
|
||||
questName.setColor(ChatColor.AQUA);
|
||||
questName.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, ChatColor.stripColor(list.get(i))));
|
||||
questName.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/quests choice " + ChatColor.stripColor(list.get(i))));
|
||||
component.addExtra(questName);
|
||||
if (i < (list.size() - 1)) {
|
||||
component.addExtra(separator);
|
||||
|
@ -14,6 +14,7 @@ package me.blackvein.quests.commands.quests;
|
||||
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.commands.quests.subcommands.QuestsActionsCommand;
|
||||
import me.blackvein.quests.commands.quests.subcommands.QuestsChoiceCommand;
|
||||
import me.blackvein.quests.commands.quests.subcommands.QuestsConditionsCommand;
|
||||
import me.blackvein.quests.commands.quests.subcommands.QuestsEditorCommand;
|
||||
import me.blackvein.quests.commands.quests.subcommands.QuestsInfoCommand;
|
||||
@ -53,7 +54,8 @@ public class QuestsCommandHandler {
|
||||
new QuestsEditorCommand(plugin),
|
||||
new QuestsActionsCommand(plugin),
|
||||
new QuestsConditionsCommand(plugin),
|
||||
new QuestsInfoCommand(plugin))
|
||||
new QuestsInfoCommand(plugin),
|
||||
new QuestsChoiceCommand())
|
||||
.collect(Collectors.toMap(QuestsSubCommand::getName, Function.identity()));
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,62 @@
|
||||
package me.blackvein.quests.commands.quests.subcommands;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import me.blackvein.quests.commands.QuestsSubCommand;
|
||||
import me.blackvein.quests.util.Lang;
|
||||
|
||||
public class QuestsChoiceCommand extends QuestsSubCommand {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "choice";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNameI18N() {
|
||||
return Lang.get("COMMAND_CHOICE");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return Lang.get("COMMAND_CHOICE_HELP");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPermission() {
|
||||
return "quests.choice";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSyntax() {
|
||||
return "/quests choice";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxArguments() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender cs, String[] args) {
|
||||
if (assertNonPlayer(cs)) {
|
||||
return;
|
||||
}
|
||||
Player player = (Player) cs;
|
||||
if (!cs.hasPermission(getPermission())) {
|
||||
Lang.send(player, ChatColor.RED + Lang.get(player, "noPermission"));
|
||||
return;
|
||||
}
|
||||
if (!player.isConversing()) {
|
||||
Lang.send(player, ChatColor.RED + Lang.get(player, "notConversing"));
|
||||
return;
|
||||
}
|
||||
if (args.length == 1) {
|
||||
return;
|
||||
}
|
||||
player.acceptConversationInput(concatArgArray(args, 1, args.length - 1, ' '));
|
||||
}
|
||||
|
||||
}
|
@ -58,6 +58,9 @@ permissions:
|
||||
quests.journal:
|
||||
description: Toggle the Quest Journal
|
||||
default: true
|
||||
quests.choice:
|
||||
description: Respond to a Quests prompt
|
||||
default: true
|
||||
quests.compass:
|
||||
description: Use a Compass to target quests
|
||||
default: true
|
||||
|
@ -18,6 +18,8 @@ COMMAND_TOP: "top"
|
||||
COMMAND_TOP_HELP: "<command> [number] - View plugin leaderboards"
|
||||
COMMAND_INFO: "info"
|
||||
COMMAND_INFO_HELP: "<command> - View plugin information"
|
||||
COMMAND_CHOICE: "choice"
|
||||
COMMAND_CHOICE_HELP: "<command> <choice> - Make a menu selection"
|
||||
COMMAND_QUEST_HELP: "- View current quest objectives"
|
||||
COMMAND_QUESTINFO_HELP: "[quest] - View information about a quest"
|
||||
COMMAND_QUESTADMIN_HELP: "- Display administrator help"
|
||||
@ -805,4 +807,5 @@ duplicateEditor: "You are already using an editor!"
|
||||
difference: "The difference is '<data>'."
|
||||
notInstalled: "Not installed"
|
||||
confirmDelete: "Are you sure?"
|
||||
updateTo: "Update to <version>: <url>"
|
||||
updateTo: "Update to <version>: <url>"
|
||||
notConversing: "You are not in a conversation!"
|
Loading…
Reference in New Issue
Block a user