Paper/patches/server/0898-Improve-logging-and-errors.patch
Jake Potrebic d8847bc1f3
Updated Upstream (Bukkit/CraftBukkit) (#9922)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
fde5602a PR-927: Add PlayerRecipeBookSettingsChangeEvent
949ff217 PR-930: Add methods to get/set evoker fang attack delay
f6f7c79d SPIGOT-7514, PR-929: Add "Enchantment Roll" API to enchant items according to Minecraft mechanics
d40e22da PR-712: Add API to get full result of crafting items

CraftBukkit Changes:
c8feb0629 PR-1291: Improve precondition message in Entity#playEffect
482c56a00 PR-1285: Add PlayerRecipeBookSettingsChangeEvent
cdf798800 PR-1290: Add methods to get/set evoker fang attack delay
2c1b5f78f SPIGOT-7514, PR-1289: Add "Enchantment Roll" API to enchant items according to Minecraft mechanics
6aa644ae9 PR-992: Add API to get full result of crafting items
ffb1319bc PR-1287: Fix scoreboards not updating in Player#setStatistic
2023-11-11 12:25:45 -08:00

72 lines
4.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Wed, 14 Dec 2022 15:52:11 -0800
Subject: [PATCH] Improve logging and errors
Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
diff --git a/src/main/java/net/minecraft/advancements/AdvancementTree.java b/src/main/java/net/minecraft/advancements/AdvancementTree.java
index 938fe76677139e7e99698b61691bfcadf70dbd87..8aa7439d9f3c071f88c84c6c75b7a65e5e5cfa82 100644
--- a/src/main/java/net/minecraft/advancements/AdvancementTree.java
+++ b/src/main/java/net/minecraft/advancements/AdvancementTree.java
@@ -35,7 +35,7 @@ public class AdvancementTree {
this.remove(advancementnode1);
}
- AdvancementTree.LOGGER.info("Forgot about advancement {}", advancement.holder());
+ AdvancementTree.LOGGER.debug("Forgot about advancement {}", advancement.holder()); // Paper
this.nodes.remove(advancement.holder().id());
if (advancement.parent() == null) {
this.roots.remove(advancement);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index d63451592c34429c1c827ff8e16989347e2efdaa..e87e99569fe5d6d916faa385b1793db858ab39b7 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3386,7 +3386,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator));
} catch (ProfilePublicKey.ValidationException profilepublickey_b) {
- ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage());
+ // ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage()); // Paper - unnecessary log
this.disconnect(profilepublickey_b.getComponent(), profilepublickey_b.kickCause); // Paper - kick event causes
}
diff --git a/src/main/java/net/minecraft/server/packs/PathPackResources.java b/src/main/java/net/minecraft/server/packs/PathPackResources.java
index 89aa86a49eda563c82ccedc99641e699f8e578b0..4822f94ce183a99ad9e0d1bdc6c5708d958f6104 100644
--- a/src/main/java/net/minecraft/server/packs/PathPackResources.java
+++ b/src/main/java/net/minecraft/server/packs/PathPackResources.java
@@ -108,6 +108,12 @@ public class PathPackResources extends AbstractPackResources {
try (DirectoryStream<Path> 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 (ResourceLocation.isValidNamespace(string)) {
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 080cca90f15d90249b7a38f33286ae2f735ba7d9..2677e21d8239bf0361a3bc5c9a50c328e54d70f6 100644
--- a/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java
+++ b/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java
@@ -44,6 +44,7 @@ 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<Byte, Material> SPAWN_EGGS = new HashMap<>();
private static final Set<String> whitelistedStates = new HashSet<>(Arrays.asList("explode", "check_decay", "decayable", "facing"));
@@ -255,7 +256,7 @@ 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();
}