Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unformatted Skript system messages #7147

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/main/java/ch/njol/skript/SkriptCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import ch.njol.skript.aliases.Aliases;
import ch.njol.skript.command.CommandHelp;
import ch.njol.skript.doc.Documentation;
import ch.njol.skript.doc.DocumentationIdProvider;
import ch.njol.skript.doc.HTMLGenerator;
import ch.njol.skript.doc.JSONGenerator;
import ch.njol.skript.localization.ArgsMessage;
Expand All @@ -36,6 +35,7 @@
import ch.njol.skript.util.ExceptionUtils;
import ch.njol.skript.util.FileUtils;
import ch.njol.skript.util.SkriptColor;
import ch.njol.skript.util.Utils;
import ch.njol.util.OpenCloseable;
import ch.njol.util.StringUtils;
import org.bukkit.Bukkit;
Expand Down Expand Up @@ -102,7 +102,8 @@ private static void reloading(CommandSender sender, String what, RedirectingLogH
Skript.info(sender, message);

// Log reloading message
logHandler.log(new LogEntry(Level.INFO, Language.format(CONFIG_NODE + ".reload." + "player reload", sender.getName(), what)));
String text = Language.format(CONFIG_NODE + ".reload." + "player reload", sender.getName(), what);
logHandler.log(new LogEntry(Level.INFO, Utils.replaceEnglishChatStyles(text)));
}


Expand All @@ -116,10 +117,10 @@ private static void reloaded(CommandSender sender, RedirectingLogHandler logHand
String message;
if (logHandler.numErrors() == 0) {
message = StringUtils.fixCapitalization(PluralizingArgsMessage.format(m_reloaded.toString(what, timeTaken)));
logHandler.log(new LogEntry(Level.INFO, message));
logHandler.log(new LogEntry(Level.INFO, Utils.replaceEnglishChatStyles(message)));
} else {
message = StringUtils.fixCapitalization(PluralizingArgsMessage.format(m_reload_error.toString(what, logHandler.numErrors(), timeTaken)));
logHandler.log(new LogEntry(Level.SEVERE, message));
logHandler.log(new LogEntry(Level.SEVERE, Utils.replaceEnglishChatStyles(message)));
}
}

Expand Down
12 changes: 5 additions & 7 deletions src/main/java/ch/njol/skript/log/LogEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@
*/
package ch.njol.skript.log;

import java.util.logging.Level;

import ch.njol.skript.Skript;
import ch.njol.skript.config.Config;
import ch.njol.skript.config.Node;
import ch.njol.skript.localization.ArgsMessage;
import ch.njol.skript.util.Utils;

import org.bukkit.ChatColor;
import org.jetbrains.annotations.Nullable;

import ch.njol.skript.Skript;
import ch.njol.skript.config.Config;
import ch.njol.skript.config.Node;
import java.util.logging.Level;

public class LogEntry {

Expand Down Expand Up @@ -171,7 +169,7 @@ public String toFormattedString() {
from = ChatColor.GRAY + " " + from + "\n";

return
String.format(lineInfoMsg, String.valueOf(node.getLine()), c.getFileName()) + // String.valueOf is to convert the line number (int) to a String
String.format(lineInfoMsg, node.getLine(), c.getFileName()) +
sovdeeth marked this conversation as resolved.
Show resolved Hide resolved
String.format(detailsMsg, message.replaceAll("§", "&")) + from +
String.format(lineDetailsMsg, node.save().trim().replaceAll("§", "&"));
}
Expand Down