From 74e9dbfa19483a05f709c618fec28760e9d9a5ce Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Wed, 14 Dec 2022 19:54:43 -0800 Subject: [PATCH] Improve some logging and errors (#8673) --- .../server/Improve-logging-and-errors.patch | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 patches/server/Improve-logging-and-errors.patch diff --git a/patches/server/Improve-logging-and-errors.patch b/patches/server/Improve-logging-and-errors.patch new file mode 100644 index 0000000000..3f76583375 --- /dev/null +++ b/patches/server/Improve-logging-and-errors.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Wed, 14 Dec 2022 15:52:11 -0800 +Subject: [PATCH] Improve logging and errors + + +diff --git a/src/main/java/net/minecraft/server/packs/PathPackResources.java b/src/main/java/net/minecraft/server/packs/PathPackResources.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/packs/PathPackResources.java ++++ b/src/main/java/net/minecraft/server/packs/PathPackResources.java +@@ -0,0 +0,0 @@ public class PathPackResources extends AbstractPackResources { + try (DirectoryStream directoryStream = Files.newDirectoryStream(path)) { + for(Path path2 : directoryStream) { + String string = path2.getFileName().toString(); ++ // Paper start ++ if (!Files.isDirectory(path2)) { ++ LOGGER.error("Invalid directory entry: {} in {}.", string, this.root, new java.nio.file.NotDirectoryException(string)); ++ continue; ++ } ++ // Paper end + if (string.equals(string.toLowerCase(Locale.ROOT))) { + set.add(string); + } else { +diff --git a/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java b/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java ++++ b/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java +@@ -0,0 +0,0 @@ import org.bukkit.material.MaterialData; + */ + @Deprecated + public final class CraftLegacy { ++ private static final org.slf4j.Logger LOGGER = com.mojang.logging.LogUtils.getLogger(); // Paper + + private static final Map SPAWN_EGGS = new HashMap<>(); + private static final Set whitelistedStates = new HashSet<>(Arrays.asList("explode", "check_decay", "decayable", "facing")); +@@ -0,0 +0,0 @@ public final class CraftLegacy { + } + + static { +- System.err.println("Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!"); ++ LOGGER.warn("Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!"); // Paper - doesn't need to be an error + if (MinecraftServer.getServer() != null && MinecraftServer.getServer().isDebugging()) { + new Exception().printStackTrace(); + }