Remove ChatColor usages (#7543)

This commit is contained in:
Jake Potrebic
2022-06-02 21:26:56 -07:00
parent b63b1a42cf
commit f65eead418
15 changed files with 472 additions and 362 deletions

View File

@@ -1589,8 +1589,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+package co.aikar.timings;
+
+import com.google.common.collect.ImmutableList;
+import net.kyori.adventure.text.format.NamedTextColor;
+import org.apache.commons.lang.Validate;
+import org.bukkit.ChatColor;
+import org.bukkit.command.CommandSender;
+import org.bukkit.command.defaults.BukkitCommand;
+import org.bukkit.util.StringUtil;
@@ -1598,7 +1598,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import java.util.ArrayList;
+import java.util.List;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import static net.kyori.adventure.text.Component.text;
+
+
+public class TimingsCommand extends BukkitCommand {
@@ -1618,41 +1619,41 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return true;
+ }
+ if (args.length < 1) {
+ sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
+ sender.sendMessage(text("Usage: " + this.usageMessage, NamedTextColor.RED));
+ return true;
+ }
+ final String arg = args[0];
+ if ("on".equalsIgnoreCase(arg)) {
+ Timings.setTimingsEnabled(true);
+ sender.sendMessage("Enabled Timings & Reset");
+ sender.sendMessage(text("Enabled Timings & Reset"));
+ return true;
+ } else if ("off".equalsIgnoreCase(arg)) {
+ Timings.setTimingsEnabled(false);
+ sender.sendMessage("Disabled Timings");
+ sender.sendMessage(text("Disabled Timings"));
+ return true;
+ }
+
+ if (!Timings.isTimingsEnabled()) {
+ sender.sendMessage("Please enable timings by typing /timings on");
+ sender.sendMessage(text("Please enable timings by typing /timings on"));
+ return true;
+ }
+
+ long now = System.currentTimeMillis();
+ if ("verbon".equalsIgnoreCase(arg)) {
+ Timings.setVerboseTimingsEnabled(true);
+ sender.sendMessage("Enabled Verbose Timings");
+ sender.sendMessage(text("Enabled Verbose Timings"));
+ return true;
+ } else if ("verboff".equalsIgnoreCase(arg)) {
+ Timings.setVerboseTimingsEnabled(false);
+ sender.sendMessage("Disabled Verbose Timings");
+ sender.sendMessage(text("Disabled Verbose Timings"));
+ return true;
+ } else if ("reset".equalsIgnoreCase(arg)) {
+ if (now - lastResetAttempt < 30000) {
+ TimingsManager.reset();
+ sender.sendMessage(ChatColor.RED + "Timings reset. Please wait 5-10 minutes before using /timings report.");
+ sender.sendMessage(text("Timings reset. Please wait 5-10 minutes before using /timings report.", NamedTextColor.RED));
+ } else {
+ lastResetAttempt = now;
+ sender.sendMessage(ChatColor.RED + "WARNING: Timings v2 should not be reset. If you are encountering lag, please wait 3 minutes and then issue a report. The best timings will include 10+ minutes, with data before and after your lag period. If you really want to reset, run this command again within 30 seconds.");
+ sender.sendMessage(text("WARNING: Timings v2 should not be reset. If you are experiencing lag, please wait 3 minutes and then issue a report. The best timings will include 10+ minutes, with data before and after your lag period. If you really want to reset, run this command again within 30 seconds.", NamedTextColor.RED));
+ }
+ } else if (
+ "paste".equalsIgnoreCase(arg) ||
@@ -1663,7 +1664,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ ) {
+ Timings.generateReport(sender);
+ } else {
+ sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
+ sender.sendMessage(text("Usage: " + this.usageMessage, NamedTextColor.RED));
+ }
+ return true;
+ }