From 417a5fabeac5edee9ef5884830e1a5880e8512b1 Mon Sep 17 00:00:00 2001
From: LMBishop <13875753+LMBishop@users.noreply.github.com>
Date: Wed, 6 Jul 2022 21:28:01 +0100
Subject: Add extended description to warning type
---
.../quests/bukkit/util/CommandUtils.java | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
(limited to 'bukkit/src/main/java')
diff --git a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/util/CommandUtils.java b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/util/CommandUtils.java
index ddf3db4f..6cbb0934 100644
--- a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/util/CommandUtils.java
+++ b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/util/CommandUtils.java
@@ -51,17 +51,25 @@ public class CommandUtils {
for (ConfigProblem problem : sortedProblems.get(type)) {
if (Chat.isModernChatAvailable()) {
String color = Chat.matchConfigProblemToColorName(problem.getType());
- String extendedDescription = String.format("<%s>%s%s>
Problem location: %s
%s",
+ String extendedDescription = problem.getExtendedDescription() != null ? String.format("<%s>%s%s>
Problem location: %s
%s",
color,
problem.getDescription(),
color,
problem.getLocation(),
problem.getExtendedDescription()
- );
+ ) : "This error has no extended description";
extendedDescription = extendedDescription.replace("'", "\\'");
+ String problemDescription = String.format("<%s>%s%s>
%s",
+ color,
+ problem.getType().getTitle(),
+ color,
+ problem.getType().getDescription()
+ );
+ problemDescription = problemDescription.replace("'", "\\'");
String message = String.format(
- " | - <%s>%s%s>: %s :%s",
+ " | - <%s>%s%s>: %s :%s",
+ problemDescription,
color,
problem.getType().getShortened(),
color,
@@ -90,7 +98,9 @@ public class CommandUtils {
sender.sendMessage(ChatColor.DARK_GRAY.toString() + "----");
sender.sendMessage(ChatColor.GRAY.toString() + count + " problem(s) | " + String.join(ChatColor.DARK_GRAY + ", ", legend));
- sender.sendMessage(ChatColor.DARK_GRAY.toString() + "Mouse-over for more information.");
+ if (Chat.isModernChatAvailable()) {
+ sender.sendMessage(ChatColor.DARK_GRAY + "Mouse-over for more information.");
+ }
} else {
sender.sendMessage(ChatColor.GRAY + "Quests did not detect any problems with your configuration.");
}
--
cgit v1.2.3-70-g09d2