diff --git a/paper-server/patches/sources/net/minecraft/advancements/AdvancementTree.java.patch b/paper-server/patches/sources/net/minecraft/advancements/AdvancementTree.java.patch index 0dbb25d0a6..4bec8c46eb 100644 --- a/paper-server/patches/sources/net/minecraft/advancements/AdvancementTree.java.patch +++ b/paper-server/patches/sources/net/minecraft/advancements/AdvancementTree.java.patch @@ -1,11 +1,20 @@ --- a/net/minecraft/advancements/AdvancementTree.java +++ b/net/minecraft/advancements/AdvancementTree.java +@@ -35,7 +35,7 @@ + this.remove(advancementnode1); + } + +- AdvancementTree.LOGGER.info("Forgot about advancement {}", advancement.holder()); ++ AdvancementTree.LOGGER.debug("Forgot about advancement {}", advancement.holder()); // Paper - Improve logging and errors + this.nodes.remove(advancement.holder().id()); + if (advancement.parent() == null) { + this.roots.remove(advancement); @@ -77,7 +77,7 @@ } } - AdvancementTree.LOGGER.info("Loaded {} advancements", this.nodes.size()); -+ // AdvancementTree.LOGGER.info("Loaded {} advancements", this.nodes.size()); // CraftBukkit - moved to AdvancementDataWorld#reload ++ // AdvancementTree.LOGGER.info("Loaded {} advancements", this.nodes.size()); // CraftBukkit - moved to AdvancementDataWorld#reload // Paper - Improve logging and errors; you say it was moved... but it wasn't :) it should be moved however, since this is called when the API creates an advancement } private boolean tryInsert(AdvancementHolder advancement) { diff --git a/paper-server/patches/sources/net/minecraft/server/ServerAdvancementManager.java.patch b/paper-server/patches/sources/net/minecraft/server/ServerAdvancementManager.java.patch index e7c82bd845..5a5a995288 100644 --- a/paper-server/patches/sources/net/minecraft/server/ServerAdvancementManager.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/ServerAdvancementManager.java.patch @@ -16,7 +16,7 @@ private AdvancementTree tree = new AdvancementTree(); private final HolderLookup.Provider registries; -@@ -37,10 +41,15 @@ +@@ -37,13 +41,19 @@ Builder builder = ImmutableMap.builder(); prepared.forEach((minecraftkey, advancement) -> { @@ -33,3 +33,7 @@ AdvancementTree advancementtree = new AdvancementTree(); advancementtree.addAll(this.advancements.values()); ++ LOGGER.info("Loaded {} advancements", advancementtree.nodes().size()); // Paper - Improve logging and errors; moved from AdvancementTree#addAll + Iterator iterator = advancementtree.roots().iterator(); + + while (iterator.hasNext()) { diff --git a/paper-server/patches/sources/net/minecraft/server/dedicated/DedicatedServer.java.patch b/paper-server/patches/sources/net/minecraft/server/dedicated/DedicatedServer.java.patch index 29c6ac7b30..ed862c303d 100644 --- a/paper-server/patches/sources/net/minecraft/server/dedicated/DedicatedServer.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -215,7 +215,7 @@ InetAddress inetaddress = null; if (!this.getLocalIp().isEmpty()) { -@@ -143,12 +266,15 @@ +@@ -143,34 +266,55 @@ if (this.getPort() < 0) { this.setPort(dedicatedserverproperties.serverPort); } @@ -232,7 +232,8 @@ } catch (IOException ioexception) { DedicatedServer.LOGGER.warn("**** FAILED TO BIND TO PORT!"); DedicatedServer.LOGGER.warn("The exception was: {}", ioexception.toString()); -@@ -156,21 +282,38 @@ + DedicatedServer.LOGGER.warn("Perhaps a server is already running on that port?"); ++ if (true) throw new IllegalStateException("Failed to bind to port", ioexception); // Paper - Propagate failed to bind to port error return false; } @@ -276,7 +277,7 @@ this.debugSampleSubscriptionTracker = new DebugSampleSubscriptionTracker(this.getPlayerList()); this.tickTimeLogger = new RemoteSampleLogger(TpsDebugDimensions.values().length, this.debugSampleSubscriptionTracker, RemoteDebugSampleType.TICK_TIME); long i = Util.getNanos(); -@@ -178,13 +321,13 @@ +@@ -178,13 +322,13 @@ SkullBlockEntity.setup(this.services, this); GameProfileCache.setUsesAuthentication(this.usesAuthentication()); DedicatedServer.LOGGER.info("Preparing level \"{}\"", this.getLevelIdName()); @@ -292,7 +293,7 @@ } if (dedicatedserverproperties.enableQuery) { -@@ -197,7 +340,7 @@ +@@ -197,7 +341,7 @@ this.rconThread = RconThread.create(this); } @@ -301,7 +302,7 @@ Thread thread1 = new Thread(new ServerWatchdog(this)); thread1.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandlerWithName(DedicatedServer.LOGGER)); -@@ -215,6 +358,12 @@ +@@ -215,6 +359,12 @@ } } @@ -314,7 +315,7 @@ @Override public boolean isSpawningMonsters() { return this.settings.getProperties().spawnMonsters && super.isSpawningMonsters(); -@@ -227,7 +376,7 @@ +@@ -227,7 +377,7 @@ @Override public void forceDifficulty() { @@ -323,7 +324,7 @@ } @Override -@@ -286,13 +435,14 @@ +@@ -286,13 +436,14 @@ } if (this.rconThread != null) { @@ -340,7 +341,7 @@ } @Override -@@ -302,19 +452,29 @@ +@@ -302,19 +453,29 @@ } @Override @@ -376,7 +377,7 @@ } } -@@ -383,7 +543,7 @@ +@@ -383,7 +544,7 @@ @Override public boolean isUnderSpawnProtection(ServerLevel world, BlockPos pos, Player player) { @@ -385,7 +386,7 @@ return false; } else if (this.getPlayerList().getOps().isEmpty()) { return false; -@@ -453,7 +613,11 @@ +@@ -453,7 +614,11 @@ public boolean enforceSecureProfile() { DedicatedServerProperties dedicatedserverproperties = this.getProperties(); @@ -398,7 +399,7 @@ } @Override -@@ -541,16 +705,52 @@ +@@ -541,16 +706,52 @@ @Override public String getPluginNames() { @@ -455,7 +456,7 @@ } public void storeUsingWhiteList(boolean useWhitelist) { -@@ -660,4 +860,15 @@ +@@ -660,4 +861,15 @@ } } } diff --git a/paper-server/patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch b/paper-server/patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch index 97590df199..704171826e 100644 --- a/paper-server/patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch @@ -2436,11 +2436,13 @@ } else { try { SignatureValidator signaturevalidator = this.server.getProfileKeySignatureValidator(); -@@ -2046,7 +3503,7 @@ +@@ -2045,8 +3502,8 @@ + 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()); - this.disconnect(profilepublickey_b.getComponent()); ++ // ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage()); // Paper - Improve logging and errors + this.disconnect(profilepublickey_b.getComponent(), profilepublickey_b.kickCause); // Paper - kick event causes } diff --git a/paper-server/patches/sources/net/minecraft/server/packs/PathPackResources.java.patch b/paper-server/patches/sources/net/minecraft/server/packs/PathPackResources.java.patch new file mode 100644 index 0000000000..4c21d9802f --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/server/packs/PathPackResources.java.patch @@ -0,0 +1,15 @@ +--- a/net/minecraft/server/packs/PathPackResources.java ++++ b/net/minecraft/server/packs/PathPackResources.java +@@ -103,6 +103,12 @@ + try (DirectoryStream directoryStream = Files.newDirectoryStream(path)) { + for (Path path2 : directoryStream) { + String string = path2.getFileName().toString(); ++ // Paper start - Improve logging and errors ++ if (!Files.isDirectory(path2)) { ++ LOGGER.error("Invalid directory entry: {} in {}.", string, this.root, new java.nio.file.NotDirectoryException(string)); ++ continue; ++ } ++ // Paper end - Improve logging and errors + if (ResourceLocation.isValidNamespace(string)) { + set.add(string); + } else { diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java b/paper-server/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java index 46787d68ea..51ae8eddad 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java +++ b/paper-server/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 - Improve logging and errors private static final Map SPAWN_EGGS = new HashMap<>(); private static final Set whitelistedStates = new HashSet<>(Arrays.asList("explode", "check_decay", "decayable", "facing")); @@ -264,7 +265,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 - Improve logging and errors; doesn't need to be an error if (MinecraftServer.getServer() != null && MinecraftServer.getServer().isDebugging()) { new Exception().printStackTrace(); }