mirror of https://github.com/PikaMug/Quests.git
Re-add more clickable prompts, fixes #2032
This commit is contained in:
parent
a28e94813d
commit
ee45d26a5a
|
@ -162,7 +162,7 @@ public class NpcOfferQuestPrompt extends MiscStringPrompt {
|
||||||
for (int i = 1; i <= size + 1; i++) {
|
for (int i = 1; i <= size + 1; i++) {
|
||||||
final TextComponent choice = new TextComponent("\n" + getNumberColor(context, i) + ChatColor.BOLD + i + ". "
|
final TextComponent choice = new TextComponent("\n" + getNumberColor(context, i) + ChatColor.BOLD + i + ". "
|
||||||
+ ChatColor.RESET + getSelectionText(context, i));
|
+ ChatColor.RESET + getSelectionText(context, i));
|
||||||
choice.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, String.valueOf(i)));
|
choice.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/quests choice " + String.valueOf(i)));
|
||||||
if (plugin.getSettings().canShowQuestReqs() && i <= size) {
|
if (plugin.getSettings().canShowQuestReqs() && i <= size) {
|
||||||
choice.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
|
choice.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
|
||||||
new ComponentBuilder(quests.get(i - 1).getDescription()).create()));
|
new ComponentBuilder(quests.get(i - 1).getDescription()).create()));
|
||||||
|
|
|
@ -80,11 +80,11 @@ public class QuestAbandonPrompt extends MiscStringPrompt {
|
||||||
final TextComponent component = new TextComponent("");
|
final TextComponent component = new TextComponent("");
|
||||||
component.addExtra(ChatColor.YELLOW + getQueryText(context) + " " + ChatColor.GREEN);
|
component.addExtra(ChatColor.YELLOW + getQueryText(context) + " " + ChatColor.GREEN);
|
||||||
final TextComponent yes = new TextComponent(getSelectionText(context, 1));
|
final TextComponent yes = new TextComponent(getSelectionText(context, 1));
|
||||||
yes.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, Lang.get("yesWord")));
|
yes.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/quests choice " + Lang.get("yesWord")));
|
||||||
component.addExtra(yes);
|
component.addExtra(yes);
|
||||||
component.addExtra(ChatColor.RESET + " / ");
|
component.addExtra(ChatColor.RESET + " / ");
|
||||||
final TextComponent no = new TextComponent(getSelectionText(context, 2));
|
final TextComponent no = new TextComponent(getSelectionText(context, 2));
|
||||||
no.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, Lang.get("noWord")));
|
no.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/quests choice " + Lang.get("noWord")));
|
||||||
component.addExtra(no);
|
component.addExtra(no);
|
||||||
|
|
||||||
((Player)context.getForWhom()).spigot().sendMessage(component);
|
((Player)context.getForWhom()).spigot().sendMessage(component);
|
||||||
|
|
|
@ -1497,7 +1497,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||||
for (final String name : plugin.getCustomRequirements().stream().map(CustomRequirement::getModuleName)
|
for (final String name : plugin.getCustomRequirements().stream().map(CustomRequirement::getModuleName)
|
||||||
.collect(Collectors.toCollection(TreeSet::new))) {
|
.collect(Collectors.toCollection(TreeSet::new))) {
|
||||||
final TextComponent click = new TextComponent(ChatColor.DARK_PURPLE + " - " + name + "\n");
|
final TextComponent click = new TextComponent(ChatColor.DARK_PURPLE + " - " + name + "\n");
|
||||||
click.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, name));
|
click.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/quests choice " + name));
|
||||||
line.addExtra(click);
|
line.addExtra(click);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1605,7 +1605,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
|
||||||
if (co.getModuleName().equals(moduleName)) {
|
if (co.getModuleName().equals(moduleName)) {
|
||||||
final TextComponent click = new TextComponent(ChatColor.DARK_PURPLE + " - " + co.getName()
|
final TextComponent click = new TextComponent(ChatColor.DARK_PURPLE + " - " + co.getName()
|
||||||
+ "\n");
|
+ "\n");
|
||||||
click.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, co.getName()));
|
click.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/quests choice " + co.getName()));
|
||||||
line.addExtra(click);
|
line.addExtra(click);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1730,7 +1730,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||||
for (final String name : plugin.getCustomRewards().stream().map(CustomReward::getModuleName)
|
for (final String name : plugin.getCustomRewards().stream().map(CustomReward::getModuleName)
|
||||||
.collect(Collectors.toCollection(TreeSet::new))) {
|
.collect(Collectors.toCollection(TreeSet::new))) {
|
||||||
final TextComponent click = new TextComponent(ChatColor.DARK_PURPLE + " - " + name + "\n");
|
final TextComponent click = new TextComponent(ChatColor.DARK_PURPLE + " - " + name + "\n");
|
||||||
click.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, name));
|
click.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/quests choice " + name));
|
||||||
line.addExtra(click);
|
line.addExtra(click);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1838,7 +1838,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||||
if (co.getModuleName().equals(moduleName)) {
|
if (co.getModuleName().equals(moduleName)) {
|
||||||
final TextComponent click = new TextComponent(ChatColor.DARK_PURPLE + " - " + co.getName()
|
final TextComponent click = new TextComponent(ChatColor.DARK_PURPLE + " - " + co.getName()
|
||||||
+ "\n");
|
+ "\n");
|
||||||
click.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, co.getName()));
|
click.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/quests choice " + co.getName()));
|
||||||
line.addExtra(click);
|
line.addExtra(click);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2426,7 +2426,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
||||||
for (final String name : plugin.getCustomObjectives().stream().map(ICustomObjective::getModuleName)
|
for (final String name : plugin.getCustomObjectives().stream().map(ICustomObjective::getModuleName)
|
||||||
.collect(Collectors.toCollection(TreeSet::new))) {
|
.collect(Collectors.toCollection(TreeSet::new))) {
|
||||||
final TextComponent click = new TextComponent(ChatColor.DARK_PURPLE + " - " + name + "\n");
|
final TextComponent click = new TextComponent(ChatColor.DARK_PURPLE + " - " + name + "\n");
|
||||||
click.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, name));
|
click.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/quests choice " + name));
|
||||||
line.addExtra(click);
|
line.addExtra(click);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2535,7 +2535,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
|
||||||
if (co.getModuleName().equals(moduleName)) {
|
if (co.getModuleName().equals(moduleName)) {
|
||||||
final TextComponent click = new TextComponent(ChatColor.DARK_PURPLE + " - " + co.getName()
|
final TextComponent click = new TextComponent(ChatColor.DARK_PURPLE + " - " + co.getName()
|
||||||
+ "\n");
|
+ "\n");
|
||||||
click.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, co.getName()));
|
click.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/quests choice " + co.getName()));
|
||||||
line.addExtra(click);
|
line.addExtra(click);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,10 @@ public class QuestsLog4JFilter extends AbstractFilter {
|
||||||
if (message.contains("quests-hikari - Shutdown")) {
|
if (message.contains("quests-hikari - Shutdown")) {
|
||||||
return Result.DENY;
|
return Result.DENY;
|
||||||
}
|
}
|
||||||
|
// Command for 1.19+ clickable text spam
|
||||||
|
if (message.contains("quests choice")) {
|
||||||
|
return Result.DENY;
|
||||||
|
}
|
||||||
// Paper outputs errors when dependencies for module events are missing
|
// Paper outputs errors when dependencies for module events are missing
|
||||||
return (message.contains("Plugin Quests") && message.contains("failed to register events"))
|
return (message.contains("Plugin Quests") && message.contains("failed to register events"))
|
||||||
? Result.DENY : Result.NEUTRAL;
|
? Result.DENY : Result.NEUTRAL;
|
||||||
|
|
Loading…
Reference in New Issue