Re-add more clickable prompts, fixes #2032

This commit is contained in:
PikaMug 2022-11-23 08:23:09 -05:00
parent a28e94813d
commit ee45d26a5a
6 changed files with 13 additions and 9 deletions

View File

@ -162,7 +162,7 @@ public class NpcOfferQuestPrompt extends MiscStringPrompt {
for (int i = 1; i <= size + 1; i++) {
final TextComponent choice = new TextComponent("\n" + getNumberColor(context, i) + ChatColor.BOLD + 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) {
choice.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
new ComponentBuilder(quests.get(i - 1).getDescription()).create()));

View File

@ -80,11 +80,11 @@ public class QuestAbandonPrompt extends MiscStringPrompt {
final TextComponent component = new TextComponent("");
component.addExtra(ChatColor.YELLOW + getQueryText(context) + " " + ChatColor.GREEN);
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(ChatColor.RESET + " / ");
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);
((Player)context.getForWhom()).spigot().sendMessage(component);

View File

@ -1497,7 +1497,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
for (final String name : plugin.getCustomRequirements().stream().map(CustomRequirement::getModuleName)
.collect(Collectors.toCollection(TreeSet::new))) {
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);
}
}
@ -1605,7 +1605,7 @@ public class RequirementsPrompt extends QuestsEditorNumericPrompt {
if (co.getModuleName().equals(moduleName)) {
final TextComponent click = new TextComponent(ChatColor.DARK_PURPLE + " - " + co.getName()
+ "\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);
}
}

View File

@ -1730,7 +1730,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
for (final String name : plugin.getCustomRewards().stream().map(CustomReward::getModuleName)
.collect(Collectors.toCollection(TreeSet::new))) {
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);
}
}
@ -1838,7 +1838,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
if (co.getModuleName().equals(moduleName)) {
final TextComponent click = new TextComponent(ChatColor.DARK_PURPLE + " - " + co.getName()
+ "\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);
}
}

View File

@ -2426,7 +2426,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
for (final String name : plugin.getCustomObjectives().stream().map(ICustomObjective::getModuleName)
.collect(Collectors.toCollection(TreeSet::new))) {
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);
}
}
@ -2535,7 +2535,7 @@ public class StageMainPrompt extends QuestsEditorNumericPrompt {
if (co.getModuleName().equals(moduleName)) {
final TextComponent click = new TextComponent(ChatColor.DARK_PURPLE + " - " + co.getName()
+ "\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);
}
}

View File

@ -43,6 +43,10 @@ public class QuestsLog4JFilter extends AbstractFilter {
if (message.contains("quests-hikari - Shutdown")) {
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
return (message.contains("Plugin Quests") && message.contains("failed to register events"))
? Result.DENY : Result.NEUTRAL;