Remove ChatColor usages (#7543)
This commit is contained in:
parent
b63b1a42cf
commit
f65eead418
15 changed files with 472 additions and 362 deletions
|
@ -52,7 +52,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
import org.apache.commons.lang3.tuple.MutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -0,0 +0,0 @@ import java.util.stream.Collectors;
|
||||
@@ -0,0 +0,0 @@ import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static net.kyori.adventure.text.Component.text;
|
||||
+import static net.kyori.adventure.text.format.NamedTextColor.BLUE;
|
||||
+import static net.kyori.adventure.text.format.NamedTextColor.DARK_AQUA;
|
||||
import static net.kyori.adventure.text.format.NamedTextColor.GREEN;
|
||||
import static net.kyori.adventure.text.format.NamedTextColor.RED;
|
||||
import static net.kyori.adventure.text.format.NamedTextColor.YELLOW;
|
||||
|
||||
public class PaperCommand extends Command {
|
||||
private static final String BASE_PERM = "bukkit.command.paper.";
|
||||
|
@ -109,7 +117,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ for (int i = 1; i < args.length; ++i) {
|
||||
+ org.bukkit.World world = Bukkit.getWorld(args[i]);
|
||||
+ if (world == null) {
|
||||
+ sender.sendMessage(ChatColor.RED + "World '" + args[i] + "' is invalid");
|
||||
+ sender.sendMessage(text("World '" + args[i] + "' is invalid", RED));
|
||||
+ return;
|
||||
+ }
|
||||
+ worlds.add(world);
|
||||
|
@ -162,22 +170,30 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ accumulatedTicking += ticking;
|
||||
+ accumulatedEntityTicking += entityTicking;
|
||||
+
|
||||
+ sender.sendMessage(ChatColor.BLUE + "Chunks in " + ChatColor.GREEN + bukkitWorld.getName() + ChatColor.DARK_AQUA + ":");
|
||||
+ sender.sendMessage(ChatColor.BLUE + "Total: " + ChatColor.DARK_AQUA + total + ChatColor.BLUE + " Inactive: " + ChatColor.DARK_AQUA
|
||||
+ + inactive + ChatColor.BLUE + " Border: " + ChatColor.DARK_AQUA + border + ChatColor.BLUE + " Ticking: "
|
||||
+ + ChatColor.DARK_AQUA + ticking + ChatColor.BLUE + " Entity: " + ChatColor.DARK_AQUA + entityTicking);
|
||||
+ sender.sendMessage(text().append(text("Chunks in ", BLUE), text(bukkitWorld.getName(), GREEN), text(":")));
|
||||
+ sender.sendMessage(text().color(DARK_AQUA).append(
|
||||
+ text("Total: ", BLUE), text(total),
|
||||
+ text(" Inactive: ", BLUE), text(inactive),
|
||||
+ text(" Border: ", BLUE), text(border),
|
||||
+ text(" Ticking: ", BLUE), text(ticking),
|
||||
+ text(" Entity: ", BLUE), text(entityTicking)
|
||||
+ ));
|
||||
+ }
|
||||
+ if (worlds.size() > 1) {
|
||||
+ sender.sendMessage(ChatColor.BLUE + "Chunks in " + ChatColor.GREEN + "all listed worlds" + ChatColor.DARK_AQUA + ":");
|
||||
+ sender.sendMessage(ChatColor.BLUE + "Total: " + ChatColor.DARK_AQUA + accumulatedTotal + ChatColor.BLUE + " Inactive: " + ChatColor.DARK_AQUA
|
||||
+ + accumulatedInactive + ChatColor.BLUE + " Border: " + ChatColor.DARK_AQUA + accumulatedBorder + ChatColor.BLUE + " Ticking: "
|
||||
+ + ChatColor.DARK_AQUA + accumulatedTicking + ChatColor.BLUE + " Entity: " + ChatColor.DARK_AQUA + accumulatedEntityTicking);
|
||||
+ sender.sendMessage(text().append(text("Chunks in ", BLUE), text("all listed worlds", GREEN), text(":", DARK_AQUA)));
|
||||
+ sender.sendMessage(text().color(DARK_AQUA).append(
|
||||
+ text("Total: ", BLUE), text(accumulatedTotal),
|
||||
+ text(" Inactive: ", BLUE), text(accumulatedInactive),
|
||||
+ text(" Border: ", BLUE), text(accumulatedBorder),
|
||||
+ text(" Ticking: ", BLUE), text(accumulatedTicking),
|
||||
+ text(" Entity: ", BLUE), text(accumulatedEntityTicking)
|
||||
+ ));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private void doDebug(CommandSender sender, String[] args) {
|
||||
+ if (args.length < 2) {
|
||||
+ sender.sendMessage(ChatColor.RED + "Use /paper debug [chunks] help for more information on a specific command");
|
||||
+ sender.sendMessage(text("Use /paper debug [chunks] help for more information on a specific command", RED));
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
|
@ -185,25 +201,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ switch (debugType) {
|
||||
+ case "chunks":
|
||||
+ if (args.length >= 3 && args[2].toLowerCase(Locale.ENGLISH).equals("help")) {
|
||||
+ sender.sendMessage(ChatColor.RED + "Use /paper debug chunks to dump loaded chunk information to a file");
|
||||
+ sender.sendMessage(text("Use /paper debug chunks [world] to dump loaded chunk information to a file", RED));
|
||||
+ break;
|
||||
+ }
|
||||
+ File file = new File(new File(new File("."), "debug"),
|
||||
+ "chunks-" + DateTimeFormatter.ofPattern("yyyy-MM-dd_HH.mm.ss").format(LocalDateTime.now()) + ".txt");
|
||||
+ sender.sendMessage(ChatColor.GREEN + "Writing chunk information dump to " + file.toString());
|
||||
+ sender.sendMessage(text("Writing chunk information dump to " + file, GREEN));
|
||||
+ try {
|
||||
+ MCUtil.dumpChunks(file);
|
||||
+ sender.sendMessage(ChatColor.GREEN + "Successfully written chunk information!");
|
||||
+ sender.sendMessage(text("Successfully written chunk information!", GREEN));
|
||||
+ } catch (Throwable thr) {
|
||||
+ MinecraftServer.LOGGER.warn("Failed to dump chunk information to file " + file.toString(), thr);
|
||||
+ sender.sendMessage(ChatColor.RED + "Failed to dump chunk information, see console");
|
||||
+ sender.sendMessage(text("Failed to dump chunk information, see console", RED));
|
||||
+ }
|
||||
+
|
||||
+ break;
|
||||
+ case "help":
|
||||
+ // fall through to default
|
||||
+ default:
|
||||
+ sender.sendMessage(ChatColor.RED + "Use /paper debug [chunks] help for more information on a specific command");
|
||||
+ sender.sendMessage(text("Use /paper debug [chunks] help for more information on a specific command", RED));
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue